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

Was this content helpful?

Disabling a Service Account

Disabling a service account prevents you from using the secret key to authenticate.

Request

Performing a Disable operation removes the service account from the user's account.

DELETE /service-accounts/{serviceAccountId}/enabled

Parameters

NameInTypeRequiredDescription
serviceAccountIdpathstringtrueNumeric ID of the service account to disable.

Code samples

Go

    package main

    import (
        "net/http"
    )

    func main() {
        headers := map[string][]string{
            "Accept": []string{
                "text/plain",
            },
            "Authorization": []string{
                "Bearer {access-token}",
            },
        }
        req, err := http.NewRequest("DELETE", "https://api.lyvecloud.seagate.com/v2/service-accounts/{ServiceAccountId}/enabled", nil)
        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}/enabled");
            HttpURLConnection con = (HttpURLConnection) obj.openConnection();
            con.setRequestMethod("DELETE");
            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 headers = {
        'Accept': 'text/plain',
        'Authorization': 'Bearer {access-token}'
    };

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

Python

    import requests

    headers = {
        'Accept': 'text/plain',
        'Authorization': 'Bearer {access-token}'
    }

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

    print(r.text)

Ruby

    require 'rest-client'
    require 'json'

    headers = {
        'Accept' => 'text/plain', 
        'Authorization' => 'Bearer {access-token}'
    }

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

    puts result
  

Responses

Status CodeDescriptionReturn JSON Payload
200OK

Service Account disabled successfully.
-
400It is an invalid request or invalid service account information.
{
  "code": "string",
  "message": "string"
}
codemessage
ExpiredTokenToken expired.
InvalidTokenToken is not valid.
403Forbidden

The account has no services enabled.
{
  "code": "string",
  "message": "string"
}
codemessage
NoServiceAvailableThe account has no services enabled for it.
404The service account to disable was not found or expired.
{
  "code": "string",
  "message": "string"
}
codemessage
ServiceAccountNotFoundA service account was not found.
ServiceAccountExpiredService account is expired. Could not disable the expired service.
409The service account is not ready to be disabled and is still being processed by some regions.
{
  "code": "string",
  "message": "string"
}
codemessage
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.