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

Latest commit

 

History

History
311 lines (205 loc) · 7.24 KB

TagApi.md

File metadata and controls

311 lines (205 loc) · 7.24 KB

upcloud.TagApi

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
createTag POST /tag Create a new tag
deleteTag DELETE /tag/{tagName} Delete tag
listTags GET /tag List existing tags
modifyTag PUT /tag/{tagName} Modify existing tag
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.TagApi();

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

createTag

CreateNewTagResponse createTag(tag)

Create a new tag

Creates a new tag. Existing servers can be tagged in same request

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

var tag = new upcloud.TagCreateRequest(); // TagCreateRequest | 

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

Parameters

Name Type Description Notes
tag TagCreateRequest

Return type

CreateNewTagResponse

Authorization

baseAuth

HTTP request headers

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

deleteTag

deleteTag(tagName)

Delete tag

Deleting existing tag untags all servers from specified tag and deletes tag definition

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

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

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

Parameters

Name Type Description Notes
tagName String Tag name

Return type

null (empty response body)

Authorization

baseAuth

HTTP request headers

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

listTags

TagListResponse listTags()

List existing tags

Returns all existing tags with their properties and servers tagged

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.TagApi();
apiInstance.listTags().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

TagListResponse

Authorization

baseAuth

HTTP request headers

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

modifyTag

CreateNewTagResponse modifyTag(tagNametag)

Modify existing tag

Changes attributes of an existing tag

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

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

var tag = new upcloud.ModifyTagRequest(); // ModifyTagRequest | 

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

Parameters

Name Type Description Notes
tagName String Tag name
tag ModifyTagRequest

Return type

CreateNewTagResponse

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

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