Document navigation

Project Operations

CreateIAM2Project

API Request

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: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
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
Request Parameters
Name Type Location Description Optional Value Starting Version
name String body (contained in the params structure) The resource name. 2.4.0
description String body (contained in the params structure) Optional. The detailed description of the resource. 2.4.0
attributes List body (contained in the params structure) Optional. 2.4.0
resourceUuid String body (contained in the params structure) Optional. 2.4.0
systemTags List body Optional. 2.4.0
userTags List body Optional. 2.4.0
quota Map body (contained in the params structure) Optional. 2.4.0
roleUuids List body (contained in the params structure) Optional. 2.4.0
resourceTemplates List body (contained in the params structure) Optional. The resource template. 4.4.0
organizationUuid String body (contained in the params structure) Optional. The organization UUID. 4.4.0
tagUuids List body (contained in the params structure) Optional. The tag UUID. 4.4.0

API Response

Sample Response
{
  "inventory": {
    "uuid": "154643938783465e9899fd2617446a62",
    "name": "project",
    "state": "Enabled"
  }
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 2.4.0
inventory IAM2ProjectInventory See inventory. 2.4.0
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 2.4.0
description String The brief description of the error. 2.4.0
details String The details about the error. 2.4.0
elaboration String The reserved field. Default value: null. 2.4.0
opaque LinkedHashMap The reserved field. Default value: null. 2.4.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 2.4.0
#inventory
Name Type Description Starting Version
uuid String The resource UUID. 2.4.0
name String The resource name. 2.4.0
description String The detailed description of the resource. 2.4.0
createDate Timestamp The creation date. 2.4.0
lastOpDate Timestamp The last operation date. 2.4.0
linkedAccountUuid String 2.4.0
state ProjectState See state. 2.4.0
attributes List See attributes. 2.4.0
#state
Name Type Description Starting Version
name String The resource name. 2.4.0
ordinal int 2.4.0
#attributes
Name Type Description Starting Version
uuid String The resource UUID. 2.4.0
name String The resource name. 2.4.0
value String 2.4.0
type AttributeType See type. 2.4.0
#type
Name Type Description Starting Version
name String The resource name. 2.4.0
ordinal int 2.4.0

SDK Sample

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()

CreateIAM2ProjectFromTemplate

API Request

URLs
POST zstack/v1/iam2/projects/from/templates/{templateUuid}
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "name": "project",
    "organizationUuid": "589ddc9593ea3d378fd34623ee243b55"
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
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
Request Parameters
Name Type Location Description Optional Value Starting Version
name String body (contained in the params structure) The resource name. 2.4.0
description String body (contained in the params structure) Optional. The detailed description of the resource. 2.4.0
templateUuid String url 2.4.0
resourceUuid String body (contained in the params structure) Optional. 2.4.0
systemTags List body Optional. 2.4.0
userTags List body Optional. 2.4.0
roleUuids List body (contained in the params structure) Optional. 2.4.0
organizationUuid String body (contained in the params structure) Optional. The organization UUID. 4.4.0
tagUuids List body (contained in the params structure) Optional. The tag UUID. 4.4.0

API Response

Sample Response
{
  "inventory": {
    "uuid": "31bede78c8b748d1b2ac8ea058135bb4",
    "name": "project",
    "state": "Enabled"
  }
}
Name Type Description Starting Version
success boolean 0.6
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 2.4.0
inventory IAM2ProjectInventory See inventory. 2.4.0
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 2.4.0
description String The brief description of the error. 2.4.0
details String The details about the error. 2.4.0
elaboration String The reserved field. Default value: null. 2.4.0
opaque LinkedHashMap The reserved field. Default value: null. 2.4.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 2.4.0
#inventory
Name Type Description Starting Version
uuid String The resource UUID. 2.4.0
name String The resource name. 2.4.0
description String The detailed description of the resource. 2.4.0
createDate Timestamp The creation date. 2.4.0
lastOpDate Timestamp The last operation date. 2.4.0
linkedAccountUuid String 2.4.0
state ProjectState See state. 2.4.0
attributes List See attributes. 2.4.0
#state
Name Type Description Starting Version
name String The resource name. 2.4.0
ordinal int 2.4.0
#attributes
Name Type Description Starting Version
uuid String The resource UUID. 2.4.0
name String The resource name. 2.4.0
value String 2.4.0
type AttributeType See type. 2.4.0
#type
Name Type Description Starting Version
name String The resource name. 2.4.0
ordinal int 2.4.0

SDK Sample

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 Request

URLs
DELETE zstack/v1/iam2/projects/{uuid}?deleteMode={deleteMode}
Headers
Authorization: OAuth the-session-uuid
Curl Sample
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
Request Parameters
Name Type Location Description Optional Value Starting Version
uuid String url The resource UUID. 2.4.0
deleteMode String url Optional. The delete mode. 2.4.0
systemTags List body Optional. The system tags. 2.4.0
userTags List body Optional. The user tags. 2.4.0

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,
{
"error": {
    "code": "SYS.1001",
    "description": "A message or a operation timeout",
    "details": "Create VM on KVM timeout after 300s"
}
}

SDK Sample

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 Request

URLs
GET zstack/v1/iam2/projects
GET zstack/v1/iam2/projects/{uuid}
Headers
Authorization: OAuth the-session-uuid
Curl Sample
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

Queryable Fields

You can check all queryable fields and resource names that can be queried across tables by using zstack-cli, entering QueryIAM2Project, and pressing the Tab key.

API Response

Sample Response
{
  "inventories": [
    {
      "uuid": "daa77ad8d7af42cbadc88950cb85abe4",
      "name": "project",
      "state": "Enabled"
    }
  ]
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 2.4.0
inventories List See inventories. 2.4.0
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 2.4.0
description String The brief description of the error. 2.4.0
details String The details about the error. 2.4.0
elaboration String The reserved field. Default value: null. 2.4.0
opaque LinkedHashMap The reserved field. Default value: null. 2.4.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 2.4.0
#inventories
Name Type Description Starting Version
uuid String The resource UUID. 2.4.0
name String The resource name. 2.4.0
description String The detailed description of the resource. 2.4.0
createDate Timestamp The creation date. 2.4.0
lastOpDate Timestamp The last operation date. 2.4.0
linkedAccountUuid String 2.4.0
state ProjectState See state. 2.4.0
attributes List See attributes. 2.4.0
#state
Name Type Description Starting Version
name String The resource name. 2.4.0
ordinal int 2.4.0
#attributes
Name Type Description Starting Version
uuid String The resource UUID. 2.4.0
name String The resource name. 2.4.0
value String 2.4.0
type AttributeType See type. 2.4.0
#type
Name Type Description Starting Version
name String The resource name. 2.4.0
ordinal int 2.4.0

SDK Sample

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 Request

URLs
PUT zstack/v1/iam2/projects/{uuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
  "updateIAM2Project": {
    "name": "new-name"
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
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
Request Parameters
Name Type Location Description Optional Value Starting Version
uuid String url The resource UUID. 2.4.0
name String body (contained in the updateIAM2Project structure) Optional. The resource name. 2.4.0
description String body (contained in the updateIAM2Project structure) Optional. The detailed description of the resource. 2.4.0
systemTags List body Optional. The system tags. 2.4.0
userTags List body Optional. The user tags. 2.4.0

API Response

Sample Response
{
  "inventory": {
    "uuid": "41d47db9cb0040edabe5823e1fff0c0e",
    "name": "project",
    "state": "Enabled"
  }
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 2.4.0
inventory IAM2ProjectInventory See inventory. 2.4.0
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 2.4.0
description String The brief description of the error. 2.4.0
details String The details about the error. 2.4.0
elaboration String The reserved field. Default value: null. 2.4.0
opaque LinkedHashMap The reserved field. Default value: null. 2.4.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 2.4.0
#inventory
Name Type Description Starting Version
uuid String The resource UUID. 2.4.0
name String The resource name. 2.4.0
description String The detailed description of the resource. 2.4.0
createDate Timestamp The creation date. 2.4.0
lastOpDate Timestamp The last operation date. 2.4.0
linkedAccountUuid String 2.4.0
state ProjectState See state. 2.4.0
attributes List See attributes. 2.4.0
#state
Name Type Description Starting Version
name String The resource name. 2.4.0
ordinal int 2.4.0
#attributes
Name Type Description Starting Version
uuid String The resource UUID. 2.4.0
name String The resource name. 2.4.0
value String 2.4.0
type AttributeType See type. 2.4.0
#type
Name Type Description Starting Version
name String The resource name. 2.4.0
ordinal int 2.4.0

SDK Sample

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 Request

URLs
PUT zstack/v1/iam2/projects/login
Headers
Authorization: OAuth the-session-uuid
Body
{
  "loginIAM2Project": {
    "projectName": "project"
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
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
Request Parameters
Name Type Location Description Optional Value Starting Version
projectName String body (contained in the loginIAM2Project structure) 2.4.0
clientInfo Map body (contained in the loginIAM2Project structure) Optional. The client information. 3.5.0
systemTags List body Optional. The system tags. 2.4.0
userTags List body Optional. The user tags. 2.4.0

API Response

Sample Response
{
  "inventory": {
    "uuid": "3357cccd4d1436748a1721d5e12f2fcd",
    "noSessionEvaluation": false
  }
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 2.4.0
inventory SessionInventory See inventory. 2.4.0
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 2.4.0
description String The brief description of the error. 2.4.0
details String The details about the error. 2.4.0
elaboration String The reserved field. Default value: null. 2.4.0
opaque LinkedHashMap The reserved field. Default value: null. 2.4.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 2.4.0
#inventory
Name Type Description Starting Version
uuid String The resource UUID. 2.4.0
accountUuid String The account UUID. 2.4.0
userUuid String The user UUID. 2.4.0
expiredDate Timestamp 2.4.0
createDate Timestamp The creation date. 2.4.0

SDK Sample

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 Request

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: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
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
Request Parameters
Name Type Location Description Valid Value Starting Version
uuid String url The resource UUID. 4.3.0
loginExpired Map body (contained in the setIAM2ProjectLoginExpired structure) The login expiration expression. 4.3.0
systemTags List body Optional. The system tags. 4.3.0
userTags List body Optional. The user tags. 4.3.0

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,
{
	"error": {
		"code": "SYS.1001",
		"description": "A message or a operation timeout",
		"details": "Create VM on KVM timeout after 300s"
	}
}

SDK Sample

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 Request

URLs
PUT zstack/v1/iam2/projects/remove/login-expired/{uuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
  "removeIAM2ProjectLoginExpired": {
    "attributeUuid": "f386055bea993b6c88d39d33fe133c44"
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
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
Request Parameters
Name Type Location Description Valid Value Starting Version
uuid String url The resource UUID. 4.3.0
attributeUuid Map body(contained in removeIAM2ProjectLoginExpired structure) 4.3.0
systemTags List body Optional. The system tags. 4.3.0
userTags List body Optional. The user tags. 4.3.0

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,
{{
	"error": {
		"code": "SYS.1001",
		"description": "A message or a operation timeout",
		"details": "Create VM on KVM timeout after 300s"
	}
}

SDK Sample

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 Request

URLs
PUT zstack/v1/iam2/projects/{uuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
  "changeIAM2ProjectState": {
    "stateEvent": "enable"
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
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
Request Parameters
Name Type Location Description Optional Value Starting Version
uuid String url The resource UUID. 2.4.0
stateEvent StateEvent body (contained in the changeIAM2ProjectState structure)
  • enable
  • disable
2.4.0
systemTags List body Optional. The system tags. 2.4.0
userTags List body Optional. The user tags. 2.4.0

API Response

Sample Response
{
  "inventory": {
    "uuid": "21fc3599223d46ddb5d065f6bf674a70",
    "name": "project",
    "state": "Enabled"
  }
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 2.4.0
inventory IAM2ProjectInventory See inventory. 2.4.0
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 2.4.0
description String The brief description of the error. 2.4.0
details String The details about the error. 2.4.0
elaboration String The reserved field. Default value: null. 2.4.0
opaque LinkedHashMap The reserved field. Default value: null. 2.4.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 2.4.0
#inventory
Name Type Description Starting Version
uuid String The resource UUID. 2.4.0
name String The resource name. 2.4.0
description String The detailed description of the resource. 2.4.0
createDate Timestamp The creation date. 2.4.0
lastOpDate Timestamp The last operation date. 2.4.0
linkedAccountUuid String 2.4.0
state ProjectState See state. 2.4.0
attributes List See attributes. 2.4.0
#state
Name Type Description Starting Version
name String The resource name. 2.4.0
ordinal int 2.4.0
#attributes
Name Type Description Starting Version
uuid String The resource UUID. 2.4.0
name String The resource name. 2.4.0
value String 2.4.0
type AttributeType See type. 2.4.0
#type
Name Type Description Starting Version
name String The resource name. 2.4.0
ordinal int 2.4.0

SDK Sample

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 Request

URLs
DELETE zstack/v1/iam2/projects/{projectUuid}/virtual-ids?virtualIDUuids={virtualIDUuids}
Headers
Authorization: OAuth the-session-uuid
Curl Sample
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
Request Parameters
Name Type Location Description Optional Value Starting Version
projectUuid String url 2.4.0
virtualIDUuids List url 2.4.0
systemTags List body Optional. The system tags. 2.4.0
userTags List body Optional. The user tags. 2.4.0

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,
{
"error": {
    "code": "SYS.1001",
    "description": "A message or a operation timeout",
    "details": "Create VM on KVM timeout after 300s"
}
}

SDK Sample

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 Request

URLs
GET /v1/iam2/attributes/system
Headers
Authorization: OAuth the-session-uuid
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/iam2/attributes/system
Request Parameters
Name Type Location Description Optional Value Starting Version
systemTags List query Optional. The system tags. 2.4.0
userTags List query Optional. The user tags. 2.4.0

API Response

Sample Response
{
  "inventories": [
    {
      "uuid": "f6fb2ce8587d4455b51164b3970b2568",
      "name": "__ProjectAdmin__",
      "type": "System"
    }
  ]
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 2.4.0
inventories List See inventories. 2.4.0
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 2.4.0
description String The brief description of the error. 2.4.0
details String The details about the error. 2.4.0
elaboration String The reserved field. Default value: null. 2.4.0
opaque LinkedHashMap The reserved field. Default value: null. 2.4.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 2.4.0
#inventories
Name Type Description Starting Version
uuid String The resource UUID. 2.4.0
name String The resource name. 2.4.0
value String 2.4.0
type AttributeType See type. 2.4.0
#type
Name Type Description Starting Version
name String The resource name. 2.4.0
ordinal int 2.4.0

SDK Sample

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 Request

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: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
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
Request Parameters
Name Type Location Description Optional Value Starting Version
uuid String url The resource UUID. 2.4.0
attributes List body (contained in the params structure) The attributes. 2.4.0
systemTags List body Optional. The system tags. 2.4.0
userTags List body Optional. The user tags. 2.4.0

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,
{
"error": {
    "code": "SYS.1001",
    "description": "A message or a operation timeout",
    "details": "Create VM on KVM timeout after 300s"
}
}

SDK Sample

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 Request

URLs
DELETE zstack/v1/iam2/projects/{uuid}/attributes?attributeUuids={attributeUuids}
Headers
Authorization: OAuth the-session-uuid
Curl Sample
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
Request Parameters
Name Type Location Description Optional Value Starting Version
uuid String url The resource UUID. 2.4.0
attributeUuids List url 2.4.0
systemTags List body Optional. The system tags. 2.4.0
userTags List body Optional. The user tags. 2.4.0

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,
{
"error": {
    "code": "SYS.1001",
    "description": "A message or a operation timeout",
    "details": "Create VM on KVM timeout after 300s"
}
}

SDK Sample

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 Request

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: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
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
Request Parameters
Name Type Location Description Optional Value Starting Version
projectUuid String url Optional. 4.0.0
name String body (contained in the params structure) The name of the member group. 2.4.0
description String body (contained in the params structure) Optional. The detailed description of the member group. 2.4.0
attributes List body (contained in the params structure) Optional. 2.4.0
resourceUuid String body (contained in the params structure) Optional. 2.4.0
systemTags List body Optional. The system tags. 2.4.0
userTags List body Optional. The user tags. 2.4.0

API Response

Sample Response
{
  "inventory": {
    "uuid": "7c1b800eb5644c35823bbed13d14b54c",
    "projectUuid": "04ef5931e13e4362b1960e03033b7d79",
    "name": "group-name",
    "state": "Enabled",
    "attributes": [
      {
        "uuid": "70200048148344c1833a5cc8d6227f0b",
        "name": "attribute-name",
        "value": "attribute-value",
        "type": "Customized"
      }
    ]
  }
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 2.4.0
inventory IAM2VirtualIDGroupInventory See inventory. 2.4.0
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 2.4.0
description String The brief description of the error. 2.4.0
details String The details about the error. 2.4.0
elaboration String The reserved field. Default value: null. 2.4.0
opaque LinkedHashMap The reserved field. Default value: null. 2.4.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 2.4.0
#inventory
Name Type Description Starting Version
uuid String The resource UUID. 2.4.0
projectUuid String 2.4.0
name String The resource name. 2.4.0
description String The detailed description of the resource. 2.4.0
createDate Timestamp The creation date. 2.4.0
lastOpDate Timestamp The last operation date. 2.4.0
state State See state. 2.4.0
attributes List See attributes. 2.4.0
#state
Name Type Description Starting Version
name String The resource name. 2.4.0
ordinal int 2.4.0
#attributes
Name Type Description Starting Version
uuid String The resource UUID. 2.4.0
name String The resource name. 2.4.0
value String 2.4.0
type AttributeType See type. 2.4.0
#type
Name Type Description Starting Version
name String The resource name. 2.4.0
ordinal int 2.4.0

SDK Sample

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 Request

URLs
DELETE zstack/v1/iam2/projects/groups/{uuid}?deleteMode={deleteMode}
Headers
Authorization: OAuth the-session-uuid
Curl Sample
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
Request Parameters
Name Type Location Description Optional Value Starting Version
uuid String url The resource UUID. 2.4.0
deleteMode String url Optional. The delete mode. 2.4.0
systemTags List body Optional. The system tags. 2.4.0
userTags List body Optional. The user tags. 2.4.0

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,
{
"error": {
    "code": "SYS.1001",
    "description": "A message or a operation timeout",
    "details": "Create VM on KVM timeout after 300s"
}
}

SDK Sample

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 Request

URLs
GET zstack/v1/iam2/projects/groups
GET zstack/v1/iam2/projects/groups/{uuid}
Headers
Authorization: OAuth the-session-uuid
Curl Sample
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

Queryable Fields

You can check all queryable fields and resource names that can be queried across tables by using zstack-cli, entering QueryIAM2VirtualIDGroup, and pressing the Tab key.

API Response

Sample Response
{
  "inventories": [
    {
      "uuid": "89142c9562a74f619d9e2fe90982e559",
      "projectUuid": "bb66c8d69fbd419082b7c1f5e0e91ac9",
      "name": "group-name",
      "state": "Enabled",
      "attributes": [
        {
          "uuid": "39f0d375a4974ef3a8757de82ab1fdce",
          "name": "attribute-name",
          "value": "attribute-value",
          "type": "Customized"
        }
      ]
    }
  ]
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 2.4.0
inventories List See inventories. 2.4.0
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 2.4.0
description String The brief description of the error. 2.4.0
details String The details about the error. 2.4.0
elaboration String The reserved field. Default value: null. 2.4.0
opaque LinkedHashMap The reserved field. Default value: null. 2.4.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 2.4.0
#inventories
Name Type Description Starting Version
uuid String The resource UUID. 2.4.0
projectUuid String 2.4.0
name String The resource name. 2.4.0
description String The detailed description of the resource. 2.4.0
createDate Timestamp The creation date. 2.4.0
lastOpDate Timestamp The last operation date. 2.4.0
state State See state. 2.4.0
attributes List See attributes. 2.4.0
#state
Name Type Description Starting Version
name String The resource name. 2.4.0
ordinal int 2.4.0
#attributes
Name Type Description Starting Version
uuid String The resource UUID. 2.4.0
name String The resource name. 2.4.0
value String 2.4.0
type AttributeType See type. 2.4.0
#type
Name Type Description Starting Version
name String The resource name. 2.4.0
ordinal int 2.4.0

SDK Sample

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 Request

URLs
PUT zstack/v1/iam2/projects/groups/{uuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
  "updateIAM2VirtualIDGroup": {
    "name": "new-name"
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
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
Request Parameters
Name Type Location Description Optional Value Starting Version
uuid String url The resource UUID. 2.4.0
name String body (contained in the updateIAM2VirtualIDGroup structure) Optional. The resource name. 2.4.0
description String body (contained in the updateIAM2VirtualIDGroup structure) Optional. The detailed description of the resource. 2.4.0
systemTags List body Optional. The system tags. 2.4.0
userTags List body Optional. The user tags. 2.4.0

API Response

Sample Response
{
  "inventory": {
    "uuid": "9d44314e3c1a40759a0af2c59b4bd9b2",
    "projectUuid": "943d49ec4af74b8795d4c37b01d9e512",
    "name": "group-name",
    "state": "Enabled",
    "attributes": [
      {
        "uuid": "2e3fb2391e774e81bd55c6130c083c1d",
        "name": "attribute-name",
        "value": "attribute-value",
        "type": "Customized"
      }
    ]
  }
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 2.4.0
inventory IAM2VirtualIDGroupInventory See inventory. 2.4.0
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 2.4.0
description String The brief description of the error. 2.4.0
details String The details about the error. 2.4.0
elaboration String The reserved field. Default value: null. 2.4.0
opaque LinkedHashMap The reserved field. Default value: null. 2.4.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 2.4.0
#inventory
Name Type Description Starting Version
uuid String The resource UUID. 2.4.0
projectUuid String 2.4.0
name String The resource name. 2.4.0
description String The detailed description of the resource. 2.4.0
createDate Timestamp The creation date. 2.4.0
lastOpDate Timestamp The last operation date. 2.4.0
state State See state. 2.4.0
attributes List See attributes. 2.4.0
#state
Name Type Description Starting Version
name String The resource name. 2.4.0
ordinal int 2.4.0
#attributes
Name Type Description Starting Version
uuid String The resource UUID. 2.4.0
name String The resource name. 2.4.0
value String 2.4.0
type AttributeType See type. 2.4.0
#type
Name Type Description Starting Version
name String The resource name. 2.4.0
ordinal int 2.4.0

SDK Sample

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 Request

URLs
PUT zstack/v1/iam2/projects/groups/{uuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
  "changeIAM2VirtualIDGroupState": {
    "stateEvent": "enable"
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
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
Request Parameters
Name Type Location Description Optional Value Starting Version
uuid String url The resource UUID. 2.4.0
stateEvent StateEvent body (contained in the changeIAM2VirtualIDGroupState structure)
  • enable
  • disable
2.4.0
systemTags List body Optional. The system tags. 2.4.0
userTags List body Optional. The user tags. 2.4.0

API Response

Sample Response
{
  "inventory": {
    "uuid": "2da22aa4a4c840e2a0e5368427c7ab60",
    "projectUuid": "8aaf3ae982794c6e9f491964b2f419b2",
    "name": "group-name",
    "state": "Enabled",
    "attributes": [
      {
        "uuid": "d754761544514141ab5080ecbe9e31e5",
        "name": "attribute-name",
        "value": "attribute-value",
        "type": "Customized"
      }
    ]
  }
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 2.4.0
inventory IAM2VirtualIDGroupInventory See inventory. 2.4.0
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 2.4.0
description String The brief description of the error. 2.4.0
details String The details about the error. 2.4.0
elaboration String The reserved field. Default value: null. 2.4.0
opaque LinkedHashMap The reserved field. Default value: null. 2.4.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 2.4.0
#inventory
Name Type Description Starting Version
uuid String The resource UUID. 2.4.0
projectUuid String 2.4.0
name String The resource name. 2.4.0
description String The detailed description of the resource. 2.4.0
createDate Timestamp The creation date. 2.4.0
lastOpDate Timestamp The last operation date. 2.4.0
state State See state. 2.4.0
attributes List See attributes. 2.4.0
#state
Name Type Description Starting Version
name String The resource name. 2.4.0
ordinal int 2.4.0
#attributes
Name Type Description Starting Version
uuid String The resource UUID. 2.4.0
name String The resource name. 2.4.0
value String 2.4.0
type AttributeType See type. 2.4.0
#type
Name Type Description Starting Version
name String The resource name. 2.4.0
ordinal int 2.4.0

SDK Sample

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 Request

URLs
POST zstack/v1/iam2/projects/{projectUuid}/virtual-ids
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "virtualIDUuids": [
      "6552671ff11d301cb593ed46b6db53ed",
      "f2a0c8724833360c939db5665d83aefc"
    ]
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
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
Request Parameters
Name Type Location Description Optional Value Starting Version
projectUuid String url 2.4.0
virtualIDUuids List body (contained in the params structure) 2.4.0
systemTags List body Optional. The system tags. 2.4.0
userTags List body Optional. The user tags. 2.4.0
roleUuids List body (contained in the params structure) Optional. 2.4.0

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,
{
"error": {
    "code": "SYS.1001",
    "description": "A message or a operation timeout",
    "details": "Create VM on KVM timeout after 300s"
}
}

SDK Sample

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 Request

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: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
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
Request Parameters
Name Type Location Description Valid Value Starting Version
projectUuids List body (contained in the params structure) The UUID of the projects. 4.0.0
virtualIDUuids List body (contained in the params structure) The user UUIDs. 4.0.0
roleUuids List body (contained in the params structure) Optional. The role UUIDs. 4.0.0
systemTags List body Optional. The system tags. 4.0.0
userTags List body Optional. The user tags. 4.0.0

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,
{
	"error": {
		"code": "SYS.1001",
		"description": "A message or a operation timeout",
		"details": "Create VM on KVM timeout after 300s"
	}
}

SDK Sample

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 Request

URLs
DELECT zstack/v1/iam2/projects/virtual-ids
Headers
Authorization: OAuth the-session-uuid
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/iam2/projects/virtual-ids
Request Parameters
Name Type Location Description Valid Value Starting Version
projectUuids List body (contained in the params structure) The UUID of the projects. 4.0.0
virtualIDUuids List body (contained in the params structure) The member UUIDs. 4.0.0
systemTags List body (contained in the params structure) Optional. The system tags. 4.0.0
userTags List body (contained in the params structure) Optional. The user tags. 4.0.0

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,
{
	"error": {
		"code": "SYS.1001",
		"description": "A message or a operation timeout",
		"details": "Create VM on KVM timeout after 300s"
	}
}

SDK Sample

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 Request

URLs
POST zstack/v1/iam2/projects/groups
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "structs": []
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
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
Request Parameters
Name Type Location Description Valid Value Starting Version
projectUuids List body (contained in the params structure) The UUID of the projects. 4.0.0
groupUuids List body (contained in the params structure) The group UUIDs. 4.0.0
roleUuids List body (contained in the params structure) Optional. The role UUIDs. 4.0.0
systemTags List body Optional. The system tags. 4.0.0
userTags List body Optional. The user tags. 4.0.0

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,
{
	"error": {
		"code": "SYS.1001",
		"description": "A message or a operation timeout",
		"details": "Create VM on KVM timeout after 300s"
	}
}

SDK Sample

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 Request

URLs
DELETE zstack/v1/iam2/projects/groups
Headers
Authorization: OAuth the-session-uuid
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/iam2/projects/groups
Request Parameters
Name Type Location Description Valid Value Starting Version
projectUuids List body (contained in the params structure) Optional. The UUID of the projects. 4.0.0
groupUuids List body (contained in the params structure) Optional. The group UUIDs. 4.0.0
systemTags List body (contained in the params structure) Optional. The system tags. 4.0.0
userTags List body (contained in the params structure) Optional. The user tags. 4.0.0

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,
{
	"error": {
		"code": "SYS.1001",
		"description": "A message or a operation timeout",
		"details": "Create VM on KVM timeout after 300s"
	}
}

SDK Sample

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 Request

URLs
POST zstack/v1/iam2/projects/add/resource/
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "projectUuid": "4b596d98fa90346cb7ac102ed2ba354a",
    "resourceTemplates": [
      "{}",
      "{}"
    ]
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
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/
Request Parameters
Name Type Location Description Valid Value Starting Version
projectUuid String body (contained in the params structure) The project UUID. 4.4.0
resourceTemplates List body (contained in the params structure) The resource template. 4.4.0
systemTags List body Optional. The system tags. 4.4.0
userTags List body Optional. The user tags. 4.4.0

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,
{
	"error": {
		"code": "SYS.1001",
		"description": "A message or a operation timeout",
		"details": "Create VM on KVM timeout after 300s"
	}
}

SDK Sample

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 Request

URLs
POST zstack/v1/iam2/projects/groups/{groupUuid}/virtual-ids
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "virtualIDUuids": [
      "28e44658cba33e57b96da2c430cbbefe",
      "f9450427d6b03c2cb992c80a3a64efaa"
    ]
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
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
Request Parameters
Name Type Location Description Optional Value Starting Version
virtualIDUuids List body (contained in the params structure) 2.4.0
groupUuid String url 2.4.0
systemTags List body Optional. The system tags. 2.4.0
userTags List body Optional. The user tags. 2.4.0

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,
{
"error": {
    "code": "SYS.1001",
    "description": "A message or a operation timeout",
    "details": "Create VM on KVM timeout after 300s"
}
}

SDK Sample

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 Request

URLs
DELETE zstack/v1/iam2/projects/groups/{groupUuid}/virtual-ids?virtualIDUuids={virtualIDUuids}
Headers
Authorization: OAuth the-session-uuid
Curl Sample
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
Request Parameters
Name Type Location Description Optional Value Starting Version
virtualIDUuids List url 2.4.0
groupUuid String url 2.4.0
systemTags List body Optional. The system tags. 2.4.0
userTags List body Optional. The user tags. 2.4.0

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,
{
"error": {
    "code": "SYS.1001",
    "description": "A message or a operation timeout",
    "details": "Create VM on KVM timeout after 300s"
}
}

SDK Sample

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 Request

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: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
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
Request Parameters
Name Type Location Description Optional Value Starting Version
uuid String url The resource UUID. 2.4.0
name String body (contained in the updateIAM2VirtualID structure) Optional. The resource name. 2.4.0
description String body (contained in the updateIAM2VirtualID structure) Optional. The detailed description of the resource. 2.4.0
password String body (contained in the updateIAM2VirtualID structure) Optional. The password. 2.4.0
systemTags List body Optional. The system tags. 2.4.0
userTags List body Optional. The user tags. 2.4.0

API Response

Sample Response
{
  "inventory": {
    "uuid": "4906f550acb843b7ae64c32fbf7251c3",
    "name": "id1",
    "state": "Enabled",
    "attributes": [
      {
        "uuid": "b0926ede396547f9b1f6199c05ffe4d4",
        "name": "attribute-name",
        "value": "attribute-value",
        "type": "Customized"
      }
    ]
  }
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 2.4.0
inventory IAM2VirtualIDInventory See inventory. 2.4.0
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 2.4.0
description String The brief description of the error. 2.4.0
details String The details about the error. 2.4.0
elaboration String The reserved field. Default value: null. 2.4.0
opaque LinkedHashMap The reserved field. Default value: null. 2.4.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 2.4.0
#inventory
Name Type Description Starting Version
uuid String The resource UUID. 2.4.0
name String The resource name. 2.4.0
description String The detailed description of the resource. 2.4.0
createDate Timestamp The creation date. 2.4.0
lastOpDate Timestamp The last operation date. 2.4.0
state State See state. 2.4.0
attributes List See attributes. 2.4.0
#state
Name Type Description Starting Version
name String The resource name. 2.4.0
ordinal int 2.4.0
#attributes
Name Type Description Starting Version
uuid String The resource UUID. 2.4.0
name String The resource name. 2.4.0
value String 2.4.0
type AttributeType See type. 2.4.0
#type
Name Type Description Starting Version
name String The resource name. 2.4.0
ordinal int 2.4.0

SDK Sample

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 Request

URLs
POST zstack/v1/iam2/projects/virtual-ids/{virtualIDUuid}/roles
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "roleUuids": [
      "d1140b7d8ca03f7ba15ce467a9befec6",
      "8245aba180633254a5dfd76cbdd6f773"
    ]
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
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
Request Parameters
Name Type Location Description Optional Value Starting Version
virtualIDUuid String url 2.4.0
roleUuids List body (contained in the params structure) 2.4.0
systemTags List body Optional. The system tags. 2.4.0
userTags List body Optional. The user tags. 2.4.0

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,
{
"error": {
    "code": "SYS.1001",
    "description": "A message or a operation timeout",
    "details": "Create VM on KVM timeout after 300s"
}
}

SDK Sample

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 Request

URLs
DELETE zstack/v1/iam2/projects/virtual-ids/{virtualIDUuid}/roles?roleUuids={roleUuids}
Headers
Authorization: OAuth the-session-uuid
Curl Sample
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
Request Parameters
Name Type Location Description Optional Value Starting Version
roleUuids List url 2.4.0
virtualIDUuid String url 2.4.0
systemTags List body Optional. The system tags. 2.4.0
userTags List body Optional. The user tags. 2.4.0

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,
{
"error": {
    "code": "SYS.1001",
    "description": "A message or a operation timeout",
    "details": "Create VM on KVM timeout after 300s"
}
}

SDK Sample

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 Request

URLs
POST zstack/v1/iam2/projects/groups/{groupUuid}/roles
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "roleUuids": [
      "15258e508f6e39cabb2b68e5e8b1dc57",
      "e01f1cc2abc934fc88491a3b2bd4d77f"
    ]
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
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
Request Parameters
Name Type Location Description Optional Value Starting Version
roleUuids List body (contained in the params structure) 2.4.0
groupUuid String url 2.4.0
systemTags List body Optional. The system tags. 2.4.0
userTags List body Optional. The user tags. 2.4.0

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,
{
"error": {
    "code": "SYS.1001",
    "description": "A message or a operation timeout",
    "details": "Create VM on KVM timeout after 300s"
}
}

SDK Sample

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 Request

URLs
DELETE zstack/v1/iam2/projects/groups/{groupUuid}/roles?roleUuids={roleUuids}
Headers
Authorization: OAuth the-session-uuid
Curl Sample
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
Request Parameters
Name Type Location Description Optional Value Starting Version
roleUuids List url 2.4.0
groupUuid String url 2.4.0
systemTags List body Optional. The system tags. 2.4.0
userTags List body Optional. The user tags. 2.4.0

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,
{
"error": {
    "code": "SYS.1001",
    "description": "A message or a operation timeout",
    "details": "Create VM on KVM timeout after 300s"
}
}

SDK Sample

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 Request

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: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
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
Request Parameters
Name Type Location Description Optional Value Starting Version
uuid String url The resource UUID. 2.4.0
attributes List body (contained in the params structure) The attributes. 2.4.0
systemTags List body Optional. The system tags. 2.4.0
userTags List body Optional. The user tags. 2.4.0

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,
{
"error": {
    "code": "SYS.1001",
    "description": "A message or a operation timeout",
    "details": "Create VM on KVM timeout after 300s"
}
}

SDK Sample

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 Request

URLs
DELETE zstack/v1/iam2/projects/groups/{uuid}/attributes?attributeUuids={attributeUuids}
Headers
Authorization: OAuth the-session-uuid
Curl Sample
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
Request Parameters
Name Type Location Description Optional Value Starting Version
uuid String url The resource UUID. 2.4.0
attributeUuids List url 2.4.0
systemTags List body Optional. The system tags. 2.4.0
userTags List body Optional. The user tags. 2.4.0

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,
{
"error": {
    "code": "SYS.1001",
    "description": "A message or a operation timeout",
    "details": "Create VM on KVM timeout after 300s"
}
}

SDK Sample

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 Request

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: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
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
Request Parameters
Name Type Location Description Optional Value Starting Version
name String body (contained in the params structure) The resource name. 0.6
description String body (contained in the params structure) Optional. The detailed description of the resource. 0.6
statements List body (contained in the params structure) Optional. 0.6
policyUuids List body (contained in the params structure) Optional. 0.6
resourceUuid String body (contained in the params structure) Optional. 0.6
systemTags List body Optional. 0.6
userTags List body Optional. 0.6

API Response

Sample Response
{
  "inventory": {
    "uuid": "7e9df59e6d453b2187a0da3ee94f63c9",
    "name": "role-1",
    "description": "role for test",
    "type": "Customized",
    "state": "Enabled",
    "statements": [
      "statement for test"
    ]
  }
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 0.6
inventory RoleInventory See inventory. 0.6
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 0.6
description String The brief description of the error. 0.6
details String The details about the error. 0.6
elaboration String The reserved field. Default value: null. 0.6
opaque LinkedHashMap The reserved field. Default value: null. 0.6
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 0.6
#inventory
Name Type Description Starting Version
uuid String The resource UUID. 0.6
name String The resource name. 0.6
description String The detailed description of the resource. 0.6
createDate Timestamp The creation date. 0.6
lastOpDate Timestamp The last operation date. 0.6
type RoleType See type. 0.6
state RoleState See state. 0.6
statements List See statements. 0.6
#type
Name Type Description Starting Version
name String The resource name. 0.6
ordinal int 0.6
#state
Name Type Description Starting Version
name String The resource name. 0.6
ordinal int 0.6
#statements
Name Type Description Starting Version
uuid String The resource UUID. 0.6
createDate Timestamp The creation date. 0.6
lastOpDate Timestamp The last operation date. 0.6
statement PolicyStatement See statement. 0.6
#statement
Name Type Description Starting Version
name String The resource name. 0.6
principals List 0.6
actions List 0.6
resources List 0.6
effect StatementEffect See effect. 0.6
#effect
Name Type Description Starting Version
name String The resource name. 0.6
ordinal int 0.6

SDK Sample

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 Request

URLs
DELETE zstack/v1/identities/roles/{uuid}?deleteMode={deleteMode}
Headers
Authorization: OAuth the-session-uuid
Curl Sample
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
Request Parameters
Name Type Location Description Optional Value Starting Version
uuid String url The resource UUID. 0.6
deleteMode String url Optional. The delete mode. 0.6
systemTags List body Optional. The system tags. 0.6
userTags List body Optional. The user tags. 0.6

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,
{
	"error": {
		"code": "SYS.1001",
		"description": "A message or a operation timeout",
		"details": "Create VM on KVM timeout after 300s"
	}
}

SDK Sample

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 Request

URLs
GET zstack/v1/identities/roles
GET zstack/v1/identities/roles/{uuid}
Headers
Authorization: OAuth the-session-uuid
Curl Sample
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

Queryable Fields

You can check all queryable fields and resource names that can be queried across tables by using zstack-cli, entering QueryRole, and pressing the Tab key.

API Response

Sample Response
{
  "inventories": [
    {
      "uuid": "bc0df9075c8f30cc9150ea9d2030b470",
      "name": "role-1",
      "description": "role for test",
      "type": "Customized",
      "state": "Enabled",
      "statements": [
        "statement for test"
      ]
    }
  ]
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 0.6
inventories List See inventories. 0.6
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 0.6
description String The brief description of the error. 0.6
details String The details about the error. 0.6
elaboration String The reserved field. Default value: null. 0.6
opaque LinkedHashMap The reserved field. Default value: null. 0.6
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 0.6
#inventories
Name Type Description Starting Version
uuid String The resource UUID. 0.6
name String The resource name. 0.6
description String The detailed description of the resource. 0.6
createDate Timestamp The creation date. 0.6
lastOpDate Timestamp The last operation date. 0.6
type RoleType See type. 0.6
state RoleState See state. 0.6
statements List See statements. 0.6
#type
Name Type Description Starting Version
name String The resource name. 0.6
ordinal int 0.6
#state
Name Type Description Starting Version
name String The resource name. 0.6
ordinal int 0.6
#statements
Name Type Description Starting Version
uuid String The resource UUID. 0.6
createDate Timestamp The creation date. 0.6
lastOpDate Timestamp The last operation date. 0.6
statement PolicyStatement See statement. 0.6
#statement
Name Type Description Starting Version
name String The resource name. 0.6
principals List 0.6
actions List 0.6
resources List 0.6
effect StatementEffect See effect. 0.6
#effect
Name Type Description Starting Version
name String The resource name. 0.6
ordinal int 0.6

SDK Sample

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 Request

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: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
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
Request Parameters
Name Type Location Description Optional Value Starting Version
uuid String url The resource UUID. 0.6
name String body (contained in the updateRole structure) The resource name. 0.6
description String body (contained in the updateRole structure) Optional. The detailed description of the resource. 0.6
statements List body (contained in the updateRole structure) Optional. The permission statements. 0.6
policyUuids List body (contained in the updateRole structure) Optional. The permission policy UUIDs. 0.6
systemTags List body Optional. The system tags. 0.6
userTags List body Optional. The user tags. 0.6

API Response

Sample Response
{
  "inventory": {
    "uuid": "14c577188a0c3ee8871e27087a287bc2",
    "name": "role-1",
    "description": "role for test",
    "type": "Customized",
    "state": "Enabled",
    "statements": [
      "statement for test"
    ]
  }
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 0.6
inventory RoleInventory See inventory. 0.6
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 0.6
description String The brief description of the error. 0.6
details String The details about the error. 0.6
elaboration String The reserved field. Default value: null. 0.6
opaque LinkedHashMap The reserved field. Default value: null. 0.6
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 0.6
#inventory
Name Type Description Starting Version
uuid String The resource UUID. 0.6
name String The resource name. 0.6
description String The detailed description of the resource. 0.6
createDate Timestamp The creation date. 0.6
lastOpDate Timestamp The last operation date. 0.6
type RoleType See type. 0.6
statements List See statements. 0.6
#type
Name Type Description Starting Version
name String The resource name. 0.6
ordinal int 0.6
#statements
Name Type Description Starting Version
uuid String The resource UUID. 0.6
createDate Timestamp The creation date. 0.6
lastOpDate Timestamp The last operation date. 0.6
statement PolicyStatement See statement. 0.6
#statement
Name Type Description Starting Version
name String The resource name. 0.6
principals List 0.6
actions List 0.6
resources List 0.6
effect StatementEffect See effect. 0.6
#effect
Name Type Description Starting Version
name String The resource name. 0.6
ordinal int 0.6

SDK Sample

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 Request

URLs
PUT zstack/v1/identities/roles/{uuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
  "changeRoleState": {
    "stateEvent": "enable"
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
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
Request Parameters
Name Type Location Description Optional Value Starting Version
uuid String url The resource UUID. 0.6
stateEvent RoleStateEvent body (contained in the changeRoleState structure)
  • enable
  • disable
0.6
systemTags List body Optional. The system tags. 0.6
userTags List body Optional. The user tags. 0.6

API Response

Sample Response
{
  "inventory": {
    "uuid": "69f93c9ed74235e18019dafcf3f1fb65",
    "name": "role-1",
    "description": "role for test",
    "type": "Customized",
    "state": "Enabled",
    "statements": [
      "statement for test"
    ]
  }
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 0.6
inventory RoleInventory See inventory. 0.6
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 0.6
description String The brief description of the error. 0.6
details String The details about the error. 0.6
elaboration String The reserved field. Default value: null. 0.6
opaque LinkedHashMap The reserved field. Default value: null. 0.6
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 0.6
#inventory
Name Type Description Starting Version
uuid String The resource UUID. 0.6
name String The resource name. 0.6
description String The detailed description of the resource. 0.6
createDate Timestamp The creation date. 0.6
lastOpDate Timestamp The last operation date. 0.6
type RoleType See type. 0.6
state RoleState See state. 0.6
statements List See statements. 0.6
#type
Name Type Description Starting Version
name String The resource name. 0.6
ordinal int 0.6
#state
Name Type Description Starting Version
name String The resource name. 0.6
ordinal int 0.6
#statements
Name Type Description Starting Version
uuid String The resource UUID. 0.6
createDate Timestamp The creation date. 0.6
lastOpDate Timestamp The last operation date. 0.6
statement PolicyStatement See statement. 0.6
#statement
Name Type Description Starting Version
name String The resource name. 0.6
principals List 0.6
actions List 0.6
resources List 0.6
effect StatementEffect See effect. 0.6
#effect
Name Type Description Starting Version
name String The resource name. 0.6
ordinal int 0.6

SDK Sample

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 Request

URLs
POST zstack/v1/identities/policies/{policyUuid}/roles/{roleUuid}
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {},
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
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
Request Parameters
Name Type Location Description Optional Value Starting Version
roleUuid String url 0.6
policyUuid String url The permission policy UUID. 0.6
systemTags List body Optional. The system tags. 0.6
userTags List body Optional. The user tags. 0.6

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,
{
{
	"error": {
		"code": "SYS.1001",
		"description": "A message or a operation timeout",
		"details": "Create VM on KVM timeout after 300s"
	}
}

SDK Sample

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 Request

URLs
DELETE zstack/v1/identities/policies/{policyUuid}/roles/{roleUuid}
Headers
Authorization: OAuth the-session-uuid
Curl Sample
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?
Request Parameters
Name Type Location Description Optional Value Starting Version
roleUuid String url 0.6
policyUuid String url The permission policy UUID. 0.6
systemTags List body Optional. The system tags. 0.6
userTags List body Optional. The user tags. 0.6

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,
{
	"error": {
		"code": "SYS.1001",
		"description": "A message or a operation timeout",
		"details": "Create VM on KVM timeout after 300s"
	}
}

SDK Sample

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 Request

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: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
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
Request Parameters
Name Type Location Description Optional Value Starting Version
uuid String url The resource UUID. 0.6
statements List body (contained in the params structure) 0.6
systemTags List body Optional. The system tags. 0.6
userTags List body Optional. The user tags. 0.6

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,
{
	"error": {
		"code": "SYS.1001",
		"description": "A message or a operation timeout",
		"details": "Create VM on KVM timeout after 300s"
	}
}

SDK Sample

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 Request

URLs
DELETE zstack/v1/identities/roles/{uuid}/policy-statements?policyStatementUuids={policyStatementUuids}
Headers
Authorization: OAuth the-session-uuid
Curl Sample
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
Request Parameters
Name Type Location Description Optional Value Starting Version
uuid String url The resource UUID. 0.6
policyStatementUuids List url 0.6
systemTags List body Optional. The system tags. 0.6
userTags List body Optional. The user tags. 0.6

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,
{
	"error": {
		"code": "SYS.1001",
		"description": "A message or a operation timeout",
		"details": "Create VM on KVM timeout after 300s"
	}
}

SDK Sample

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 Request

URLs
POST zstack/v1/identities/accounts/{accountUuid}/roles/{roleUuid}
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {},
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
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
Request Parameters
Name Type Location Description Optional Value Starting Version
roleUuid String url 0.6
accountUuid String url The account UUID. 0.6
systemTags List body Optional. The system tags. 0.6
userTags List body Optional. The user tags. 0.6

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,
{
	"error": {
		"code": "SYS.1001",
		"description": "A message or a operation timeout",
		"details": "Create VM on KVM timeout after 300s"
	}
}

SDK Sample

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 Request

URLs
DELETE zstack/v1/identities/accounts/{accountUuid}/roles/{roleUuid}?deleteMode={deleteMode}
Headers
Authorization: OAuth the-session-uuid
Curl Sample
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
Request Parameters
Name Type Location Description Optional Value Starting Version
roleUuid String url 0.6
accountUuid String url The account UUID. 0.6
deleteMode String url Optional. The delete mode. 0.6
systemTags List body Optional. The system tags. 0.6
userTags List body Optional. The user tags. 0.6

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,
{
	"error": {
		"code": "SYS.1001",
		"description": "A message or a operation timeout",
		"details": "Create VM on KVM timeout after 300s"
	}
}

SDK Sample

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()

GetIAM2VirtualIDAPIPermission

API Request

URLs
GET zstack/v1/iam2/virtual-ids/api-permissions
Headers
Authorization: OAuth the-session-uuid
Curl Sample
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"}}
Request Parameters
Name Type Location Description Optional Value Starting Version
apisToCheck List query Optional. 2.4.0
systemTags List query Optional. 2.4.0
userTags List query Optional. 2.4.0

API Response

Sample Response
{
  "permissions": {
    "org.zstack.header.vm.APICreateVmInstanceMsg": {
      "allow": true
    }
  },
  "noPermission": false
}
Name Type Description Starting Version
noPermission boolean 2.4.0
success boolean 2.4.0
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 2.4.0
permissions Map See permissions. 2.4.0
error ErrorCode See error. 2.4.0
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 0.6
description String The brief description of the error. 0.6
details String The details about the error. 0.6
elaboration String The reserved field. Default value: null. 0.6
opaque LinkedHashMap The reserved field. Default value: null. 0.6
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 0.6
#permissions
Name Type Description Starting Version
allow boolean Whether you have the permission. 2.4.0
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 0.6
description String The brief description of the error. 0.6
details String The details about the error. 0.6
elaboration String The reserved field. Default value: null. 0.6
opaque LinkedHashMap The reserved field. Default value: null. 0.6
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 0.6

SDK Sample

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 Request

URLs
PUT zstack/v1/iam2/platform/login
Body
{
  "loginIAM2Platform": {},
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
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
Request Parameters
Name Type Location Description Valid Value Starting Version
clientInfo Map body(contained in the loginIAM2Platform structure) Optional. 4.0.0
systemTags List body Optional. The system tags. 4.0.0
userTags List body Optional. The user tags. 4.0.0

API Response

Sample Response
{
  "inventory": {
    "uuid": "243138fdb96e37d785ff4bfe01484b75",
    "noSessionEvaluation": false
  }
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 4.0.0
inventory SessionInventory See inventory. 4.0.0
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 4.0.0
description String The brief description of the error. 4.0.0
details String The details about the error. 4.0.0
elaboration String The reserved field. Default value: null. 4.0.0
opaque LinkedHashMap The reserved field. Default value: null. 4.0.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 4.0.0
#inventory
Name Type Description Starting Version
uuid String The session UUID. 4.0.0
accountUuid String The account UUID 4.0.0
userUuid String The user UUID. 4.0.0
expiredDate Timestamp 4.0.0
createDate Timestamp The time when the session was started. 4.0.0

SDK Sample

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()
API Reference | 4.8.38 | ZStack Cloud · ZCF | ZStack Resource Center