Lyve Cloud Account API version 2

Overview

The Lyve Cloud Account API provides programmatic access to Lyve Cloud to perform administrative tasks. You can use the APIs to manage permissions, service accounts, and usage. These APIs are accessed after successful authentication by calling an endpoint that uses secret credentials. Every active Lyve Cloud account administrator can generate one set of account API credentials.

The Account API expects each admin user to generate unique credentials using the Lyve Cloud console to authenticate. For more information on generating the API credentials, see Using Account API.

Protocol basics

Data structure

The API uses JSON structures, which may include the following data types:

  • Boolean – True or false

  • Number – Numeric value, For example, 1234

  • String – Characters enclosed in quotes, For example, "Lyve Cloud"

API endpoint

An endpoint is the URL of the entry point for a Lyve Cloud web service.

https://api.lyvecloud.seagate.com/v2

CRUD operations

The following methods can be used to Create, Read, Update and Delete Lyve Cloud entities:

Operation

Syntax

Body Structure

Response Structure

Create an entity

POST /uri

Required

The created entity

Read an entity

GET /uri/<id>

-

The requested entity

Read all entities

GET /uri

-

List of entities

Update an entity

PUT /uri/<id>

Required

The updated entity

Delete an entity

DELETE /uri/<id>

-

The deleted entity

Response to request

Successful request

The successful status message is 200 (OK); for some API request calls, a successful response contains the JSON format. The details of the JSON format are explained in the respective API request.

Failed request

When an error occurs, the header information contains the following:

  • Content-Type: application/JSON

  • An appropriate 4xx or 5xx HTTP status code

The following sample error response shows the structure of response elements common to all REST error responses.

{
  "code": "string",
  "message": "string"
}

The following table explains the REST error response elements.

Name

Description

Code

A string that identifies the error. It is meant to be read and understood by programs that detect and handle errors by type.

Message

A description of the error condition. Programs may display the message directly to the end user if they meet an error condition. An error message in the body aids in resolving the issue.

List of API error codes

During an error, you will receive a JSON object in the response body containing the information about the error. Error responses also include an error message in the body to assist in resolving the problem.

Table 1. API error codes

Code

HTTP Status Code

Message

ExpiredToken

Bad Request(400)

Token expired.

InvalidToken

Bad Request(400)

Token is not valid.

InvalidTimeRange

Bad Request (400)

Invalid time range.

InvalidArgument

Bad Request (400)

This error might occur for the following reasons:

  • One or more of the specified arguments was not valid.

  • The request was missing an argument.

InvalidBucketName

Bad Request (400)

A bucket that keeps audit logs must be set with Object Immutability.

AuthenticationFailed

Forbidden (403)

Authentication failed.

NoServiceAvailable

Forbidden (403)

The account has no services enabled for it.

PermissionNotFound

Not Found (404)

A permission was not found.

ServiceAccountNotFound

Not Found (404)

A service account was not found.

ServiceAccountExpired

Not Found (404)

The service account has expired. Couldn’t enable the expired service.

ServiceAccountExpired

Not Found (404)

The service account has expired. Couldn’t disable the expired service.

BucketNotFound

Not Found (404)

A bucket was not found.

PermissionNotReady

Conflict (409)

The permission is still being processed by some regions.

ServiceAccountNotReady

Conflict (409)

The service account is still being processed by some regions.

PermissionNameAlreadyExists

Conflict (409)

The permission name is already in use. Please use a different name.

ServiceAccountNameAlreadyExists

Conflict (409)

The service account name is already in use. Please use a different name.

ServiceNotReady

Service Unavailable (503)

The server is not ready to handle the request. Please retry the request later.

InternalError

Internal Server Error (500)

The server encountered an internal error. Please retry the request.



Authentication

Lyve Cloud uses a token to authenticate access to the Lyve Cloud Account API. The Token is obtained by calling an endpoint that uses the Account ID, Access Key, and Secret Key. It returns a valid time-bound token, where the default expiration duration is 24 hours. When a token expires, the account API returns HTTP 400 code, after which the client application needs to obtain a new token.

Each request to an API endpoint must include the bearer header value. This value requires specifying a token in the authorization header of a request.

A token is a unique string. Tokens eliminate the need for passing user credentials with requests. Such a token is issued by the /auth/token endpoint.

A POST to /auth/token is used to exchange user credentials for an access token.

POST /auth/token

Body parameter

{ 
  "accountId": "string",
  "accessKey": "string",
  "secret": "string"
}

Parameters

Name

In

Type

Required

Description

accountId

body

string

True

The Account ID is a unique identifier of the Lyve Cloud Account. The Account ID is created during the customer onboarding and is unique across all Lyve Cloud accounts.

accessKey

body

string

True

The access key is generated when you generate Account API credentials. For more information, see Using Account API.Using Account API

secret

body

string

True

The secret key is generated when you generate Account API credentials. For more information, see Using Account API.Using Account API

Status Code

Description

Return JSON payload

200

OK

The session token is returned successfully to use in subsequent API calls.

The expiration time of the token is returned in response, ater the expiration duration the token is expired.

{ 
  "token": "string",
  "expirationSec": 864000,
}

Field

Description

token

The JWT session token to use in subsequent API calls.

expirationSec

The number of seconds remaining till the token expires.

400

Bad request

The request is invalid and has invalid information.

{
  "code": "string",
  "message": "string"
}

code

message

InvalidArgument

This error might occur for the following reasons:

  • One or more of the specified arguments was not valid.

  • The request was missing an argument.

403

Authentication failed.

{
  "code": "string",
  "message": "string"
}

code

message

Authentication failed

Authentication failed.

500

Internal Server 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.

Request
package main

import (
    "bytes"
    "net/http"
)

func main() {

    headers: = map[string][] string {
        "Content-Type": [] string {
            "application/json"
        },
        "Accept": [] string {
            "application/json"
        },
    }

        data: = bytes.NewBuffer([] byte {
        jsonReq
    })
    req,
    err: = http.NewRequest("POST", "https://api.lyvecloud.seagate.com/v2/auth/token/", data)
    req.Header = headers

    client: = & http.Client {}
    resp,
    err: = client.Do(req)
        // ...
}
Request
URL obj = new URL("https://api.lyvecloud.seagate.com/v2/auth/token/");
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());
Request
const inputBody = '{
"accountId": "string",
"accessKey": "string",
"secret": "string"
}
';
const headers = {
    'Content-Type': 'application/json',
    'Accept': 'application/json'
};

