VM Related InterfacesKey Provider APIs

Upload a KMS Client Certificate and Private Key

PUT/zstack/v1/key-providers/kms/{uuid}/actions

Headers

Authorization: OAuth the-session-uuid

Body

{
  "uploadKmsClientIdentity": {
    "identityType": "UPLOADED",
    "kmsClientCertPem": "-----BEGIN CERTIFICATE-----\n...\n-----END CERTIFICATE-----",
    "kmsClientKeyPem": "-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----"
  },
  "systemTags": [],
  "userTags": []
}

In the preceding example, the systemTags and userTags fields can be omitted. They are listed to indicate that the body can include these two fields.

Curl Example

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"uploadKmsClientIdentity":{"identityType":"UPLOADED","kmsClientCertPem":"-----BEGIN CERTIFICATE-----\n...\n-----END CERTIFICATE-----","kmsClientKeyPem":"-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----"}}' \
http://localhost:8080/zstack/v1/key-providers/kms/ff0a9250e11b3fe5a553d61be176d300/actions

Parameter List

Name

Type

Location

Description

Optional Value

Since

identityType

String

body (contained in uploadKmsClientIdentity structure)

Identity source type

  • UPLOADED
  • PLATFORM

5.0.0

kmsClientCertPem

String

body (contained in uploadKmsClientIdentity structure)

Client certificate

 

5.0.0

kmsClientKeyPem

String

body (contained in uploadKmsClientIdentity structure)

Client private key

 

5.0.0

uuid

String

url

Resource UUID, which uniquely identifies the resource

 

5.0.0

systemTags (optional)

List

body

System tags

 

5.0.0

userTags (optional)

List

body

User tags

 

5.0.0

API Response

Response Example

{
  "inventory": {
    "uuid": "ff0fe4c52fce34ff9ffca4d3a0fd4d00",
    "kmsUuid": "ff0a9250e11b3fe5a553d61be176d300",
    "identityType": "CSR",
    "clientCertPem": "-----BEGIN CERTIFICATE-----\\n...\\n-----END CERTIFICATE-----",
    "csrPem": "-----BEGIN CERTIFICATE REQUEST-----\\n...\\n-----END CERTIFICATE REQUEST-----",
    "certExpiredDate": "Nov 14, 2017 2:20:57 PM",
    "createDate": "Nov 14, 2017 2:20:57 PM",
    "lastOpDate": "Nov 14, 2017 2:20:57 PM"
  }
}
NameTypeDescriptionSince
successboolean 5.0.0
inventoryKmsIdentityInventoryFor details, see inventory5.0.0
errorErrorCodeFor details, see error5.0.0

inventory

NameTypeDescriptionSince
uuidStringResource UUID, which uniquely identifies the resource5.0.0
kmsUuidStringKmsUUID5.0.0
identityTypeStringIdentity type5.0.0
clientCertPemStringKMSClient certificate5.0.0
csrPemStringCSR content5.0.0
certExpiredDateTimestampClient certificate expiration time5.0.0
createDateTimestampCreation time5.0.0
lastOpDateTimestampLast modification time5.0.0

error

NameTypeDescriptionSince
codeStringError code, which is the globally unique identifier of the error, for example, SYS.1000 or HOST.10010.6
descriptionStringSummary description of the error0.6
detailsStringDetailed information about the error0.6
elaborationStringReserved field. The default value is null.0.6
opaqueLinkedHashMapReserved field. The default value is null.0.6
causeErrorCodeRoot error that caused the current error. If no root error exists, this field is null.0.6

SDK Example

Java SDK

UploadKmsClientIdentityAction action = new UploadKmsClientIdentityAction();
action.uuid = "ff0a9250e11b3fe5a553d61be176d300";
action.identityType = "UPLOADED";
action.kmsClientCertPem = "-----BEGIN CERTIFICATE-----
...
-----END CERTIFICATE-----";
action.kmsClientKeyPem = "-----BEGIN PRIVATE KEY-----
...
-----END PRIVATE KEY-----";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UploadKmsClientIdentityAction.Result res = action.call();

Python SDK

action = UploadKmsClientIdentityAction()
action.uuid = "ff0a9250e11b3fe5a553d61be176d300"
action.identityType = "UPLOADED"
action.kmsClientCertPem = "-----BEGIN CERTIFICATE-----
...
-----END CERTIFICATE-----"
action.kmsClientKeyPem = "-----BEGIN PRIVATE KEY-----
...
-----END PRIVATE KEY-----"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()