Bucket/keys: PUT

Sets or changes keys for a bucket.

Availability

Available on all IBM Storage Scale editions.

Description

The PUT bucket/keys request sets or changes keys for a bucket. For more information about the fields in the data structures that are returned, see mmafmcoskeys command.

Request URL

https://<IP address or host name of API server>:<port>/scalemgmt/v2/bucket/keys
where
bucket/keys
Specifies the target of the request.

Request headers


Accept: application/json

Parameters

The following parameters can be used in the request URL to customize the request:
Table 1. List of parameters
Parameter name Description and applicable keywords Required/optional
body Body of the request that contains the required parameters to be passed on to the IBM Storage Scale system to perform the requested operation. Required.

Request data

{
  "bucket": "Bucket name",
  "accessKey": "Access key",
  "secretKey": "Secret key"
  "filepath": "filepath"
  "region": "region"
  "server": "server"
}
For more information about the fields in the following data structures, see the links at the end of this topic.
"bucket": "Bucket name"
Name of the bucket.
"accessKey": "Access key"
Access key of the specified bucket.
"secretKey": "Secret key"
Secret key of the specified bucket.
"filepath": "Path URL"
The path where the key file is located. The key file is used to set the access key and secret key for the bucket. For example, a key file in the /root/key path displays the information in the following format:
  • akey:AccessKey
  • skey:SecretKey
Note: If you do not provide the filepath information then you must add values for the "accessKey" and "secretKey" parameters.
"region": "Region name"
The geographical region of a bucket. You must specify the region if you want to update a bucket that is hosted on a server in a non-default region.
"server": "Server name"
The cloud object storage server where the bucket is stored. The combination of a bucket name and a server name uniquely identifies the keys of the bucket across the cluster.
Note: It is not always necessary to provide the region for updating the bucket keys. However, it is mandatory to provide the server name with the bucket name and key file path while you are updating the bucket keys.

Response data

{
    "status": {
      "code":ReturnCode",
      "message":"ReturnMessage"
   },
   jobs: [
      {
         "result":"", 
           { 
             "commands":"String",
             "progress":"String,
             "exitCode":"Exit code",
             "stderr":"Error",
             "stdout":"String",
           },
         "request":" ",
           {
             "type":"{GET | POST | PUT | DELETE}",
             "url":"URL",
             "data":""",
           }
         "jobId":"ID",
         "submitted":"Time",
         "completed":Time",
         "status":"Job status",
         }   
        ],
   }
For more information about the fields in the following data structures, see the links at the end of the topic.
"status":
Return status.
"message": "ReturnMessage",
The return message.
"code": ReturnCode
The return code.
"jobs":
An array of elements that describe jobs. Each element describes one job.
"result"
"commands":"String'
Array of commands that are run in this job.
"progress":"String'
Progress information for the request.
"exitCode":"Exit code"
Exit code of command. Zero is success. Nonzero denotes failure.
"stderr":"Error"
CLI messages from stderr.
"stdout":"String"
CLI messages from stdout.
"request"
"type":"{GET | POST | PUT | DELETE}"
HTTP request type.
"url":"URL"
The URL through which the job is submitted.
"data":" "
Optional.
"jobId":"ID",
The unique ID of the job.
"submitted":"Time"
The time at which the job was submitted.
"completed":Time"
The time at which the job was completed.
"status":"RUNNING | COMPLETED | FAILED"
Status of the job.

Examples

The following example shows how to set or change bucket key:

Request data:
curl -k -u admin:admin001 -X PUT --header 'content-type:application/json' --header 'accept:application/json' -d '{ \ 
   "bucket": "mybucket", \ 
   "accessKey": " ", \ 
   "secretKey": " " \ 
   "filePath": "/root/keyfile"\
   "region": "us-west-2"\
   "server": "ServerName2"
 }' 'https://198.51.100.1:443/scalemgmt/v2/bucket/keys'
The request URL with no field or filter parameter returns only the details that uniquely identify the object.
Response data:
Note: In the JSON data that is returned, the return code indicates whether the command is successful. The response code 200 indicates that the command successfully retrieved the information. Error code 400 represents an invalid request and 500 represents internal server error.
{
    "jobs" : [ {
    "jobId" : 1000000000025,
    "status" : "COMPLETED",
    "submitted" : "2020-09-28 14:50:41,911",
    "completed" : "2020-09-28 14:50:42,872",
    "runtime" : 961,
    "request" : {
      "data" : {
          "accessKey": "****",
          "bucket": "mybucket",
          "filePath": "/root/keyfile",
          "region": "us-west-2",
          "secretKey": "****",
          "server": "ServerName2"
        },
      "type" : "PUT",
      "url" : "/scalemgmt/v2/bucket/keys"
    },
    "result" : {
      "progress" : [ ],
      "commands" : [ "mmafmcoskeys 'mybucket' set  ****  **** " ],
      "stdout" : [ ],
      "stderr" : [ ],
      "exitCode" : 0
    },
    "pids" : [ ]
  } ],
  "status" : {
    "code" : 200,
    "message" : "The request finished successfully."
  }
}