Changing the Compartment of an OCI Key
Use the post /v1/cckm/oci/keys/{id}/change-compartment API to change the OCI compartment of an OCI key.
Syntax
curl -k '<IP>/api/v1/cckm/oci/keys/{id}/change-compartment' -X POST -H 'Authorization: Bearer AUTHTOKEN' -H 'accept: application/json' --compressed
Here, {id} is the resource ID of the OCI key on the CipherTrust Manager. Note that the resource id is different from key_id on OCI. Run the get /v1/cckm/oci/keys API to view the resource ID (id) of the OCI key on the CipherTrust Manager.
Request Parameters
| Parameter | Type | Description | 
|---|---|---|
| AUTHTOKEN | string | Authentication token. | 
| compartment_id | string | The OCID of the new OCI compartment for the key. | 
Example Request
curl -k 'https://127.0.0.1/api/v1/cckm/oci/keys/90671f17-28ff-4f93-86dc-ff08983469e7/change-compartment' -X POST -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiI3ZjRlNmJkNi0wMzgzLTQ4MGMtYWZmZS0wYTQxNDgzZmVlNmUiLCJzdWIiOiJsb2NhbHxlNjM3NTVjOS01YzRhLTQ0NzUtOWI0Zi0wN2JjNzQxYjQ1MGEiLCJpc3MiOiJreWxvIiwiYWNjIjoia3lsbyIsInByZWZlcnJlZF91c2VybmFtZSI6ImFkbWluIiwiY3VzdCI6eyJkb21haW5faWQiOiIwMDAwMDAwMC0wMDAwLTAwMDAtMDAwMC0wMDAwMDAwMDAwMDAiLCJncm91cHMiOlsiYWRtaW4iXSwic2lkIjoiODJlZTQ2MzAtNjQwMi00MTQ3LTliNDYtNWE5YzU1OGVjZWU4Iiwiem9uZV9pZCI6IjAwMDAwMDAwLTAwMDAtMDAwMC0wMDAwLTAwMDAwMDAwMDAwMCJ9LCJqd3RpZCI6ImI4MThiN2MzLTk5NzItNDU0YS1iMjI0LWQ2NGQwOWVlOGRmNSIsImlhdCI6MTYzNDU0MzE0OSwiZXhwIjoxNjM0NTQzNDQ5fQ.KEXK5uaMecdIQT8QWsIqVn6szCz5VBPetDh8i2ePiLU' -H 'accept: application/json' --compressed
Example Response
{
    "id": "4eed9212-99b7-4a9f-96d9-4678f14bca30",
    "uri": "kylo:kylo:cckm:oci-key:1qed9212-99b7-4a9f-96d9-4678f14bca30",
    "account": "kylo:kylo:admin:accounts:kylo",
    "createdAt": "2022-02-02T07:31:44.707249Z",
    "updatedAt": "2022-02-04T12:36:01.185163173Z",
    "vault_id": "a155f599-46af-4380-a080-742e0b47d41c",
    "tenancy": "gemaltoprodtdev",
    "region": "us-ashburn-1",
    "key_material_origin": "EXTERNAL",
    "refreshed_at": "2022-02-02T07:31:36.04585Z",
    "oci_params": {
        "compartment_id": "ocid1.compartment.oc1..12aaaaaae3nhmy3hn2svwndxc7lyrswzqam4azefyg6obsxbrnymii6ezrva",
        "current_key_version": "ocid1.keyversion.oc1.iad.bzhizunhaagyg.asytmh4mlpqaa.abuwcljskkkhnpj3ngnoz7xztnzzbdlpdexseas4h6v7huifozw6hvrbbrna",
        "display_name": "TestOciKeyForDemo",
        "key_id": "ocid1.key.oc1.iad.bzqyzunhaagyg.ab22cljs6pdij5q3djjwixqu7hpzh4xkbkomarkdgr24qs6x2e3welnalgtq",
        "algorithm": "AES",
        "length": 32,
        "lifecycle_state": "UPDATING",
        "time_created": "2022-02-01T05:08:54.832Z",
        "vault_name": "CCKM",
        "defined_tags": {},
        "freeform_tags": {},
        "protection_mode": "SOFTWARE",
        "is_primary": true
    }
}
Response Codes
| Response Code | Description | 
|---|---|
| 2xx | Success | 
| 4xx | Client errors | 
| 5xx | Server errors | 
Refer to HTTP status codes for details.