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

このコンテンツは役に立ちましたか?

Deleting Permission by ID

If the permission is associated with a service account, you cannot delete that permission. Also, once you delete permission, you cannot restore it.

Request

Performing a Delete permission operation removes existing permissions from the database.

DELETE /permissions/{permissionId}

Parameters

Name In Type Required Description
permissionId path string true Numeric ID of the permission to delete.

Code samples

Go

    package main

    import (
        "bytes"
        "net/http"
    )

    func main() {
        headers := map[string][]string{
            "Accept": []string{
                "text/plain",
            },
            "Authorization": []string{
                "Bearer {access-token}",
            },
        }

        jsonReq := "{json request body}" // replace with your JSON request body
        data := bytes.NewBuffer([]byte(jsonReq))

        req, err := http.NewRequest("DELETE", "https://api.lyvecloud.seagate.com/v2/permissions/{PermissionId}", data)
        if err != nil {
            // handle error
        }

        req.Header = headers

        client := &http.Client{}
        resp, err := client.Do(req)
        if err != nil {
            // handle error
        }

        // handle response }

Java

    try {
        URL obj = new URL("https://api.lyvecloud.seagate.com/v2/permissions/{PermissionId}");
        HttpURLConnection con = (HttpURLConnection) obj.openConnection();
        con.setRequestMethod("DELETE");

        int responseCode = con.getResponseCode();
        System.out.println("Response Code : " + responseCode);

        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());

    } catch (Exception e) { e.printStackTrace(); }

JavaScript

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

    fetch('https://api.lyvecloud.seagate.com/v2/permissions/{PermissionId}', {
        method: 'DELETE',
        headers: headers
    })
    .then(response => {
        if (!response.ok) {
            throw new Error('Network response was not ok');
        }
        return response.json();
    })
    .then(body => {
        console.log(body);
    })
    .catch(error => {
        console.error('There has been a problem with your fetch operation:', error); });

Python

    import requests

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

    try:
        r = requests.delete('https://api.lyvecloud.seagate.com/v2/permissions/{PermissionId}', headers=headers)
        r.raise_for_status()  # Raises a HTTPError if the response status is 4xx, 5xx
    except requests.exceptions.RequestException as err:
        print(f"An error occurred: {err}")
    else: 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/permissions/{PermissionId}', params: {}, headers: headers

    puts JSON.parse(result)
  

Responses

Status Code Description Returned JSON payload
200 OK

The delete operation is successful.
Permission deleted successfully.
400 Bad request
{
  "code": "string",
  "message": "string"
}
code code
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 Not Found

The permission to be deleted is not found.
{
  "code": "string",
  "message": "string"
}
code message
PermissionNotFound Permission was not found.
409 Conflict

The permission is not ready for deletion operation and is still being processed by some regions.
{
  "code": "string",
  "message": "string"
}
code message
PermissionNotReady Permission is still being processed by some regions.
500 The server has 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.