Skip to content

Latest commit

 

History

History
330 lines (233 loc) · 14.7 KB

StoragesApi.md

File metadata and controls

330 lines (233 loc) · 14.7 KB

Onepanel.StoragesApi

All URIs are relative to https://localhost/api/v3/onepanel

Method HTTP request Description
addStorage POST /provider/storages Add storage
getStorageDetails GET /provider/storages/{id} Get storage details
getStorages GET /provider/storages Get storages
modifyStorage PATCH /provider/storages/{id} Modify storage config
removeStorage DELETE /provider/storages/{id} Remove storage

addStorage

StorageCreateResponse addStorage(storageCreateRequest)

Add storage

Adds additional storage resources to the provider. Example cURL requests Add storage ```bash curl -H "X-Auth-Token: $TOKEN" -X POST https://$OP_PANEL_HOST/api/v3/onepanel/provider/storages \ -H "Content-Type: application/json" -d '{ "My S3 Storage": { "type": "s3", "hostname": "https://iam.example.com:443\", "bucketName": "bucket1.iam.example.com" }, "My Posix Storage": { "type": "posix", "mountPoint": "/volumes/inexistent/path" } }' { "My S3 Storage": { "id": "f891d1ddf693232bbf0c11fe3cd9f7e7cheda9" }, "My Posix Storage": { "error": { "id": "storageTestFailed", "description": "Failed to write test file on storage.", "details": { "operation": "write" } } } } ```

Example

var Onepanel = require('onepanel');
var defaultClient = Onepanel.ApiClient.instance;

// Configure API key authorization: api_key1
var api_key1 = defaultClient.authentications['api_key1'];
api_key1.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//api_key1.apiKeyPrefix = 'Token';

// Configure API key authorization: api_key2
var api_key2 = defaultClient.authentications['api_key2'];
api_key2.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//api_key2.apiKeyPrefix = 'Token';

// Configure HTTP basic authorization: basic
var basic = defaultClient.authentications['basic'];
basic.username = 'YOUR USERNAME';
basic.password = 'YOUR PASSWORD';

var apiInstance = new Onepanel.StoragesApi();

var storageCreateRequest = new Onepanel.StorageCreateRequest(); // StorageCreateRequest | The configuration details of storage resources to be added to the provider deployment. Must be an object with unique names for the storages as keys and their corresponding configuration (objects) as values - see the request body example. 


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.addStorage(storageCreateRequest, callback);

Parameters

Name Type Description Notes
storageCreateRequest StorageCreateRequest The configuration details of storage resources to be added to the provider deployment. Must be an object with unique names for the storages as keys and their corresponding configuration (objects) as values - see the request body example.

Return type

StorageCreateResponse

Authorization

api_key1, api_key2, basic

HTTP request headers

  • Content-Type: application/json
  • Accept: Not defined

getStorageDetails

StorageGetDetails getStorageDetails(id)

Get storage details

Returns the details of the selected storage. Example cURL requests Get Storage Details ```bash curl -H "X-Auth-Token: $TOKEN" -X GET https:/$OP_PANEL_HOST/api/v3/onepanel/provider/storages/$STORAGE_ID { "type": "s3", "storagePathType": "flat", "signatureVersion": 4, "scheme": "http", "readonly": false, "qosParameters":{ "storageId": "05b6c0a9b72e475c9d5061b0b7e16947chbcdc", "providerId": "03c7e42a793912307b01b1bbb72a3a6bch4c1c" }, "name": "My S3 Storage", "maximumCanonicalObjectSize": 67108864, "lumaFeed": "auto", "importedStorage": false, "id": "05b6c0a9b72e475c9d5061b0b7e16947chbcdc", "hostname": "https://iam.exampele.com:443/\", "fileMode": "0664", "dirMode": "0775", "bucketName": "bucket1.iam.examplee.com", "blockSize": 10485760, "accessKey": "" } ```

Example

var Onepanel = require('onepanel');
var defaultClient = Onepanel.ApiClient.instance;

// Configure API key authorization: api_key1
var api_key1 = defaultClient.authentications['api_key1'];
api_key1.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//api_key1.apiKeyPrefix = 'Token';

// Configure API key authorization: api_key2
var api_key2 = defaultClient.authentications['api_key2'];
api_key2.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//api_key2.apiKeyPrefix = 'Token';

// Configure HTTP basic authorization: basic
var basic = defaultClient.authentications['basic'];
basic.username = 'YOUR USERNAME';
basic.password = 'YOUR PASSWORD';

var apiInstance = new Onepanel.StoragesApi();

var id = "id_example"; // String | The Id of a storage resource, which details should be returned. 


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.getStorageDetails(id, callback);

Parameters

Name Type Description Notes
id String The Id of a storage resource, which details should be returned.

Return type

StorageGetDetails

Authorization

api_key1, api_key2, basic

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

getStorages

ProviderStorages getStorages()

Get storages

