Skip to content
This repository has been archived by the owner on May 25, 2021. It is now read-only.

Latest commit

 

History

History
871 lines (578 loc) · 22 KB

StorageApi.md

File metadata and controls

871 lines (578 loc) · 22 KB

upcloud.StorageApi

All URIs are relative to https://api.upcloud.com/1.2

Method HTTP request Description
attachStorage POST /server/{serverId}/storage/attach Attach storage
backupStorage POST /storage/{storageId}/backup Create backup
cancelOperation POST /storage/{storageId}/cancel Cancel storage operation
cloneStorage POST /storage/{storageId}/clone Clone storage
createStorage POST /storage Create storage
deleteStorage DELETE /storage/{storageId} Delete storage
detachStorage POST /server/{serverId}/storage/detach Detach storage
ejectCdrom POST /server/{serverId}/cdrom/eject Eject CD-ROM
favoriteStorage POST /storage/{storageId}/favorite Add storage to favorites
getStorageDetails GET /storage/{storageId} Get storage details
listStorageTypes GET /storage/{type}/ List of storages by type
listStorages GET /storage List of storages
loadCdrom POST /server/{serverId}/storage/cdrom/load Load CD-ROM
modifyStorage PUT /storage/{storageId} Modify storage
restoreStorage POST /storage/{storageId}/restore Restore backup
templatizeStorage POST /storage/{storageId}/templatize Templatize storage
unfavoriteStorage DELETE /storage/{storageId}/favorite Remove storage from favorites

attachStorage

CreateServerResponse attachStorage(serverId, storageDevice)

Attach storage

Attaches a storage as a device to a server.

Example

var upcloud = require('upcloud');
var defaultClient = upcloud.ApiClient.instance;

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

var apiInstance = new upcloud.StorageApi();

var serverId = "serverId_example"; // String | Server id

var storageDevice = new upcloud.AttachStorageDeviceRequest(); // AttachStorageDeviceRequest | 

