SAVE AS PDF
Lyve Cloud Account API version 2 Guide
Lyve Cloud Account API version 2 

Was this content helpful?

Updating a Service Account

You can update the name and permissions associated with the service account. The secret credentials are not generated when you update.

Request

The PUT operation updates the existing service account.

PUT /service-accounts/{serviceAccountId}

Body parameter

{ 
  "name": "string", 
  "description": "string", 
  "permissions": [ "string" ]
}

Parameters

NameInTypeRequiredDescription
serviceAccountIdpathstringtrueNumeric ID of the service account.
namebodystringtrueName of the service account.

The name allows only alphanumeric, '-', '_' or space. Maximum length is 128 characters.
descriptionbodystringfalseDescription of the service account.
permissionsbodystringtruePermissions associated with the service account.

Code samples

Go

    package main

    import (
        "bytes"
        "net/http"
    )

    func main() {
        headers := map[string][]string{
            "Content-Type": []string{
                "application/json",
            },
            "Accept": []string{
                "application/json",
            },
            "Authorization": []string{
                "Bearer {access-token}",
            },
        }
        data := bytes.NewBuffer([]byte{jsonReq})
        req, err := http.NewRequest("POST", "https://api.lyvecloud.seagate.com/v2/service-accounts/{ServiceAccountId}", data)
        req.Header = headers
        client := &http.Client{}
        resp, err := client.Do(req)
        // ... }

Java

    import java.net.HttpURLConnection;
    import java.net.URL;
    import java.io.BufferedReader;
    import java.io.InputStreamReader;

    public class Main {
        public static void main(String[] args) throws Exception {
            URL obj = new URL("https://api.lyvecloud.seagate.com/v2/service-accounts/{ServiceAccountId}");
            HttpURLConnection con = (HttpURLConnection) obj.openConnection();
            con.setRequestMethod("POST");
            int responseCode = con.getResponseCode();
            BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
            String inputLine;
            StringBuffer response = new StringBuffer();
            while ((inputLine = in.readLine()) != null) { response.append(inputLine); } in.close(); System.out.println(response.toString()); } }

JavaScript

    const inputBody = `{
        "name": "string",
        "description": "string",
        "permissions": ["string"]
    }`;

    const headers = {
        'Content-Type': 'application/json',
        'Accept': 'application/json',
        'Authorization': 'Bearer {access-token}'
    };

    fetch('https://api.lyvecloud.seagate.com/v2/service-accounts/{ServiceAccountId}', {
        method: 'POST', body: inputBody, headers: headers }) .then(res => res.json()) .then(body => console.log(body));

Python

    import requests

    headers = {
        'Content-Type': 'application/json',
        'Accept': 'application/json',
        'Authorization': 'Bearer {access-token}'
    }

    r = requests.post('https://api.lyvecloud.seagate.com/v2/service-accounts/{ServiceAccountId}', headers=headers) print(r.json())

Ruby

    require 'rest-client'
    require 'json'

    headers = {
        'Content-Type' => 'application/json', 
        'Accept' => 'application/json', 
        'Authorization' => 'Bearer {access-token}'
    }

    result = RestClient.post 'https://api.lyvecloud.seagate.com/v2/service-accounts/{ServiceAccountId}', params: {}, headers: headers

    puts JSON.parse(result)
  

Responses

Status CodeDescriptionReturn JSON Payload
200OK

The update operation is successful.
Successfully updated the service account.
400It is an invalid request or invalid service account information.
{
  "code": "string",
  "message": "string"
}
codemessage
ExpiredTokenToken expired.
InvalidTokenToken is not valid.
InvalidArgumentThis error might occur for the following reasons:
  • One or more of the specified arguments was not valid.
  • The request was missing an argument.
403Forbidden

The account has no services enabled.
{
  "code": "string",
  "message": "string"
}
codemessage
NoServiceAvailableThe account has no services enabled for it.
404The service account to update was not found.
{
  "code": "string",
  "message": "string"
}
codemessage
ServiceAccountNotFoundA service account was not found.
409The service account name already exists. The service account name must be unique.

or

The service account is not ready for update operation as it is locked and processed by some regions.
{
  "code": "string",
  "message": "string"
}
codemessage
ServiceAccountNameAlreadyExistsThe service account name is already in use. Please use a different name.
ServiceAccountNotReadyThe service account is still being processed by some regions.
500The server encountered an internal error.
{
  "code": "string",
  "message": "string"
}
codemessage
InternalErrorThe server encountered an internal error. Please retry the request.
503Service Unavailable
{
  "code": "string",
  "message": "string"
}
codemessage
ServiceNotReadyThe server is not ready to handle the request. Please retry the request later.