fetch('https://api.lyvecloud.seagate.com/v2/auth/token/', {
        method: 'POST',
        body: inputBody,
        headers: headers
    })
    .then(function(res) {
        return res.json();
    }).then(function(body) {
        console.log(body);
    });
Request
import requests
headers = {
    'Content-Type': 'application/json',
    'Accept': 'application/json'
}

r = requests.post('https://api.lyvecloud.seagate.com/v2/auth/token/', headers = headers)

print(r.json())
Request
require 'rest-client'
require 'json'

headers = {
    'Content-Type' => 'application/json',
    'Accept' => 'application/json'
}

result = RestClient.post 'https://api.lyvecloud.seagate.com/v2/auth/token/',
    params: {}, headers: headers

p JSON.parse(result)

Testing a session token for validity

To access the API, you must request an access token when authenticating a user. The GET /auth/token is used to validate a session and return the remaining duration for that session.

The GET API allows validating a session. It returns the remaining duration of the token.

GET /auth/token

Status Code

Description

Return JSON payload

200

OK

A session token is valid and is in effect.

{
 "expirationSec": 0
}

Field

Description

expirationSec

Number of seconds remaining until the token expires.

400

Bad request

Either the token is expired or not valid.

{
  "code": "string",
  "message": "string"
}

code

message

ExpiredToken

Token expired.

InvalidToken

Token is not valid.

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.

Request
package main

import ("bytes"
    "net/http"
) func main() {
    headers: = map[string][] string {
        "Accept": [] string {
            "application/json"
        },
        "Authorization": [] string {
            "Bearer {access-token}"
        },
    }
    data: = bytes.NewBuffer([] byte {
        jsonReq
    }) req,
    err: = http.NewRequest("GET", "https://api.lyvecloud.seagate.com/v2/auth/token/", data) req.Header = headers client: = & http.Client {}
    resp,
    err: = client.Do(req) // ...
}
Request
URL obj = new URL("https://api.lyvecloud.seagate.com/v2/auth/token/");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
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());
Request
const headers = {
    'Accept': 'application/json',
    'Authorization': 'Bearer {access-token}'
};
fetch('https://api.lyvecloud.seagate.com/v2/auth/token/', {
        method: 'GET',
        headers: headers
    })
    .then(function(res) {
        return res.json();
    }).then(function(body) {
        console.log(body);
    });
Request
import requests
headers = {
    'Accept': 'application/json',
    'Authorization': 'Bearer {access-token}'
}
r = requests.get('https://api.lyvecloud.seagate.com/v2/auth/token/', headers = headers) print(r.json())
Request
require 'rest-client'
require 'json'
headers = {
    'Accept' => 'application/json', 'Authorization' => 'Bearer {access-token}'
}
result = RestClient.get 'https://api.lyvecloud.seagate.com/v2/auth/token/', params: {}, headers: headers p JSON.parse(result)

Permissions

Permissions control access to buckets and define which actions the service accounts can perform on a bucket.

Bucket permission and Policy permission are two options available for granting permission to your buckets.

  • Bucket permission: Bucket permission is used to set Read only, Write only, or All operations permission for selected buckets. Using Bucket permissions, you can grant access permissions to your bucket and the objects in the bucket. Only the admin and storage admin can associate permissions for the buckets. The permissions attached to the bucket apply to all of the objects in the bucket. For more information, see Managing bucket access permissions.

  • Policy permission: Policy permissions are used to manage bucket-level permission by uploading a JSON file. You can also import a file compatible with the AWS IAM policy file. Using the Policy permission, you can allow or deny requests at a granular level based on the elements in the policy, resources, and aspects or conditions of the request. For more information, see Creating a policy permission.

Creating new permissions

You can create bucket permissions without any buckets in the account only if you apply permission to all buckets in the account or all buckets with a prefix.

Apply permission types using the type parameter.

  • One or more existing buckets: Choose one or more from the bucket list.

  • All buckets in this account with a prefix: The bucket names must use the same few initial characters. For example, if four unique buckets for customer01 are created, such as customer01rawdata, customer01zipdata, customer01media and customer01, enter a prefix of the bucket names to assign and apply the permission. In this case, use the same beginning characters for each bucket for our prefix, customer01.

  • All buckets in the account: Apply permission to all current and future buckets in the account.

  • Policy: Upload or import a JSON file compatible with the AWS IAM policy file. Specify the details of the permission at a granular level.

Apply actions using the action parameter.

  • All Operations: This option allows to perform all operations on all buckets meeting the conditions applied using the type parameter.

  • Read only: This option allows you to perform a read only operation on all buckets meeting the condition applied using the type parameter.

  • Write only: This option allows you to write objects without reading them back on all buckets meetings the conditions applied using the type parameter.

Using the Policy permission file

EXAMPLE OF POLICY PERMISSION FILE

In this example, the policy permission has three statements:

  • Statement 1: Allows object listing with a prefix in the bucket. It is done using a Condition element.

  • Statement 2: Allows read and write operations for objects with the prefix in the bucket.

  • Statement 3: Denies delete object operation.

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "statement1",
      "Action": [
        "s3:ListBucket"
      ],
      "Effect": "Allow",
      "Resource": [
        "arn:aws:s3:::mybucket"
      ],
      "Condition": {
        "StringLike": {
          "s3:prefix": [
            "David/*"
          ]
        }
      }
    },
    {
      "Sid": "statement2",
      "Action": [
        "s3:GetObject",
        "s3:PutObject"
      ],
      "Effect": "Allow",
      "Resource": [
        "arn:aws:s3:::mybucket/David/*"
      ]
    },
    {
      "Sid": "statement3",
      "Action": [
        "s3:DeleteObject"
      ],
      "Effect": "Deny",
      "Resource": [
        "arn:aws:s3:::mybucket/David/*",
        "arn:aws:s3:::mycorporatebucket/share/marketing/*"
      ]
    }
  ]
}

The following example illustrates creating a policy permission file using Account API.

{
"name":"permission_name",
"description":"Test data",
"type":"policy",
"policy":"{\"Version\":\"2012-10-17\",\"Statement\":[{\"Sid\":\"statement15feb1\",\"Effect\":\"Allow\",\"Action\":[\"s3:*\"],\"Resource\":[\"arn:aws:s3:::*/*\"]}]}"
}

The POST request creates controlled access to the buckets and defines actions the service account can perform on the specified buckets in the account.

POST/permissions
Body parameter
{
  "name": "string", 
  "description": "string", 
  "type": "all-buckets", 
  "actions": "all-operations", 
  "prefix": "string", 
  "buckets": [ "string" ], 
  "policy": {}
}
Parameters