Returns the list of provider storage resources and their details. Example cURL requests Get provider storage ids ```bash curl -H "X-Auth-Token: $TOKEN" -X GET https://$OP_PANEL_HOST/api/v3/onepanel/provider/storages { "ids": [ "18a42a43b1b2d92455ffa09e9a15df7fch4f82", "0a26877440f6ce457106c6958dfe7ecbch0ac6", "b3d7d10504393556d9b1631a74c34520ch8359" ] } ```

Example

var Onepanel = require('onepanel');
var defaultClient = Onepanel.ApiClient.instance;

// Configure API key authorization: api_key1
var api_key1 = defaultClient.authentications['api_key1'];
api_key1.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//api_key1.apiKeyPrefix = 'Token';

// Configure API key authorization: api_key2
var api_key2 = defaultClient.authentications['api_key2'];
api_key2.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//api_key2.apiKeyPrefix = 'Token';

// Configure HTTP basic authorization: basic
var basic = defaultClient.authentications['basic'];
basic.username = 'YOUR USERNAME';
basic.password = 'YOUR PASSWORD';

var apiInstance = new Onepanel.StoragesApi();

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.getStorages(callback);

Parameters

This endpoint does not need any parameter.

Return type

ProviderStorages

Authorization

api_key1, api_key2, basic

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

modifyStorage

StorageModifyDetails modifyStorage(id, storageModifyRequest)

Modify storage config

Modifies storage configuration. Example cURL requests Modify storage name. Notice, that current storage name is the map key. ```bash curl -H "X-Auth-Token: $TOKEN" -X PATCH https://$OP_PANEL_HOST/api/v3/onepanel/provider/storages/$STORAGE_ID \ -H "Content-Type: application/json" -d '{ "My S3 Storage": { "type":"s3", "name": "My S3 Storage Updated" } }' { "type": "s3", "storagePathType": "flat", "signatureVersion": "4", "scheme": "http", "readonly": false, "qosParameters": { "storageId": "2456aa013af797dbef27743790a5f12cche680", "providerId": "03c7e42a793912307b01b1bbb72a3a6bch4c1c" }, "name": "My S3 Storage Updated", "maximumCanonicalObjectSize": "67108864", "lumaFeed": "auto", "importedStorage": false, "id": "2456aa013af797dbef27743790a5f12cche680", "hostname": "https://iam.exampele.com:443/\", "fileMode": "0664", "dirMode": "0775", "bucketName": "bucket1.iam.examplee.com", "blockSize": "10485760", "accessKey": "" } ```

Example

var Onepanel = require('onepanel');
var defaultClient = Onepanel.ApiClient.instance;

// Configure API key authorization: api_key1
var api_key1 = defaultClient.authentications['api_key1'];
api_key1.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//api_key1.apiKeyPrefix = 'Token';

// Configure API key authorization: api_key2
var api_key2 = defaultClient.authentications['api_key2'];
api_key2.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//api_key2.apiKeyPrefix = 'Token';

// Configure HTTP basic authorization: basic
var basic = defaultClient.authentications['basic'];
basic.username = 'YOUR USERNAME';
basic.password = 'YOUR PASSWORD';

var apiInstance = new Onepanel.StoragesApi();

var id = "id_example"; // String | The Id of the storage resource which details should be modified. 

var storageModifyRequest = new Onepanel.StorageModifyRequest(); // StorageModifyRequest | An object with one key - the current name of the storage that is being modified - and its value set to an object with updated parameters. 


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.modifyStorage(id, storageModifyRequest, callback);

Parameters

Name Type Description Notes
id String The Id of the storage resource which details should be modified.
storageModifyRequest StorageModifyRequest An object with one key - the current name of the storage that is being modified - and its value set to an object with updated parameters.

Return type

StorageModifyDetails

Authorization

api_key1, api_key2, basic

HTTP request headers

  • Content-Type: application/json
  • Accept: Not defined

removeStorage

removeStorage(id)

Remove storage

Removes storage from the cluster. Only storage not supporting any spaces can be removed. Example cURL requests Remove storage ```bash curl -H "X-Auth-Token: $TOKEN" -X DELETE https://$OP_PANEL_HOST/api/v3/onepanel/provider/storages/$STORAGE_ID ```

Example

var Onepanel = require('onepanel');
var defaultClient = Onepanel.ApiClient.instance;

// Configure API key authorization: api_key1
var api_key1 = defaultClient.authentications['api_key1'];
api_key1.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//api_key1.apiKeyPrefix = 'Token';

// Configure API key authorization: api_key2
var api_key2 = defaultClient.authentications['api_key2'];
api_key2.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//api_key2.apiKeyPrefix = 'Token';

// Configure HTTP basic authorization: basic
var basic = defaultClient.authentications['basic'];
basic.username = 'YOUR USERNAME';
basic.password = 'YOUR PASSWORD';

var apiInstance = new Onepanel.StoragesApi();

var id = "id_example"; // String | The Id of the storage to remove.


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
};
apiInstance.removeStorage(id, callback);

Parameters

Name Type Description Notes
id String The Id of the storage to remove.

Return type

null (empty response body)

Authorization

api_key1, api_key2, basic

HTTP request headers

  • Content-Type: application/json
  • Accept: Not defined