Lyve Cloud Account API version 2 Guide
Lyve Cloud Account API version 2 

¿Le pareció útil este contenido?

Deleting a Service Account by ID

Deleting a service account permanently prevents you from using the secret and access key to authenticate.

Request

The Delete operation removes the existing service account from the database.

DELETE /service-accounts/{serviceAccountId}

Parameters

Name In Type Required Description
serviceAccountId path string true Numeric ID of the service account to delete.

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}", nil)
        req.Header = headers
        client := &http.Client{}
        resp, err := client.Do(req)
        // ... }

Java

    URL obj = new URL("https://api.lyvecloud.seagate.com/v2/service-accounts/{ServiceAccountId}");
    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}', {
            method: 'DELETE',
            headers: headers
        })
        .then(function(res) {
            return res.json();
        }).then(function(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}', headers = headers) 
    print(r.json())

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}', params: {}, headers: headers 
    p JSON.parse(result)
  

Responses

Status Code Description Return JSON Payload
200 The delete operation is successful. Service account deleted successfully.
400 Bad request

The token is invalid or expired.
{
  "code": "string",
  "message": "string"
}
code message
ExpiredToken Token expired.
InvalidToken Token is not valid.
403 Forbidden

The account has no services enabled.
{
  "code": "string",
  "message": "string"
}
code message
NoServiceAvailable The account has no services enabled for it.
404 The service account to be deleted was not found.
{
  "code": "string",
  "message": "string"
}
code message
ServiceAccountNotFound A service account was not found.
409 The service account is not ready to be deleted and is still being processed by some regions.
{
  "code": "string",
  "message": "string"
}
code message
ServiceAccountNotReady The service account is still being processed by some regions.
500 The server encountered an internal error.
{
  "code": "string",
  "message": "string"
}
code message
InternalError The server encountered an internal error. Please retry the request.
503 Service Unavailable
{
  "code": "string",
  "message": "string"
}
code message
ServiceNotReady The server is not ready to handle the request. Please retry the request later.