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 |
CreateServerResponse assignTag(serverId, tagList)
Assign tag to a server
Servers can be tagged with one or more tags. The tags used must exist
// Import classes:
//import com.upcloud.client.ApiClient;
//import com.upcloud.client.ApiException;
//import com.upcloud.client.Configuration;
//import com.upcloud.client.auth.*;
//import com.upcloud.client.api.TagApi;
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure HTTP basic authorization: baseAuth
HttpBasicAuth baseAuth = (HttpBasicAuth) defaultClient.getAuthentication("baseAuth");
baseAuth.setUsername("YOUR USERNAME");
baseAuth.setPassword("YOUR PASSWORD");
TagApi apiInstance = new TagApi();
UUID serverId = new UUID(); // UUID | Server id
String tagList = "tagList_example"; // String | List of tags
try {
CreateServerResponse result = apiInstance.assignTag(serverId, tagList);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling TagApi#assignTag");
e.printStackTrace();
}| Name | Type | Description | Notes |
|---|---|---|---|
| serverId | UUID | Server id | |
| tagList | String | List of tags |
- Content-Type: application/json
- Accept: application/json
CreateNewTagResponse createTag(tag)
Create a new tag
Creates a new tag. Existing servers can be tagged in same request
// Import classes:
//import com.upcloud.client.ApiClient;
//import com.upcloud.client.ApiException;
//import com.upcloud.client.Configuration;
//import com.upcloud.client.auth.*;
//import com.upcloud.client.api.TagApi;
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure HTTP basic authorization: baseAuth
HttpBasicAuth baseAuth = (HttpBasicAuth) defaultClient.getAuthentication("baseAuth");
baseAuth.setUsername("YOUR USERNAME");
baseAuth.setPassword("YOUR PASSWORD");
TagApi apiInstance = new TagApi();
TagCreateRequest tag = new TagCreateRequest(); // TagCreateRequest |
try {
CreateNewTagResponse result = apiInstance.createTag(tag);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling TagApi#createTag");
e.printStackTrace();
}| Name | Type | Description | Notes |
|---|---|---|---|
| tag | TagCreateRequest |
- Content-Type: application/json
- Accept: application/json
deleteTag(tagName)
Delete tag
Deleting existing tag untags all servers from specified tag and deletes tag definition
// Import classes:
//import com.upcloud.client.ApiClient;
//import com.upcloud.client.ApiException;
//import com.upcloud.client.Configuration;
//import com.upcloud.client.auth.*;
//import com.upcloud.client.api.TagApi;
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure HTTP basic authorization: baseAuth
HttpBasicAuth baseAuth = (HttpBasicAuth) defaultClient.getAuthentication("baseAuth");
baseAuth.setUsername("YOUR USERNAME");
baseAuth.setPassword("YOUR PASSWORD");
TagApi apiInstance = new TagApi();
String tagName = "tagName_example"; // String | Tag name
try {
apiInstance.deleteTag(tagName);
} catch (ApiException e) {
System.err.println("Exception when calling TagApi#deleteTag");
e.printStackTrace();
}| Name | Type | Description | Notes |
|---|---|---|---|
| tagName | String | Tag name |
null (empty response body)
- Content-Type: application/json
- Accept: application/json
TagListResponse listTags()
List existing tags
Returns all existing tags with their properties and servers tagged
// Import classes:
//import com.upcloud.client.ApiClient;
//import com.upcloud.client.ApiException;
//import com.upcloud.client.Configuration;
//import com.upcloud.client.auth.*;
//import com.upcloud.client.api.TagApi;
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure HTTP basic authorization: baseAuth
HttpBasicAuth baseAuth = (HttpBasicAuth) defaultClient.getAuthentication("baseAuth");
baseAuth.setUsername("YOUR USERNAME");
baseAuth.setPassword("YOUR PASSWORD");
TagApi apiInstance = new TagApi();
try {
TagListResponse result = apiInstance.listTags();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling TagApi#listTags");
e.printStackTrace();
}This endpoint does not need any parameter.
- Content-Type: application/json
- Accept: application/json
CreateNewTagResponse modifyTag(tagName, tag)
Modify existing tag
Changes attributes of an existing tag
// Import classes:
//import com.upcloud.client.ApiClient;
//import com.upcloud.client.ApiException;
//import com.upcloud.client.Configuration;
//import com.upcloud.client.auth.*;
//import com.upcloud.client.api.TagApi;
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure HTTP basic authorization: baseAuth
HttpBasicAuth baseAuth = (HttpBasicAuth) defaultClient.getAuthentication("baseAuth");
baseAuth.setUsername("YOUR USERNAME");
baseAuth.setPassword("YOUR PASSWORD");
TagApi apiInstance = new TagApi();
String tagName = "tagName_example"; // String | Tag name
ModifyTagRequest tag = new ModifyTagRequest(); // ModifyTagRequest |
try {
CreateNewTagResponse result = apiInstance.modifyTag(tagName, tag);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling TagApi#modifyTag");
e.printStackTrace();
}| Name | Type | Description | Notes |
|---|---|---|---|
| tagName | String | Tag name | |
| tag | ModifyTagRequest |
- Content-Type: application/json
- Accept: application/json
CreateServerResponse untag(serverId, tagName)
Remove tag from server
Untags tags from given server. The tag(s) must exist
// Import classes:
//import com.upcloud.client.ApiClient;
//import com.upcloud.client.ApiException;
//import com.upcloud.client.Configuration;
//import com.upcloud.client.auth.*;
//import com.upcloud.client.api.TagApi;
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure HTTP basic authorization: baseAuth
HttpBasicAuth baseAuth = (HttpBasicAuth) defaultClient.getAuthentication("baseAuth");
baseAuth.setUsername("YOUR USERNAME");
baseAuth.setPassword("YOUR PASSWORD");
TagApi apiInstance = new TagApi();
UUID serverId = new UUID(); // UUID | Server id
String tagName = "tagName_example"; // String | Tag name
try {
CreateServerResponse result = apiInstance.untag(serverId, tagName);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling TagApi#untag");
e.printStackTrace();
}| Name | Type | Description | Notes |
|---|---|---|---|
| serverId | UUID | Server id | |
| tagName | String | Tag name |
- Content-Type: application/json
- Accept: application/json