Name

In

Type

Required

Description

name

body

string

true

Name of the permission.

The name allows only alphanumeric, '-', '_' or spaces. Maximum length is 128 characters.

description

body

string

true

Description of the permission.

Maximum length is 1000 characters.

type

body

string

true

The values for the permission type can be:

  • all-buckets: The permission is applied to all the existing and new buckets in the account.

    When you select the type as all-buckets , the parameters prefix, buckets, and policy are not part of the request.

  • bucket-prefix: Specify a string of characters at the beginning of the bucket's name as a prefix to apply for permission.

    When you select the type as bucket-prefix, the parameters buckets and policy are not part of the request.

  • bucket-names: The permission is applied to the specified bucket names.

    When you select the type as bucket-names, the parameters prefix and policy are not part of the request.

  • policy: Permission is applied based on the policy permission file. For more information, see Using the Policy permission file.

    When you select the type as policy, the parameters action, prefix, and buckets are not part of the request.

actions

body

string

false

The values for the actions can be:

  • all-operations: Allows you to perform all operations.

  • read-only: Allows you to perform a read only operation on one or more selected buckets and their objects.

  • write-only: Allows you to write objects into the selected buckets without reading them back.

These values are applied to the permission type.

prefix

body

string

false

Prefix of your bucket names to assign and apply the permission based on the permission type bucket-prefix.

buckets

body

[string]

false

Specify one or more bucket names based on permission type bucket-names.

policy

body

object

false

The policy file is based on permission type policy.

Status Code

Description

Return JSON Payload

200

OK

The request to create permission was successfully submitted.

Note

There might be a few seconds difference between the time the successful response is received and when the action is completed, as some regions may still process the create permission request.

{
  "id": "string"
}

400

Bad Request.

The request is invalid and has invalid permission information.

{
  "code": "string",
  "message": "string"
}

code

message

ExpiredToken

Token expired.

InvalidToken

Token is not valid.

InvalidArgument

This error might occur for the following reasons:

  • One or more of the specified arguments was not valid.

  • The request was missing an argument.

403

Forbidden

The account has no services enabled.

{
  "code": "string",
  "message": "string"
}

code

message

NoServiceAvailable

The account has no services enabled for it.

409

The permission name already exists.

{
  "code": "string",
  "message": "string"
}

code

message

PermissionNameAlreadyExists

The permission name is already in use. Please use a different name.

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.

Request
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("PUT", "https://api.lyvecloud.seagate.com/v2/permissions/", data) req.Header = headers client: = & http.Client {}
    resp,
    err: = client.Do(req) // ...
}
Request
URL obj = new URL("https://api.lyvecloud.seagate.com/v2/permissions/");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("PUT");
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());
Request
const inputBody = '{ "name": "string", "description": "string", "type": "all-buckets", "actions": "all-operations", "prefix": "string", "buckets": [ "string" ], "policy": {}
}
';
const headers = {
    'Content-Type': 'application/json',
    'Accept': 'application/json',
    'Authorization': 'Bearer {access-token}'
};
fetch('https://api.lyvecloud.seagate.com/v2/permissions/', {
        method: 'PUT',
        body: inputBody,
        headers: headers
    })
    .then(function(res) {
        return res.json();
    }).then(function(body) {
        console.log(body);
    });
Request
import requests
headers = {
    'Content-Type': 'application/json',
    'Accept': 'application/json',
    'Authorization': 'Bearer {access-token}'
}
r = requests.put('https://api.lyvecloud.seagate.com/v2/permissions/', headers = headers) print(r.json())
Request
require 'rest-client'
require 'json'
headers = {
    'Content-Type' => 'application/json', 'Accept' => 'application/json', 'Authorization' => 'Bearer {access-token}'
}
result = RestClient.put 'https://api.lyvecloud.seagate.com/v2/permissions/', params: {}, headers: headers p JSON.parse(result)

Listing permissions

All the permissions created for the account are listed.

The GET /permissions/ allows listing all the permissions of the account. Optionally, you can specify the name to get the specific permission in the account.

GET /permissions
Parameters

Name

In

Type

Required

Description

name

query

string

false

This is an optional parameter. Query the name parameter for single permission.

Status Code

Description

Return JSON payload

200

OK

Successfully returned permission list.

[
 { 
   "name": "string",
   "id": "string",
   "description": "string", 
   "type": "all-buckets",
   "readyState": true,
   "createTime": "2019-08-24T14:15:22Z"
  }
 ]

Field

Description

name

The permission name.

id

The permission id.

description

Description of the permission.

type

The values for the permission type can be:

  • all-buckets: The permission is applied to all the existing and new buckets in the account.

    When you select the type as all-buckets , the parameters prefix, buckets and policy are not part of the request.

  • bucket-prefix: Specify a string of characters at the beginning of the name of the bucket as a prefix to apply for permission.

    When you select the type as bucket-prefix, the parameters buckets and policy are not part of the request.

  • bucket-names: The permission is applied to the specified buckets names.

    When you select the type as bucket-names, the parameters prefix and policy are not part of the request.

  • policy: Permission is applied based on the policy permission file. For more information, see Managing bucket access permissionsManaging bucket access permissions

    When you select the type as policy, the parameters actions, prefix, and buckets are not part of the request.

readyState

State of permissions.True if the permission is ready across all regions.

createTime

Time of the permission creation.

400

Bad request.

Either the token is invalid or expired.

{
  "code": "string",
  "message": "string"
}

code

message

ExpiredToken

Token expired.

InvalidToken

Token is not valid.

404

Not Found

The permission is no longer available.

{
  "code": "string",
  "message": "string"
}

code

message

PermissionNotFound

Permission was not found.

403

Forbidden

The account has no services enabled.

{
  "code": "string",
  "message": "string"
}

code

message

NoServiceAvailable

The account has no services enabled for it.

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.

Request
package main
import ("bytes"
    "net/http"
) func main() {
    headers: = map[string][] string {
        "Accept": [] string {
            "application/json"
        },
        "Authorization": [] string {
            "Bearer {access-token}"
        },
    }
    data: = bytes.NewBuffer([] byte {
        jsonReq
    }) req,
    err: = http.NewRequest("GET", "https://api.lyvecloud.seagate.com/v2/permissions/", data) req.Header = headers client: = & http.Client {}
    resp,
    err: = client.Do(req) // ...
}
Request
URL obj = new URL("https://api.lyvecloud.seagate.com/v2/permissions/");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
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());
Request
const headers = {
    'Accept': 'application/json',
    'Authorization': 'Bearer {access-token}'
};
fetch('https://api.lyvecloud.seagate.com/v2/permissions/', {
        method: 'GET',
        headers: headers
    })
    .then(function(res) {
        return res.json();
    }).then(function(body) {
        console.log(body);
    });
