Attach CCS Certificate to Account
Headers
Authorization: OAuth the-session-uuidBody
{
"params": {
"certificateUuid": "37efdf76b03a3028926549ea5f1253f3",
"state": "enable"
},
"systemTags": [],
"userTags": []
}In the preceding example, the systemTags and userTags fields 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 POST -d '{"params":{"certificateUuid":"37efdf76b03a3028926549ea5f1253f3","state":"enable"}}' \
http://localhost:8080/zstack/v1/crypto/ccs-certificate/attach-account/e0deabb1107f32e7b715d6b5e7f39334Parameter List
Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
certificateUuid (Optional) | String | body (enclosed in the | UUID of the CCS certificate |
| 4.10.0 |
accountUuid | String | url | Account UUID |
| 4.10.0 |
state (Optional) | String | body (enclosed in the | Enable or disable. Specifies whether to enable UKey authentication for login when attaching the CCS certificate to the user. If set to enable, the user must pass UKey authentication for subsequent logins. If set to disable, UKey authentication is not enabled temporarily, but can be enabled later through UpdateCCSCertificateUserState. |
| 4.10.0 |
system Tags (Optional) | List | body | System tags |
| 4.10.0 |
userTags (Optional) | List | body | User tags |
| 4.10.0 |
API Response
Response Example
{
"inventory": {
"uuid": "271c21f7ef8c4385b09846341cc9deac",
"algorithm": "SM2",
"format": "CER",
"issuerDN": "C=cn,O=infosec,OU=system,CN=ca62_sm2",
"subjectDN": "C=CN,O=ZStack,OU=ZStack,CN=ZStackTest2",
"serNumber": "13055887750776402041",
"effectiveTime": "Oct 15, 2021 10:50:09 AM",
"expirationTime": "Oct 15, 2024 10:50:09 AM"
}
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| success | boolean | Whether the attach operation is successful | 4.10.0 |
| inventory | CCSCertificateInventory | For details, see inventory | 4.10.0 |
| error | ErrorCode | Error code. If not null, the operation has failed. This field is null when the operation succeeds. For details, see error | 4.10.0 |
inventory
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | Resource UUID. Uniquely identifies the resource. | 4.3.12 |
| algorithm | String | Certificate type | 4.3.12 |
| format | String | Certificate format. CER for Chinese national cryptographic standards. Other formats include CRT, DER, JKS, etc. | 4.3.12 |
| issuerDN | String | Issuer DN (issuer-DN-distinguished name), for example, CN=sm2,O=test,C=cn | 4.3.12 |
| subjectDN | String | Subject DN | 4.3.12 |
| serNumber | Long | Certificate serial number. Combined with subjectDN as a composite key, it is globally unique. | 4.3.12 |
| effectiveTime | Timestamp | Effective date | 4.3.12 |
| expirationTime | Timestamp | Expiration date | 4.3.12 |
| createDate | Timestamp | Creation time | 4.3.12 |
| lastOpDate | Timestamp | Last modification time | 4.3.12 |
| userCertificateRefs | List | For details, see userCertificateRefs | 4.3.12 |
userCertificateRefs
| Name | Type | Description | Starting Version |
|---|---|---|---|
| userUuid | String | User UUID | 4.3.12 |
| certificateUuid | String | CCS certificate UUID | 4.3.12 |
| createDate | Timestamp | Creation time | 4.3.12 |
| lastOpDate | Timestamp | Last modification time | 4.3.12 |
| state | CCSCertificateUserState | For details, see state | 4.3.12 |
state
| Name | Type | Description | Starting Version |
|---|---|---|---|
| Enabled | CCSCertificateUserState | Verification required | 4.3.12 |
| Disabled | CCSCertificateUserState | Verification not required | 4.3.12 |
error
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | Error code number. The globally unique identifier of the error, for example, SYS.1000 or HOST.1001. | 0.6 |
| description | String | Brief description of the error | 0.6 |
| details | String | Detailed information about the error | 0.6 |
| elaboration | String | Reserved field. Default is null. | 0.6 |
| opaque | LinkedHashMap | Reserved field. Default is null. | 0.6 |
| cause | ErrorCode | Root error. The source error that caused the current error. This field is null if no root error exists. | 0.6 |
SDK Examples
Java SDK
AttachCCSCertificateToAccountAction action = new AttachCCSCertificateToAccountAction();
action.certificateUuid = "37efdf76b03a3028926549ea5f1253f3";
action.accountUuid = "e0deabb1107f32e7b715d6b5e7f39334";
action.state = "enable";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AttachCCSCertificateToAccountAction.Result res = action.call();Python SDK
AttachCCSCertificateToAccountAction action = AttachCCSCertificateToAccountAction()
action.certificateUuid = "37efdf76b03a3028926549ea5f1253f3"
action.accountUuid = "e0deabb1107f32e7b715d6b5e7f39334"
action.state = "enable"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
AttachCCSCertificateToAccountAction.Result res = action.call()