Enable or Disable AccessKey

PUT/zstack/v1/accesskeys/{uuid}/actions

Headers

Authorization: OAuth the-session-uuid

Body

{
  "changeAccessKeyState": {
    "stateEvent": "disable"
  },
  "systemTags": [],
  "userTags": []
}

The systemTags and userTags fields in the above example are optional. They are listed to indicate that the body can contain these two fields.

Curl Example

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"changeAccessKeyState":{"stateEvent":"disable"}}' \
http://localhost:8080/zstack/v1/accesskeys/2c9c06fee2513d4b81f1af281ab6bb7b/actions

Parameter List

Name

Type

Location

Description

Allowed Values

Starting Version

uuid

String

url

AccessKey UUID. Uniquely identifies the resource

 

4.0.0

stateEvent

String

body (contained in the changeAccessKeyState structure)

Enable or disable

  • enable
  • disable

4.0.0

systemTags (optional)

List

body

 

 

4.0.0

userTags (optional)

List

body

 

 

4.0.0

API Response

Response Example

{
  "inventory": {
    "uuid": "defe79b1a43f35818dc6d3959b571773",
    "accountUuid": "d0c06c8d19f439b1b8f481dbdf3e3a3c",
    "userUuid": "b622d5d01ef63237878023e93ade5003",
    "AccessKeyID": "1234567890abcdedfhij",
    "AccessKeySecret": "1234567890abcdedfhij1234567890abcdedfhij",
    "state": "Enabled"
  }
}
NameTypeDescriptionStarting Version
successboolean 4.0.0
errorErrorCodeError code. If not null, the operation failed. This field is null when the operation succeeds. See error4.0.0
inventoryAccessKeyInventorySee inventory4.0.0

error

NameTypeDescriptionStarting Version
codeStringError code number. A globally unique identifier for the error, e.g., SYS.1000, HOST.10010.6
descriptionStringBrief description of the error0.6
detailsStringDetailed error information0.6
elaborationStringReserved field. Defaults to null0.6
opaqueLinkedHashMapReserved field. Defaults to null0.6
causeErrorCodeRoot error. The source error that caused this error. Null if no root cause exists0.6

inventory

NameTypeDescriptionStarting Version
uuidStringThe UUID of the resource. Uniquely identifies the resource4.0.0
descriptionStringDetailed description of the resource4.0.0
accountUuidStringAccount UUID4.0.0
userUuidStringUser UUID4.0.0
AccessKeyIDString 4.0.0
AccessKeySecretString 4.0.0
createDateTimestampCreation time4.0.0
lastOpDateTimestampLast modification time4.0.0
stateAccessKeyStateSee state4.0.0

state

NameTypeDescriptionStarting Version
nameStringResource name4.0.0
ordinalint 4.0.0

SDK Examples

Java SDK

ChangeAccessKeyStateAction action = new ChangeAccessKeyStateAction();
action.uuid = "2c9c06fee2513d4b81f1af281ab6bb7b";
action.stateEvent = "disable";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
ChangeAccessKeyStateAction.Result res = action.call();

Python SDK

ChangeAccessKeyStateAction action = ChangeAccessKeyStateAction()
action.uuid = "2c9c06fee2513d4b81f1af281ab6bb7b"
action.stateEvent = "disable"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
ChangeAccessKeyStateAction.Result res = action.call()