Request
import requests
headers = {
    'Accept': 'application/json',
    'Authorization': 'Bearer {access-token}'
}
r = requests.get('https://api.lyvecloud.seagate.com/v2/permissions/', headers = headers) print(r.json())
Request
require 'rest-client'
require 'json'
headers = {
    'Accept' => 'application/json', 'Authorization' => 'Bearer {access-token}'
}
result = RestClient.get 'https://api.lyvecloud.seagate.com/v2/permissions/', params: {}, headers: headers p JSON.parse(result)

Getting permission by ID

Permission ID is a unique identifier for a permission.

Performing a GET operation on specific permission retrieves the permission.

GET /permissions/{permissionId}
Parameters

Name

In

Type

Required

Description

permissionId

path

string

true

Numeric ID of the permission.

Status Code

Description

Return JSON Payload

200

OK

Specified Permission ID is found, and the details are returned in the response.

{ 
  "id": "string",
   "name": "string",
   "description": "string",
   "type": "all-buckets",
   "readyState": true,
   "actions": "all-operations",
   "prefix": "string",
   "buckets": [ "string" ],
   "policy": {}
}

Note

If the type is policy, then the fields actions, prefix, and buckets will not display.

Field

Description

id

ID of the permission.

name

Name of the permission.

description

Description of the permission.

type

The values for the permission type can be:

  • all-operations: Allows to perform all the operations.

    When you select the type as all-operations , the parameters prefix, buckets and policy are not part of the request.

  • bucket-prefix: Specify a string of characters at the beginning of the bucket's name as a prefix to apply for permission.

    When you select the type as bucket-prefix, the parameters buckets and policy are not part of the request.

  • bucket-names: Permission is applied to the specified bucket names.

    When you select the type as bucket-names, the parameters prefix and policy are not part of the request.

  • policy: Permission is applied based on the policy permission file. For more information, see Using the Policy permission file.

    When you select the type as policy, the parameters actions, prefix, and buckets are not part of the request.

readyState

State of the permissions. True if the permission is ready across all regions.

actions

The values for the actions can be:

  • all-operations: Allows you to perform all operations.

  • read-only: Allows you to perform a read only operation on one or more selected buckets and their objects.

  • write-only: This allows you to write objects into the selected buckets without reading them back.

prefix

Specify a prefix of your bucket names to assign and apply the permission based on the permission type bucket-prefix.

buckets

Specify one or more bucket names based on permission type.

policy

The policy file based on permission type policy.

400

Either the token is not valid 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

Not Found

The permission is not available.

{
  "code": "string",
  "message": "string"
}

code

message

PermissionNotFound

The permission was not found.

500

An internal error has occurred.

{
  "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.

Request
package main
import ("bytes"
    "net/http"
) func main() {
    headers: = map[string][] string {
        "Accept": [] string {
            "application/json"
        },
        "Authorization": [] string {
            "Bearer {access-token}"
        },
    }
    data: = bytes.NewBuffer([] byte {
        jsonReq
    }) req,
    err: = http.NewRequest("GET", "https://api.lyvecloud.seagate.com/v2/permissions/{PermissionId}", data) req.Header = headers client: = & http.Client {}
    resp,
    err: = client.Do(req) // ...
}
Request
URL obj = new URL("https://api.lyvecloud.seagate.com/v2/permissions/{PermissionId}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
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());
Request
const headers = {
    'Accept': 'application/json',
    'Authorization': 'Bearer {access-token}'
};
fetch('https://api.lyvecloud.seagate.com/v2/permissions/{PermissionId}', {
        method: 'GET',
        headers: headers
    })
    .then(function(res) {
        return res.json();
    }).then(function(body) {
        console.log(body);
    });
Request
import requests
headers = {
    'Accept': 'application/json',
    'Authorization': 'Bearer {access-token}'
}
r = requests.get('https://api.lyvecloud.seagate.com/v2/permissions/{PermissionId}', headers = headers) print(r.json())
Request
require 'rest-client'
require 'json'
headers = {
    'Accept' => 'application/json', 'Authorization' => 'Bearer {access-token}'
}
result = RestClient.get 'https://api.lyvecloud.seagate.com/v2/permissions/{PermissionId}', params: {}, headers: headers p JSON.parse(result)

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.

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.

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.

Request
package main
import ("bytes"
    "net/http"
) func main() {
    headers: = map[string][] string {
        "Accept": [] string {
            "text/plain"
        },
        "Authorization": [] string {
            "Bearer {access-token}"
        },
    }
    data: = bytes.NewBuffer([] byte {
        jsonReq
    }) req,
    err: = http.NewRequest("DELETE", "https://api.lyvecloud.seagate.com/v2/permissions/{PermissionId}", data) req.Header = headers client: = & http.Client {}
    resp,
    err: = client.Do(req) // ...
}
Request
URL obj = new URL("https://api.lyvecloud.seagate.com/v2/permissions/{PermissionId}");
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());
Request
const headers = {
    'Accept': 'text/plain',
    'Authorization': 'Bearer {access-token}'
};
fetch('https://api.lyvecloud.seagate.com/v2/permissions/{PermissionId}', {
        method: 'DELETE',
        headers: headers
    })
    .then(function(res) {
        return res.json();
    }).then(function(body) {
        console.log(body);
    });
Request
import requests
headers = {
    'Accept': 'text/plain',
    'Authorization': 'Bearer {access-token}'
}
r = requests.delete('https://api.lyvecloud.seagate.com/v2/permissions/{PermissionId}', headers = headers) print(r.json())
Request
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 p JSON.parse(result)

Updating a permission

You can update all the permission parameters, bucket permission, and their associated actions.

Performing a PUT operation on specific a permission updates the permission.

PUT /permissions/{permissionId}
Body parameter
{ 
  "name": "string", 
  "description": "string", 
  "type": "bucket-names", 
  "actions": "all-operations", 
  "prefix": "string", 
  "buckets": [ "string" ], 
  "policy": {}
}
Parameters

Name

In

Type

Required

Description

permissionId

path

string

true

Numeric ID of the permission to update.

name

body

string

true

Name of the permission.

description

body

string

true

Description of the permission.

type

body

string

true

