Search code examples
ibm-cloud-infrastructure

Updating S3 credentials via API


I am writing automation to update softlayer's S3 account keys. I know I can do it via UI. Is there any option to do it via api (python / java/ rest/ cli)?

I could not see anything in slcli nor can I see any rest endpoint here:

https://sldn.softlayer.com/reference/softlayerapi/


Solution

  • There is not possible to update the credentials or ACCESS KEYS of a S3 by control portal and api, you can only create and delete the credentials (ACCESS KEYS).

    The Object Storage S3 has a limit of 2 credentials by default. If you already have 2 credentials created, you must delete one of them in order to create another.

    To know the limit of your credentials for your S3, use the following rest call:

    https://[username]:[apiKey]@api.softlayer.com/rest/v3.1/SoftLayer_Network_Storage_Hub_Cleversafe_Account/[networkStorageAccountId]/getCredentialLimit
    

    Reference: https://sldn.softlayer.com/reference/services/SoftLayer_Network_Storage_Hub_Cleversafe_Account/getCredentialLimit/

    To retrieve the credentials, use the below rest call:

    https://[username]:[apiKey]@api.softlayer.com/rest/v3.1/SoftLayer_Network_Storage_Hub_Cleversafe_Account/[networkStorageAccountId]/getCredentials
    

    Reference: https://sldn.softlayer.com/reference/services/SoftLayer_Network_Storage_Hub_Cleversafe_Account/getCredentials/

    To create a credential use this rest call:

    https://[username]:[apiKey]@api.softlayer.com/rest/v3.1/SoftLayer_Network_Storage_Hub_Cleversafe_Account/[networkStorageAccountId]/credentialCreate
    

    Reference: https://sldn.softlayer.com/reference/services/SoftLayer_Network_Storage_Hub_Cleversafe_Account/credentialCreate/

    To delete a credential:

    Method: POST

    https://[username]:[apiKey]@api.softlayer.com/rest/v3.1/SoftLayer_Network_Storage_Hub_Cleversafe_Account/[networkStorageAccountId]/credentialDelete
    

    Body: Json

    {  
       "parameters":[  
          {  
            "id": 11111
          }
       ]
    }
    

    Replace the 11111 data with your credentialId.

    Reference: https://sldn.softlayer.com/reference/services/SoftLayer_Network_Storage_Hub_Cleversafe_Account/credentialDelete/