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

Latest commit

 

History

History
972 lines (646 loc) · 24.6 KB

File metadata and controls

972 lines (646 loc) · 24.6 KB

upcloud.ServerApi

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

Method HTTP request Description
assignTag POST /server/{serverId}/tag/{tagList} Assign tag to a server
attachStorage POST /server/{serverId}/storage/attach Attach storage
createFirewallRule POST /server/{serverId}/firewall_rule Create firewall rule
createServer POST /server Create server
deleteFirewallRule DELETE /server/{serverId}/firewall_rule/{firewallRuleNumber} Remove firewall rule
deleteServer DELETE /server/{serverId} Delete server
detachStorage POST /server/{serverId}/storage/detach Detach storage
ejectCdrom POST /server/{serverId}/cdrom/eject Eject CD-ROM
getFirewallRule GET /server/{serverId}/firewall_rule/{firewallRuleNumber} Get firewall rule details
listServerConfigurations GET /server_size List server configurations
listServers GET /server List of servers
loadCdrom POST /server/{serverId}/storage/cdrom/load Load CD-ROM
modifyServer PUT /server/{serverId} Modify server
restartServer POST /server/{serverId}/restart Restart server
serverDetails GET /server/{serverId} Get server details
serverServerIdFirewallRuleGet GET /server/{serverId}/firewall_rule List firewall rules
startServer POST /server/{serverId}/start Start server
stopServer POST /server/{serverId}/stop Stop server
untag POST /server/{serverId}/untag/{tagName} Remove tag from server

assignTag

CreateServerResponse assignTag(serverId, tagList)

Assign tag to a server

Servers can be tagged with one or more tags. The tags used must exist

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

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

var tagList = "tagList_example"; // String | List of tags

apiInstance.assignTag(serverId, tagList).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
tagList String List of tags

Return type

CreateServerResponse

Authorization

baseAuth

HTTP request headers

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

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

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

createFirewallRule

FirewallRuleCreateResponse createFirewallRule(serverId, firewallRule)

Create firewall rule

Creates a new firewall rule

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

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

var firewallRule = new upcloud.FirewallRuleRequest(); // FirewallRuleRequest | 

apiInstance.createFirewallRule(serverId, firewallRule).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
firewallRule FirewallRuleRequest

Return type

FirewallRuleCreateResponse

Authorization

baseAuth

HTTP request headers

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

createServer

CreateServerResponse createServer(opts)

Create server

Creates a new server instance.

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

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

Parameters

Name Type Description Notes
server CreateServerRequest [optional]

Return type

CreateServerResponse

Authorization

baseAuth

HTTP request headers

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

deleteFirewallRule

deleteFirewallRule(serverId, firewallRuleNumber)

Remove firewall rule

Removes a firewall rule from a server. Firewall rules must be removed individually. The positions of remaining firewall rules will be adjusted after a rule is removed.

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

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

var firewallRuleNumber = 3.4; // Number | Denotes the index of the firewall rule in the server's firewall rule list

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

Parameters

Name Type Description Notes
serverId String Server id
firewallRuleNumber Number Denotes the index of the firewall rule in the server's firewall rule list

Return type

null (empty response body)

Authorization

baseAuth

HTTP request headers

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

deleteServer

deleteServer(serverId)

Delete 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.ServerApi();

var serverId = "serverId_example"; // String | Id of server to delete

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

Parameters

Name Type Description Notes
serverId String Id of server to delete

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

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

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

getFirewallRule

FirewallRuleCreateResponse getFirewallRule(serverId, firewallRuleNumber)

Get firewall rule details

Returns detailed information about a specific firewall rule

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

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

var firewallRuleNumber = 3.4; // Number | Denotes the index of the firewall rule in the server's firewall rule list

apiInstance.getFirewallRule(serverId, firewallRuleNumber).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
firewallRuleNumber Number Denotes the index of the firewall rule in the server's firewall rule list

Return type

FirewallRuleCreateResponse

Authorization

baseAuth

HTTP request headers

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

listServerConfigurations

ConfigurationListResponse listServerConfigurations()

List server configurations

Returns a list of available server configurations. A server configuration consists of a combination of CPU core count and main memory amount. All servers are created using these configurations.

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.ServerApi();
apiInstance.listServerConfigurations().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

ConfigurationListResponse

Authorization

baseAuth

HTTP request headers

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

listServers

ServerListResponse listServers()

List of servers

Returns a list of all servers associated with the current account.

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.ServerApi();
apiInstance.listServers().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

ServerListResponse

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

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

modifyServer

CreateServerResponse modifyServer(serverId, opts)

Modify 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.ServerApi();

var serverId = "serverId_example"; // String | Id of server to modify

var opts = { 
  'server': new upcloud.Server() // Server | 
};
apiInstance.modifyServer(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 Id of server to modify
server Server [optional]

Return type

CreateServerResponse

Authorization

baseAuth

HTTP request headers

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

restartServer

CreateServerResponse restartServer(serverId, restartServer)

Restart server

Stops and starts a server. The server state must be `started`.

Example

var upcloud = require('upcloud');

var apiInstance = new upcloud.ServerApi();

var serverId = "serverId_example"; // String | Id of server to restart

var restartServer = new upcloud.RestartServer(); // RestartServer | 

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

Parameters

Name Type Description Notes
serverId String Id of server to restart
restartServer RestartServer

Return type

CreateServerResponse

Authorization

No authorization required

HTTP request headers

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

serverDetails

CreateServerResponse serverDetails(serverId)

Get server details

Returns detailed information about a specific 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.ServerApi();

var serverId = "serverId_example"; // String | Id of server to return

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

Parameters

Name Type Description Notes
serverId String Id of server to return

Return type

CreateServerResponse

Authorization

baseAuth

HTTP request headers

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

serverServerIdFirewallRuleGet

FirewallRuleListResponse serverServerIdFirewallRuleGet(serverId, )

List firewall rules

Returns a list of firewall rules for a specific 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.ServerApi();

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

apiInstance.serverServerIdFirewallRuleGet(serverId, ).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

Return type

FirewallRuleListResponse

Authorization

baseAuth

HTTP request headers

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

startServer

CreateServerResponse startServer(serverId)

Start server

Starts a stopped server. The server state must be `stopped`.

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

var serverId = "serverId_example"; // String | Id of server to start

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

Parameters

Name Type Description Notes
serverId String Id of server to start

Return type

CreateServerResponse

Authorization

baseAuth

HTTP request headers

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

stopServer

CreateServerResponse stopServer(serverId, stopServerRequest)

Stop server

Stops a started server. The server state must be `started`.

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

var serverId = "serverId_example"; // String | Id of server to stop

var stopServerRequest = new upcloud.StopServer(); // StopServer | 

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

Parameters

Name Type Description Notes
serverId String Id of server to stop
stopServerRequest StopServer

Return type

CreateServerResponse

Authorization

baseAuth

HTTP request headers

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

untag

CreateServerResponse untag(serverId, tagName)

Remove tag from server

Untags tags from given server. The tag(s) must exist

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

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

var tagName = "tagName_example"; // String | Tag name

apiInstance.untag(serverId, tagName).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
tagName String Tag name

Return type

CreateServerResponse

Authorization

baseAuth

HTTP request headers

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