The values for the permission type can be:

  • all-buckets: The permission is applied to all the existing buckets in the account and to new buckets.

    When you select the type as all-buckets , the parameters prefix, buckets and policy are not part of the request.

  • bucket-prefix: Specify a string of characters at the beginning of the bucket's name as a prefix to apply for permission.

    When you select the type as bucket-prefix, the parameters buckets and policy are not part of the request.

  • bucket-names: Permission is applied to the specified bucket names.

    When you select the type as bucket-names, the parameters prefix and policy are not part of the request.

  • policy: Using the Policy permission, you can allow or deny requests at a granular level based on the elements in the policy, resources, and conditions of the request.

    When you select the type as policy, the parameters actions, prefix, and buckets are not part of the request.

actions

body

string

false

The values for the actions can be:

  • all-operations: Allows you to perform all the operations.

  • read-only: Allows you to perform a read only operation on one or more selected buckets and their objects.

  • write-only: Allows you to write objects into the selected buckets without reading them back.

These values are applied to the permission type. For more information, see ???.

prefix

body

string

false

Prefix of your bucket names to assign and apply the permission based on the permission type bucket-prefix.

buckets

body

string

false

Specify one or more bucket names based on permission type bucket-names.

policy

body

object

false

The policy file is based on permission type policy.

For more information, see Managing bucket access permissions.Managing bucket access permissions

Status

Description

Return JSON Payload

200

OK

The update operation is successful.

Successfully updated the permission.

400

Bad Request

It is an invalid request or invalid permission information.

{
  "code": "string",
  "message": "string"
}

code

message

ExpiredToken

Token expired.

InvalidToken

Token is not valid.

InvalidArgument

This error might occur for the following reasons:

  • One or more of the specified arguments was not valid.

  • The request was missing an argument.

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 updated is no longer available.

{
  "code": "string",
  "message": "string"
}

code

message

PermissionNotFound

Permission was not found.

409

The permission name already exists

The permission is not ready for update operation and is being processed by some regions.

{
  "code": "string",
  "message": "string"
}

code

message

PermissionNameAlreadyExists

The permission name is already in use. Please use a different name.

PermissionNotReady

Permission is still being processed by some regions.

500

Locked

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.

Request
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/permissions/{PermissionId}", data) req.Header = headers client: = & http.Client {}
    resp,
    err: = client.Do(req) // ...
}
Request
URL obj = new URL("https://api.lyvecloud.seagate.com/v2/permissions/{PermissionId}");
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());
Request
const inputBody = '{ "name": "string", "description": "string", "type": "all-buckets", "actions": "all-operations", "prefix": "string", "buckets": [ "string" ], "policy": {}
}
';
const headers = {
    'Content-Type': 'application/json',
    'Accept': 'application/json',
    'Authorization': 'Bearer {access-token}'
};
fetch('https://api.lyvecloud.seagate.com/v2/permissions/{PermissionId}', {
        method: 'POST',
        body: inputBody,
        headers: headers
    })
    .then(function(res) {
        return res.json();
    }).then(function(body) {
        console.log(body);
    });
Request
import requests
headers = {
    'Content-Type': 'application/json',
    'Accept': 'application/json',
    'Authorization': 'Bearer {access-token}'
}
r = requests.post('https://api.lyvecloud.seagate.com/v2/permissions/{PermissionId}', headers = headers) print(r.json())
Request
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/permissions/{PermissionId}', params: {}, headers: headers p JSON.parse(result)

Service Accounts

Service accounts allow applications to authenticate and access Lyve Cloud buckets and objects. When creating a service account, the access key and secret key are generated. This information must be saved at account creation, as you cannot recover key details afterwards. You must create buckets and assign permission to buckets before creating a service account. For more information, see Managing buckets and Managing bucket access permissions.Managing bucketsManaging bucket access permissions

Creating a service account

Note

You must have at least one permission before creating a service account.

The POST request creates a service account. The service account generates the credentials holding the access and secret keys.

POST /service-accounts
Body parameter
{ 
  "name": "string", 
  "description": "string", 
  "permissions": [ "string" ]
}
Parameters

Name

In

Type

Required

Description

name

body

string

true

Name of the new service account.

The name allows only alphanumeric, '-', '_' or space. Maximum length is 128 characters.

description

body

string

false

Description of the new service account.

permissions

body

[string]

true

Permission ID to apply to the service account.

Status Code

Description

Return JSON Payload

200

OK

The request to create a Service Account was successfully sent.

Note

There might be few seconds difference between the time the successful response is received, and when the action is completed, as some regions may still process the create service account request.

If you need to start using the service account immediately, we suggest you wait for a few seconds and perform a retry operation until readyState=True. For more information, see Getting service account data by ID.

{ 
  "id": "string", 
  "accessKey": "string", 
  "secret": "string"
  "expirationDate": "2022-11-15"
}

Field

Description

id

ID of the service account.

accessKey

Access key generated after creating a service account.

secret:

Secret key generated after creating a service account.

expirationDate

Date when the service account will expire.

400

Bad Request, invalid service account information

{
  "code": "string",
  "message": "string"
}

code

message

ExpiredToken

Token expired.

InvalidToken

Token is not valid.

InvalidArgument

This error might occur for the following reasons:

  • One or more of the specified arguments was not valid.

  • The request was missing an argument.

403

Forbidden

The account has no services enabled.

{
  "code": "string",
  "message": "string"
}

code

message

NoServiceAvailable

The account has no services enabled for it.

409

The service account name already exists. The service account name must be unique.

{
  "code": "string",
  "message": "string"
}

code

message

ServiceAccountNameAlreadyExists

The service account name is already in use. Please use a different name.

500

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.

Request
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("PUT", "https://api.lyvecloud.seagate.com/v2/service-accounts/", data) req.Header = headers client: = & http.Client {}
    resp,
    err: = client.Do(req) // ...
}
Request
URL obj = new URL("https://api.lyvecloud.seagate.com/v2/service-accounts/");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("PUT");
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());
Request
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/', {
        method: 'PUT',
        body: inputBody,
        headers: headers
    })
    .then(function(res) {
        return res.json();
    }).then(function(body) {
        console.log(body);
    });
Request
import requests
headers = {
    'Content-Type': 'application/json',
    'Accept': 'application/json',
    'Authorization': 'Bearer {access-token}'
}
r = requests.put('https://api.lyvecloud.seagate.com/v2/service-accounts/', headers = headers) print(r.json())
Request
require 'rest-client'
require 'json'
headers = {
    'Content-Type' => 'application/json', 'Accept' => 'application/json', 'Authorization' => 'Bearer {access-token}'
}
result = RestClient.put 'https://api.lyvecloud.seagate.com/v2/service-accounts/', params: {}, headers: headers p JSON.parse(result)