apiInstance.attachStorage(serverId, storageDevice).then(function(data) {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

Parameters

Name Type Description Notes
serverId String Server id
storageDevice AttachStorageDeviceRequest

Return type

CreateServerResponse

Authorization

baseAuth

HTTP request headers

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

backupStorage

CreateStorageResponse backupStorage(storageId, storage)

Create backup

Creates a point-in-time backup of a storage resource. For automatic, scheduled backups, see `backup_rule` in Create storage or Modify storage.

Example

var upcloud = require('upcloud');
var defaultClient = upcloud.ApiClient.instance;

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

var apiInstance = new upcloud.StorageApi();

var storageId = "storageId_example"; // String | Storage id

var storage = new upcloud.CreateBackupStorageRequest(); // CreateBackupStorageRequest | 

apiInstance.backupStorage(storageId, storage).then(function(data) {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

Parameters

Name Type Description Notes
storageId String Storage id
storage CreateBackupStorageRequest

Return type

CreateStorageResponse

Authorization

baseAuth

HTTP request headers

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

cancelOperation

cancelOperation(storageId)

Cancel storage operation

Cancels a running cloning operation and deletes the incomplete copy.

Example

var upcloud = require('upcloud');
var defaultClient = upcloud.ApiClient.instance;

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

var apiInstance = new upcloud.StorageApi();

var storageId = "storageId_example"; // String | Strage id

apiInstance.cancelOperation(storageId).then(function() {
  console.log('API called successfully.');
}, function(error) {
  console.error(error);
});

Parameters

Name Type Description Notes
storageId String Strage id

Return type

null (empty response body)

Authorization

baseAuth

HTTP request headers

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

cloneStorage

CreateStorageResponse cloneStorage(storageId, storage)

Clone storage

Creates an exact copy of an existing storage resource.

Example

var upcloud = require('upcloud');
var defaultClient = upcloud.ApiClient.instance;

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

var apiInstance = new upcloud.StorageApi();

var storageId = "storageId_example"; // String | Storage id

var storage = new upcloud.CloneStorageRequest(); // CloneStorageRequest | 

apiInstance.cloneStorage(storageId, storage).then(function(data) {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

Parameters

Name Type Description Notes
storageId String Storage id
storage CloneStorageRequest

Return type

CreateStorageResponse

Authorization

baseAuth

HTTP request headers

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

createStorage

CreateStorageResponse createStorage(storage)

Create storage

Creates a new storage resource.

Example

var upcloud = require('upcloud');
var defaultClient = upcloud.ApiClient.instance;

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

var apiInstance = new upcloud.StorageApi();

var storage = new upcloud.CreateStorageRequest(); // CreateStorageRequest | 

apiInstance.createStorage(storage).then(function(data) {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

Parameters

Name Type Description Notes
storage CreateStorageRequest

Return type

CreateStorageResponse

Authorization

baseAuth

HTTP request headers

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

deleteStorage

deleteStorage(storageId)

Delete storage

Deleted an existing storage resource.

Example

var upcloud = require('upcloud');
var defaultClient = upcloud.ApiClient.instance;

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

var apiInstance = new upcloud.StorageApi();

var storageId = "storageId_example"; // String | 

apiInstance.deleteStorage(storageId).then(function() {
  console.log('API called successfully.');
}, function(error) {
  console.error(error);
});

Parameters

Name Type Description Notes
storageId String

Return type

null (empty response body)

Authorization

baseAuth

HTTP request headers

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

detachStorage

CreateServerResponse detachStorage(serverId, storageDevice)

Detach storage

Detaches a storage resource from a server.

Example

var upcloud = require('upcloud');
var defaultClient = upcloud.ApiClient.instance;

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

var apiInstance = new upcloud.StorageApi();

var serverId = "serverId_example"; // String | Server id

var storageDevice = new upcloud.StorageDeviceDetachRequest(); // StorageDeviceDetachRequest | 

apiInstance.detachStorage(serverId, storageDevice).then(function(data) {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

Parameters

Name Type Description Notes
serverId String Server id
storageDevice StorageDeviceDetachRequest

Return type

CreateServerResponse

Authorization

baseAuth

HTTP request headers

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

ejectCdrom

ejectCdrom(serverId)

Eject CD-ROM

Ejects the storage from the CD-ROM device of a server.

Example

var upcloud = require('upcloud');
var defaultClient = upcloud.ApiClient.instance;

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

var apiInstance = new upcloud.StorageApi();

var serverId = "serverId_example"; // String | Server id

apiInstance.ejectCdrom(serverId).then(function() {
  console.log('API called successfully.');
}, function(error) {
  console.error(error);
});

Parameters

Name Type Description Notes
serverId String Server id

Return type

null (empty response body)

Authorization

baseAuth

HTTP request headers

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

favoriteStorage

favoriteStorage(storageId)

Add storage to favorites

Adds a storage to the list of favorite storages. To list favorite storages, see List storages. This operations succeeds even if the storage is already on the list of favorites.

Example

var upcloud = require('upcloud');
var defaultClient = upcloud.ApiClient.instance;

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

var apiInstance = new upcloud.StorageApi();

var storageId = "storageId_example"; // String | Storage id

apiInstance.favoriteStorage(storageId).then(function() {
  console.log('API called successfully.');
}, function(error) {
  console.error(error);
});

Parameters

Name Type Description Notes
storageId String Storage id

Return type

null (empty response body)

Authorization

baseAuth

HTTP request headers

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

getStorageDetails

CreateStorageResponse getStorageDetails(storageId)

Get storage details

Returns detailed information about a specific storage resource.

Example

var upcloud = require('upcloud');
var defaultClient = upcloud.ApiClient.instance;

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

var apiInstance = new upcloud.StorageApi();

var storageId = "storageId_example"; // String | 

apiInstance.getStorageDetails(storageId).then(function(data) {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

Parameters

Name Type Description Notes
storageId String

Return type

CreateStorageResponse

Authorization

baseAuth

HTTP request headers

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

listStorageTypes

SuccessStoragesResponse listStorageTypes(type)

List of storages by type

Example

var upcloud = require('upcloud');
var defaultClient = upcloud.ApiClient.instance;

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

var apiInstance = new upcloud.StorageApi();

var type = "type_example"; // String | Storage's access type (`public` or `private`) or storage type (`normal`, `backup`, `cdrom` or `template`) or `favorite` status

apiInstance.listStorageTypes(type).then(function(data) {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

Parameters

Name Type Description Notes
type String Storage's access type (`public` or `private`) or storage type (`normal`, `backup`, `cdrom` or `template`) or `favorite` status

Return type

SuccessStoragesResponse

Authorization

baseAuth

HTTP request headers

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

listStorages

SuccessStoragesResponse listStorages()

List of storages

Example

var upcloud = require('upcloud');
var defaultClient = upcloud.ApiClient.instance;

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

var apiInstance = new upcloud.StorageApi();
apiInstance.listStorages().then(function(data) {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

Parameters

This endpoint does not need any parameter.

Return type

SuccessStoragesResponse

Authorization

baseAuth

HTTP request headers

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

loadCdrom

CreateServerResponse loadCdrom(serverId, opts)

Load CD-ROM

Loads a storage as a CD-ROM in the CD-ROM device of a server.

Example

var upcloud = require('upcloud');
var defaultClient = upcloud.ApiClient.instance;

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

var apiInstance = new upcloud.StorageApi();

var serverId = "serverId_example"; // String | Server id

var opts = { 
  'storageDevice': new upcloud.StorageDeviceLoadRequest() // StorageDeviceLoadRequest | 
};
apiInstance.loadCdrom(serverId, opts).then(function(data) {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

Parameters

Name Type Description Notes
serverId String Server id
storageDevice StorageDeviceLoadRequest [optional]

Return type

CreateServerResponse

Authorization

baseAuth

HTTP request headers

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

modifyStorage

CreateStorageResponse modifyStorage(storageIdstorage)

Modify storage

Modifies an existing storage resource. This operation is used to rename or resize the storage.

Example

var upcloud = require('upcloud');
var defaultClient = upcloud.ApiClient.instance;

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

var apiInstance = new upcloud.StorageApi();

var storageId = "storageId_example"; // String | 

var storage = new upcloud.ModifyStorageRequest(); // ModifyStorageRequest | 

apiInstance.modifyStorage(storageIdstorage).then(function(data) {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

Parameters

Name Type Description Notes
storageId String
storage ModifyStorageRequest

Return type

CreateStorageResponse

Authorization

baseAuth

HTTP request headers

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

restoreStorage

restoreStorage(storageId)

Restore backup

Restores the origin storage with data from the specified backup storage.

Example

var upcloud = require('upcloud');
var defaultClient = upcloud.ApiClient.instance;

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

var apiInstance = new upcloud.StorageApi();

var storageId = "storageId_example"; // String | Storage id

apiInstance.restoreStorage(storageId).then(function() {
  console.log('API called successfully.');
}, function(error) {
  console.error(error);
});

Parameters

Name Type Description Notes
storageId String Storage id

Return type

null (empty response body)

Authorization

baseAuth

HTTP request headers

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

templatizeStorage

CreateStorageResponse templatizeStorage(storageId, opts)

Templatize storage

Creates an exact copy of an existing storage resource which can be used as a template for creating new servers.

Example

var upcloud = require('upcloud');
var defaultClient = upcloud.ApiClient.instance;

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

var apiInstance = new upcloud.StorageApi();

var storageId = "storageId_example"; // String | Storage id

var opts = { 
  'storage': new upcloud.TemplitizeStorageRequest() // TemplitizeStorageRequest | 
};
apiInstance.templatizeStorage(storageId, opts).then(function(data) {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

Parameters

Name Type Description Notes
storageId String Storage id
storage TemplitizeStorageRequest [optional]

Return type

CreateStorageResponse

Authorization

baseAuth

HTTP request headers

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

unfavoriteStorage

unfavoriteStorage(storageId)

Remove storage from favorites

Delete a storage from the list of favorite storages. To list favorite storages, see List storages. This operations succeeds even if the storage is already on the list of favorites.

Example

var upcloud = require('upcloud');
var defaultClient = upcloud.ApiClient.instance;

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

var apiInstance = new upcloud.StorageApi();

var storageId = "storageId_example"; // String | Storage id

apiInstance.unfavoriteStorage(storageId).then(function() {
  console.log('API called successfully.');
}, function(error) {
  console.error(error);
});

Parameters

Name Type Description Notes
storageId String Storage id

Return type

null (empty response body)

Authorization

baseAuth

HTTP request headers

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