Listing service accounts

All service accounts in the account are listed or a specific service account is listed. Each service account has a unique identifier.

The GET API lists all the service accounts or a specific service account.

GET /service-accounts
Parameters

Name

In

Type

Required

Description

name

query

string

false

This is an optional parameter. Use the parameter to query for a single service account by name.

Status Code

Description

Schema

200

OK

The operation is successful.

[ 
 { 
   "name": "string", 
   "id": "string", 
   "enabled": true, 
   "readyState": true, 
   "description": "string" 
 }
]

Field

Description

name

Name of the service account.

id

ID of a service account.

enabled

State of the Service Account. It can be enabled or disabled.

readyState

True if the service account is ready across all regions.

description

Description of the service account.

400

Bad request as the token is either 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 was not found.

{
  "code": "string",
  "message": "string"
}

code

message

ServiceAccountNotFound

Service account was not found.

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.

Request
package main
import ("bytes"
    "net/http"
) func main() {
    headers: = map[string][] string {
        "Accept": [] string {
            "application/json"
        },
        "Authorization": [] string {
            "Bearer {access-token}"
        },
    }
    data: = bytes.NewBuffer([] byte {
        jsonReq
    }) req,
    err: = http.NewRequest("GET", "https://api.lyvecloud.seagate.com/v2/service-accounts/", data) req.Header = headers client: = & http.Client {}
    resp,
    err: = client.Do(req) // ...
}
Request
URL obj = new URL("https://api.lyvecloud.seagate.com/v2/service-accounts/");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
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());
Request
const headers = {
    'Accept': 'application/json',
    'Authorization': 'Bearer {access-token}'
};
fetch('https://api.lyvecloud.seagate.com/v2/service-accounts/', {
        method: 'GET',
        headers: headers
    })
    .then(function(res) {
        return res.json();
    }).then(function(body) {
        console.log(body);
    });
Request
import requests
headers = {
    'Accept': 'application/json',
    'Authorization': 'Bearer {access-token}'
}
r = requests.get('https://api.lyvecloud.seagate.com/v2/service-accounts/', headers = headers) print(r.json())
Request
require 'rest-client'
require 'json'
headers = {
    'Accept' => 'application/json', 'Authorization' => 'Bearer {access-token}'
}
result = RestClient.get 'https://api.lyvecloud.seagate.com/v2/service-accounts/', params: {}, headers: headers p JSON.parse(result)

Getting service account data by ID

You can retrieve a specific service account using the unique identifier.

The GET operation returns the service accounts as specified in the parameters.

GET /service-accounts/{serviceAccountId}
Parameters

Name

In

Type

Required

Description

serviceAccountId

path

string

true

Numeric ID of the service account.

Status Code

Description

Schema

200

OK

{ 
  "id": "string", 
  "name": "string", 
  "description": "string", 
  "enabled": true, 
  "readyState": true, 
  "permissions": [ "string" ]
}

Field

Description

id

ID of the service account.

name

Service account name.

description

Service account description.

enabled

Specifies if the service account is enabled or disabled.

readyState

State of the service account. True if the service account is ready across all regions.

permissions

Permission name associated with the service account.

400

Bad request as the token is either 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 was not found.

{
  "code": "string",
  "message": "string"
}

code

message

ServiceAccountNotFound

Service account was not found.

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.

Request
package main
import ("bytes"
    "net/http"
) func main() {
    headers: = map[string][] string {
        "Accept": [] string {
            "application/json"
        },
        "Authorization": [] string {
            "Bearer {access-token}"
        },
    }
    data: = bytes.NewBuffer([] byte {
        jsonReq
    }) req,
    err: = http.NewRequest("GET", "https://api.lyvecloud.seagate.com/v2/service-accounts/{ServiceAccountId}", data) req.Header = headers client: = & http.Client {}
    resp,
    err: = client.Do(req) // ...
}
Request
URL obj = new URL("https://api.lyvecloud.seagate.com/v2/service-accounts/{ServiceAccountId}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
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());
Request
const headers = {
    'Accept': 'application/json',
    'Authorization': 'Bearer {access-token}'
};
fetch('https://api.lyvecloud.seagate.com/v2/service-accounts/{ServiceAccountId}', {
        method: 'GET',
        headers: headers
    })
    .then(function(res) {
        return res.json();
    }).then(function(body) {
        console.log(body);
    });
Request
import requests
headers = {
    'Accept': 'application/json',
    'Authorization': 'Bearer {access-token}'
}
r = requests.get('https://api.lyvecloud.seagate.com/v2/service-accounts/{ServiceAccountId}', headers = headers) print(r.json())
Request
require 'rest-client'
require 'json'
headers = {
    'Accept' => 'application/json', 'Authorization' => 'Bearer {access-token}'
}
result = RestClient.get 'https://api.lyvecloud.seagate.com/v2/service-accounts/{ServiceAccountId}', params: {}, headers: headers p JSON.parse(result)

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.

The PUT operation updates the existing service account.

PUT /service-accounts/{serviceAccountId}
Body parameter
{ 
  "name": "string", 
  "description": "string", 
  "permissions": [ "string" ]
}
Parameters

Name

In

Type

Required

Description

serviceAccountId

path

string

true

Numeric ID of the service account.

name

body

string

true

Name of the service account.

The name allows only alphanumeric, '-', '_' or space. Maximum length is 128 characters.

description

body

string

false

Description of the service account.

permissions

body

string

true

Permissions associated with the service account.

Status Code

Description

Return JSON Payload

200

OK

The update operation is successful.

Successfully updated the service account.

400

It is an invalid request or invalid service account information.

{
  "code": "string",
  "message": "string"
}

code

message

ExpiredToken

Token expired.

InvalidToken

Token is not valid.

InvalidArgument

This error might occur for the following reasons:

  • One or more of the specified arguments was not valid.

  • The request was missing an argument.

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 update was not found.

{
  "code": "string",
  "message": "string"
}

code

message

ServiceAccountNotFound

A service account was not found.

409

The 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"
}

code

message

ServiceAccountNameAlreadyExists

The service account name is already in use. Please use a different name.

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.

Request
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) // ...
}
Request
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());
Request
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(function(res) {
        return res.json();
    }).then(function(body) {
        console.log(body);
    });
Request
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())
Request
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 p JSON.parse(result)

Enabling a service account

You can enable a specific service account and use the secret credentials associated with the account.

The PUT operation enables the existing service account.

PUT /service-accounts/{serviceAccountId}/enabled
Parameters

Name

In

Type

Required

Description

serviceAccountId

path

string

true

Numeric ID of the service account.

Status Code

Description

Return JSON Payload

200

Service Account enabled successfully.

-

400

It is an invalid request or invalid service account information.

{
  "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 enable was not found or expired.

{
  "code": "string",
  "message": "string"
}

code

message

ServiceAccountNotFound

Service account was not found.

ServiceAccountExpired

Service account is expired. Could not enable the expired service.

409

The service account is not ready to be enabled 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.

Request
package main
import ("bytes"
    "net/http"
) func main() {
    headers: = map[string][] string {
        "Accept": [] string {
            "text/plain"
        },
        "Authorization": [] string {
            "Bearer {access-token}"
        },
    }
    data: = bytes.NewBuffer([] byte {
        jsonReq
    }) req,
    err: = http.NewRequest("PUT", "https://api.lyvecloud.seagate.com/v2/service-accounts/{ServiceAccountId}/enabled", data) req.Header = headers client: = & http.Client {}
    resp,
    err: = client.Do(req) // ...
}
Request
URL obj = new URL("https://api.lyvecloud.seagate.com/v2/service-accounts/{ServiceAccountId}/enabled");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("PUT");
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());
Request
const headers = {
    'Accept': 'text/plain',
    'Authorization': 'Bearer {access-token}'
};
fetch('https://api.lyvecloud.seagate.com/v2/service-accounts/{ServiceAccountId}/enabled', {
        method: 'PUT',
        headers: headers
    })
    .then(function(res) {
        return res.json();
    }).then(function(body) {
        console.log(body);
    });
Request
import requests
headers = {
    'Accept': 'text/plain',
    'Authorization': 'Bearer {access-token}'
}
r = requests.put('https://api.lyvecloud.seagate.com/v2/service-accounts/{ServiceAccountId}/enabled', headers = headers) print(r.json())
Request
require 'rest-client'
require 'json'
headers = {
    'Accept' => 'text/plain', 'Authorization' => 'Bearer {access-token}'
}
result = RestClient.put 'https://api.lyvecloud.seagate.com/v2/service-accounts/{ServiceAccountId}/enabled', params: {}, headers: headers p JSON.parse(result)

Disabling a service account

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

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

DELETE /service-accounts/{serviceAccountId}/enabled
Parameters

Name

In

Type

Required

Description

serviceAccountId

path

string

true

Numeric ID of the service account to disable.

Status Code

Description

Return JSON Payload

200

OK

Service Account disabled successfully.

-

400

It is an invalid request or invalid service account information.

{
  "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 disable was not found or expired.

{
  "code": "string",
  "message": "string"
}

code

message

ServiceAccountNotFound

A service account was not found.

ServiceAccountExpired

Service account is expired. Could not disable the expired service.

409

The service account is not ready to be disabled 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.

Request
package main
import ("bytes"
    "net/http"
) func main() {
    headers: = map[string][] string {
        "Accept": [] string {
            "text/plain"
        },
        "Authorization": [] string {
            "Bearer {access-token}"
        },
    }
    data: = bytes.NewBuffer([] byte {
        jsonReq
    }) req,
    err: = http.NewRequest("DELETE", "https://api.lyvecloud.seagate.com/v2/service-accounts/{ServiceAccountId}/enabled", data) req.Header = headers client: = & http.Client {}
    resp,
    err: = client.Do(req) // ...
}
Request
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());
Request
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(function(res) {
        return res.json();
    }).then(function(body) {
        console.log(body);
    });
Request
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.json())
Request
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 p JSON.parse(result)

Deleting service account by ID

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

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.

Status Code

Description

Return JSON Payload

200

The delete operation is successful.

Service account deleted successfully.

400

Bad request as either 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.

Request
package main
import ("bytes"
    "net/http"
) func main() {
    headers: = map[string][] string {
        "Accept": [] string {
            "text/plain"
        },
        "Authorization": [] string {
            "Bearer {access-token}"
        },
    }
    data: = bytes.NewBuffer([] byte {
        jsonReq
    }) req,
    err: = http.NewRequest("DELETE", "https://api.lyvecloud.seagate.com/v2/service-accounts/{ServiceAccountId}", data) req.Header = headers client: = & http.Client {}
    resp,
    err: = client.Do(req) // ...
}
Request
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());
Request
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);
    });
Request
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())
Request
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)

Usage

This API is used to get historical storage usage of the account for the current month or specified time range.

Getting historical storage usage by month

The monthly average usage is calculated by averaging the daily average usage of all the days in that month. The monthly average usage is used to calculate the monthly cost at the end of the month.

Note

  • Based on the time range, it returns zero (0) if the data is unavailable.

  • The data is displayed for a maximum interval of six months.

The GET operation provides the account's monthly usage for a specified duration.

GET /usage/monthly
Parameters

Name

In

Type

Required

Description

fromMonth

query

Integer

true

Specifies the start month, inclusive, from which to retrieve usage data.

Where, zero corresponds to January and 11 corresponds to December.

fromYear

query

Integer

true

Specifies the start year, inclusive, from which to retrieve usage data.

toMonth

query

Integer

true

Specifies the end month, inclusive, from which to retrieve usage data.

Where, zero corresponds to January and 11 corresponds to December.

toYear

query

Integer

true

Specifies the end year, inclusive, from which to retrieve usage data.

Status Code

Description

Returned JSON Payload

200

OK

Successfully returns the data usage. Each item in return corresponds to one month.

If the account is a master account, the response includes usageByBucket returning data usage for every bucket in the master account, and it also includes usageBySubAccount, returning data usage for its available sub-accounts.

If the account is a sub-account, the response includes usageByBucket , returning data usage for every bucket in the sub-account. However, usageBySubAccount,  is not returned, as there are no sub-accounts associated to another sub account.

{
    "usageByBucket": [
        {
            "year": 0,
            "month": 0,
            "totalUsageGB": 0,
            "buckets": [
                {
                    "name": "string",
                    "usageGB": 0
                }
            ]
        }
    ],
    "usageBySubAccount": [
        {
            "year": 0,
            "month": 0,
            "totalUsageGB": 0,
            "subAccounts": [
                {    
                    "subAccountName": "subname1",
                    "subAccountId": "string",
                    "usageGB": 0,
                    "createTime": "2022-10-16T14:02:20.319Z"
                }
            ]
        }
    ]
}

Field

Description

year

Usage of the account for selected year.

month

Usage of the account for selected month.

name

Name of the bucket.

usageGB

Bucket consumption in GB.

totalUsageGB

Total storage consumption in GB.

buckets

Bucket consumption.

subAccounts

Details of sub-account.

subAccountName

Name of the sub-account.

subAccountId

Unique identifier of a sub-account.

400

Bad Request

{
  "code": "string",
  "message": "string"
}

code

message

TokenExpired

Token expired.

InvalidToken

Token is not valid.

InvalidTimeRange

Invalid time range.

403

Forbidden

The account has no services enabled.

{
  "code": "string",
  "message": "string"
}

code

message

NoServiceAvailable

The account has no services enabled for it.

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.

Request
package main
import ("bytes"
    "net/http"
) func main() {
    headers: = map[string][] string {
        "Accept": [] string {
            "application/json"
        },
        "Authorization": [] string {
            "Bearer {access-token}"
        },
    }
    data: = bytes.NewBuffer([] byte {
        jsonReq
    }) req,
    err: = http.NewRequest("GET", "https://api.lyvecloud.seagate.com/v2/usage/monthly/", data) req.Header = headers client: = & http.Client {}
    resp,
    err: = client.Do(req) // ...
}
Request
URL obj = new URL("https://api.lyvecloud.seagate.com/v2/usage/monthly/?from%2Dmonth=11&from%2Dyear=2020&to%2Dmonth=11&to%2Dyear=2020");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
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());
Request
const headers = {
    'Accept': 'application/json',
    'Authorization': 'Bearer {access-token}'
};
fetch('https://api.lyvecloud.seagate.com/v2/usage/monthly/?from%2Dmonth=11&from%2Dyear=2020&to%2Dmonth=11&to%2Dyear=2020', {
        method: 'GET',
        headers: headers
    })
    .then(function(res) {
        return res.json();
    }).then(function(body) {
        console.log(body);
    });
Request
import requests
headers = {
    'Accept': 'application/json',
    'Authorization': 'Bearer {access-token}'
}
r = requests.get('https://api.lyvecloud.seagate.com/v2/usage/monthly/', params = {
    'from-month': '11',
    'from-year': '2020',
    'to-month': '11',
    'to-year': '2020'
}, headers = headers) print(r.json())
Request
require 'rest-client'
require 'json'
headers = {
    'Accept' => 'application/json', 'Authorization' => 'Bearer {access-token}'
}
result = RestClient.get 'https://api.lyvecloud.seagate.com/v2/usage/monthly/', params: {
    'from-month' => '[monthNumber](#schemamonthnumber)',
    'from-year' => '[yearNumber](#schemayearnumber)',
    'to-month' => '[monthNumber](#schemamonthnumber)',
    'to-year' => '[yearNumber](#schemayearnumber)'
}, headers: headers p JSON.parse(result)

Getting current month storage usage

This API returns the current month's storage usage and lists all buckets in the account and their calculated total usage size to the current date. In addition, you get the total number of buckets currently in the account and the total calculated usage.

Note

  • Based on the time range, it returns zero (0) if the data is unavailable.

The GET operation provides usage for the current month to date.

GET /usage/current

Status Code

Description

Returned JSON payload

200

OK

Successfully return usage data.

If the account is a master account, the response includes usageByBucket, returning data usage for every bucket in the master account, and it also includes usageBySubAccount, returning data usage for its available sub-accounts.

If the account is sub-account, the response includes usageByBucket, returning data usage for every bucket in the sub-account. However, usageBySubAccountis not returned, as there are no sub-accounts associated to another sub-account

{
    "usageByBucket": {
        "numBuckets": 0,
        "totalUsageGB": 0,
        "buckets": [
            {
                "name": "string",
                "usageGB": 0
            }
        ]
    },
    "usageBySubAccount": {
        "totalUsageGB": 0,
        "subAccounts": [
            {
                "subAccountName": "subname1",
                "subAccountId": "string",
                "usageGB": 0,
                "users": 0,
                "serviceAccounts": 0,
                "buckets": 0,
                "trial": 0,
                "createTime": "2022-10-16T14:06:51.494Z"
            }
        ]
    }
}

Field

Description

numBuckets

Number of buckets.

totalUsageGB

Total storage consumption in GB.

buckets

Bucket consumption.

name

Bucket name.

usageGB

Bucket consumption in GB

totalUsageGB

Total usage of the master account, including the sub-accounts.

subAccounts

Details of sub-account.

subAccountName

Name of the sub-account.

subAccountId

Unique identifier of a sub-account.

usageGB

Usage of the account in GB.

users

Lists the total number of users for each sub-account.

serviceAccounts

Lists the number of service accounts for each sub-account.

buckets

Total number of buckets created in the Sub-account.

trial

Remaining number of days for the trial to expire. If the trial is not provisioned for the account, then the trial is -1.

createTime

Date and time when the Sub-account is created.

400

The token is not valid or is 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.

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.

Request
package main
import ("bytes"
    "net/http"
) func main() {
    headers: = map[string][] string {
        "Accept": [] string {
            "application/json"
        },
        "Authorization": [] string {
            "Bearer {access-token}"
        },
    }
    data: = bytes.NewBuffer([] byte {
        jsonReq
    }) req,
    err: = http.NewRequest("GET", "https://api.lyvecloud.seagate.com/v2/usage/current/", data) req.Header = headers client: = & http.Client {}
    resp,
    err: = client.Do(req) // ...
}
Request
URL obj = new URL("https://api.lyvecloud.seagate.com/v2/usage/current/");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
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());
Request
const headers = {
    'Accept': 'application/json',
    'Authorization': 'Bearer {access-token}'
};
fetch('https://api.lyvecloud.seagate.com/v2/usage/current/', {
        method: 'GET',
        headers: headers
    })
    .then(function(res) {
        return res.json();
    }).then(function(body) {
        console.log(body);
    });
Request
import requests
headers = {
    'Accept': 'application/json',
    'Authorization': 'Bearer {access-token}'
}
r = requests.get('https://api.lyvecloud.seagate.com/v2/usage/current/', headers = headers) print(r.json())
Request
require 'rest-client'
require 'json'
headers = {
    'Accept' => 'application/json', 'Authorization' => 'Bearer {access-token}'
}
result = RestClient.get 'https://api.lyvecloud.seagate.com/v2/usage/current/', params: {}, headers: headers p JSON.parse(result)