import os
from gcore import Gcore
client = Gcore(
api_key=os.environ.get("GCORE_API_KEY"), # This is the default and can be omitted
)
baremetal_server = client.cloud.baremetal.servers.update(
server_id="024a29e-b4b7-4c91-9a46-505be123d9f8",
project_id=1,
region_id=1,
)
print(baremetal_server.id)package main
import (
"context"
"fmt"
"github.com/G-Core/gcore-go"
"github.com/G-Core/gcore-go/cloud"
"github.com/G-Core/gcore-go/option"
)
func main() {
client := gcore.NewClient(
option.WithAPIKey("My API Key"),
)
baremetalServer, err := client.Cloud.Baremetal.Servers.Update(
context.TODO(),
"024a29e-b4b7-4c91-9a46-505be123d9f8",
cloud.BaremetalServerUpdateParams{
ProjectID: gcore.Int(1),
RegionID: gcore.Int(1),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", baremetalServer.ID)
}
curl --request PATCH \
--url https://api.gcore.com/cloud/v1/bminstances/{project_id}/{region_id}/{server_id} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "server_name",
"tags": {
"my-tag": "my-tag-value",
"my-tag-to-remove": null
}
}
'const options = {
method: 'PATCH',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'server_name',
tags: {'my-tag': 'my-tag-value', 'my-tag-to-remove': null}
})
};
fetch('https://api.gcore.com/cloud/v1/bminstances/{project_id}/{region_id}/{server_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.gcore.com/cloud/v1/bminstances/{project_id}/{region_id}/{server_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'server_name',
'tags' => [
'my-tag' => 'my-tag-value',
'my-tag-to-remove' => null
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.patch("https://api.gcore.com/cloud/v1/bminstances/{project_id}/{region_id}/{server_id}")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"server_name\",\n \"tags\": {\n \"my-tag\": \"my-tag-value\",\n \"my-tag-to-remove\": null\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gcore.com/cloud/v1/bminstances/{project_id}/{region_id}/{server_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"server_name\",\n \"tags\": {\n \"my-tag\": \"my-tag-value\",\n \"my-tag-to-remove\": null\n }\n}"
response = http.request(request)
puts response.read_body{
"addresses": {},
"blackhole_ports": [
{
"AlarmEnd": "2025-02-05 12:04:30",
"AlarmStart": "2025-02-05 12:04:11",
"AlarmState": "alarm",
"AlertDuration": "2 hours",
"DestinationIP": "80.240.114.116",
"ID": 123
}
],
"created_at": "2023-11-29T10:56:49Z",
"creator_task_id": "<string>",
"ddos_profile": {
"fields": [
{
"base_field": 10,
"default": null,
"description": "ARK server ports. Valid port values are in range 1000-65535",
"field_type": null,
"field_value": 45046,
"id": 11,
"name": "ARK Ports",
"required": true,
"validation_schema": {
"items": {
"maximum": 65535,
"minimum": 1000,
"type": "integer"
},
"minItems": 1,
"type": "array"
}
}
],
"id": 0,
"options": {
"active": true,
"bgp": true
},
"profile_template": {
"description": "description",
"fields": [
{
"default": null,
"description": "ARK server ports. Valid port values are in range 1000-65535",
"field_type": null,
"id": 11,
"name": "ARK Ports",
"required": true,
"validation_schema": {
"items": {
"maximum": 65535,
"minimum": 1000,
"type": "integer"
},
"minItems": 1,
"type": "array"
}
}
],
"id": 123,
"name": "ICMP port"
},
"profile_template_description": "ARK server ports. Valid port values are in range 1000-65535",
"protocols": [
{
"port": "80",
"protocols": [
"TCP",
"HTTP"
]
},
{
"port": "53",
"protocols": [
"UDP"
]
}
],
"site": "ED",
"status": {
"error_description": "",
"status": "Updated"
}
},
"fixed_ip_assignments": [
{
"external": true,
"ip_address": "123.123.123.1",
"subnet_id": "eaafdc3c-f48b-4eb4-826f-057dfc7d6476"
}
],
"flavor": {
"architecture": "x86_64",
"flavor_id": "g2-standard-32-64",
"flavor_name": "g2-standard-32-64",
"hardware_description": {
"cpu": "1x Intel Xeon 4C/8T 3.7 GHz",
"disk": "2x 250GiB SSD",
"license": "Windows License",
"network": "1x 500Mbps",
"ram": "32 GiB"
},
"os_type": "linux",
"ram": 2048,
"resource_class": "bm2-hf-medium",
"vcpus": 1
},
"id": "6c6aa80f-7836-4dc2-a2ae-125e248be476",
"instance_isolation": {
"reason": "Suspicious activities"
},
"name": "my-server-1",
"project_id": 1,
"region": "Luxembourg",
"region_id": 1,
"ssh_key_name": "<string>",
"status": "ACTIVE",
"tags": [
{
"key": "my-tag",
"read_only": false,
"value": "my-tag-value"
}
],
"task_id": null,
"task_state": "<string>",
"vm_state": "active"
}Update bare metal server
Rename bare metal server or update tags
import os
from gcore import Gcore
client = Gcore(
api_key=os.environ.get("GCORE_API_KEY"), # This is the default and can be omitted
)
baremetal_server = client.cloud.baremetal.servers.update(
server_id="024a29e-b4b7-4c91-9a46-505be123d9f8",
project_id=1,
region_id=1,
)
print(baremetal_server.id)package main
import (
"context"
"fmt"
"github.com/G-Core/gcore-go"
"github.com/G-Core/gcore-go/cloud"
"github.com/G-Core/gcore-go/option"
)
func main() {
client := gcore.NewClient(
option.WithAPIKey("My API Key"),
)
baremetalServer, err := client.Cloud.Baremetal.Servers.Update(
context.TODO(),
"024a29e-b4b7-4c91-9a46-505be123d9f8",
cloud.BaremetalServerUpdateParams{
ProjectID: gcore.Int(1),
RegionID: gcore.Int(1),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", baremetalServer.ID)
}
curl --request PATCH \
--url https://api.gcore.com/cloud/v1/bminstances/{project_id}/{region_id}/{server_id} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "server_name",
"tags": {
"my-tag": "my-tag-value",
"my-tag-to-remove": null
}
}
'const options = {
method: 'PATCH',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'server_name',
tags: {'my-tag': 'my-tag-value', 'my-tag-to-remove': null}
})
};
fetch('https://api.gcore.com/cloud/v1/bminstances/{project_id}/{region_id}/{server_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.gcore.com/cloud/v1/bminstances/{project_id}/{region_id}/{server_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'server_name',
'tags' => [
'my-tag' => 'my-tag-value',
'my-tag-to-remove' => null
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.patch("https://api.gcore.com/cloud/v1/bminstances/{project_id}/{region_id}/{server_id}")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"server_name\",\n \"tags\": {\n \"my-tag\": \"my-tag-value\",\n \"my-tag-to-remove\": null\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gcore.com/cloud/v1/bminstances/{project_id}/{region_id}/{server_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"server_name\",\n \"tags\": {\n \"my-tag\": \"my-tag-value\",\n \"my-tag-to-remove\": null\n }\n}"
response = http.request(request)
puts response.read_body{
"addresses": {},
"blackhole_ports": [
{
"AlarmEnd": "2025-02-05 12:04:30",
"AlarmStart": "2025-02-05 12:04:11",
"AlarmState": "alarm",
"AlertDuration": "2 hours",
"DestinationIP": "80.240.114.116",
"ID": 123
}
],
"created_at": "2023-11-29T10:56:49Z",
"creator_task_id": "<string>",
"ddos_profile": {
"fields": [
{
"base_field": 10,
"default": null,
"description": "ARK server ports. Valid port values are in range 1000-65535",
"field_type": null,
"field_value": 45046,
"id": 11,
"name": "ARK Ports",
"required": true,
"validation_schema": {
"items": {
"maximum": 65535,
"minimum": 1000,
"type": "integer"
},
"minItems": 1,
"type": "array"
}
}
],
"id": 0,
"options": {
"active": true,
"bgp": true
},
"profile_template": {
"description": "description",
"fields": [
{
"default": null,
"description": "ARK server ports. Valid port values are in range 1000-65535",
"field_type": null,
"id": 11,
"name": "ARK Ports",
"required": true,
"validation_schema": {
"items": {
"maximum": 65535,
"minimum": 1000,
"type": "integer"
},
"minItems": 1,
"type": "array"
}
}
],
"id": 123,
"name": "ICMP port"
},
"profile_template_description": "ARK server ports. Valid port values are in range 1000-65535",
"protocols": [
{
"port": "80",
"protocols": [
"TCP",
"HTTP"
]
},
{
"port": "53",
"protocols": [
"UDP"
]
}
],
"site": "ED",
"status": {
"error_description": "",
"status": "Updated"
}
},
"fixed_ip_assignments": [
{
"external": true,
"ip_address": "123.123.123.1",
"subnet_id": "eaafdc3c-f48b-4eb4-826f-057dfc7d6476"
}
],
"flavor": {
"architecture": "x86_64",
"flavor_id": "g2-standard-32-64",
"flavor_name": "g2-standard-32-64",
"hardware_description": {
"cpu": "1x Intel Xeon 4C/8T 3.7 GHz",
"disk": "2x 250GiB SSD",
"license": "Windows License",
"network": "1x 500Mbps",
"ram": "32 GiB"
},
"os_type": "linux",
"ram": 2048,
"resource_class": "bm2-hf-medium",
"vcpus": 1
},
"id": "6c6aa80f-7836-4dc2-a2ae-125e248be476",
"instance_isolation": {
"reason": "Suspicious activities"
},
"name": "my-server-1",
"project_id": 1,
"region": "Luxembourg",
"region_id": 1,
"ssh_key_name": "<string>",
"status": "ACTIVE",
"tags": [
{
"key": "my-tag",
"read_only": false,
"value": "my-tag-value"
}
],
"task_id": null,
"task_state": "<string>",
"vm_state": "active"
}Authorizations
API key for authentication. Make sure to include the word apikey, followed by a single space and then your token.
Example: apikey 1234_abcdef
Path Parameters
Project ID
1
Region ID
1
Server ID
"024a29e-b4b7-4c91-9a46-505be123d9f8"
Body
Name
^[a-zA-Z0-9][a-zA-Z 0-9._\-]{1,61}[a-zA-Z0-9._]$"server_name"
Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide key-value pairs to add or update tags. Set tag values to null to remove tags. Unspecified tags remain unchanged. Read-only tags are always preserved and cannot be modified.
Examples:
- Add/update tags:
{'tags': {'environment': 'production', 'team': 'backend'}}adds new tags or updates existing ones. - Delete tags:
{'tags': {'old_tag': null}}removes specific tags. - Remove all tags:
{'tags': null}removes all user-managed tags (read-only tags are preserved). - Partial update:
{'tags': {'environment': 'staging'}}only updates specified tags. - Mixed operations:
{'tags': {'environment': 'production', 'cost_center': 'engineering', 'deprecated_tag': null}}adds/updates 'environment' and 'cost_center' while removing 'deprecated_tag', preserving other existing tags. - Replace all: first delete existing tags with null values, then add new ones in the same request.
Show child attributes
Show child attributes
{
"my-tag": "my-tag-value",
"my-tag-to-remove": null
}
Response
OK
Map of network_name to list of addresses in that network
Show child attributes
Show child attributes
IP addresses of the instances that are blackholed by DDoS mitigation system
Show child attributes
Show child attributes
Datetime when bare metal server was created
"2023-11-29T10:56:49Z"
Task that created this entity
Bare metal advanced DDoS protection profile. It is always null if query parameter with_ddos=true is not set.
Show child attributes
Show child attributes
Fixed IP assigned to instance
Show child attributes
Show child attributes
Flavor details
Show child attributes
Show child attributes
Bare metal server ID
"6c6aa80f-7836-4dc2-a2ae-125e248be476"
Instance isolation information
Show child attributes
Show child attributes
Bare metal server name
"my-server-1"
Project ID
1
Region name
"Luxembourg"
Region ID
1
SSH key assigned to bare metal server
Bare metal server status
ACTIVE, BUILD, DELETED, ERROR, HARD_REBOOT, MIGRATING, PASSWORD, PAUSED, REBOOT, REBUILD, RESCUE, RESIZE, REVERT_RESIZE, SHELVED, SHELVED_OFFLOADED, SHUTOFF, SOFT_DELETED, SUSPENDED, UNKNOWN, VERIFY_RESIZE "ACTIVE"
List of key-value tags associated with the resource. A tag is a key-value pair that can be associated with a resource, enabling efficient filtering and grouping for better organization and management. Some tags are read-only and cannot be modified by the user. Tags are also integrated with cost reports, allowing cost data to be filtered based on tag keys or values.
Show child attributes
Show child attributes
[
{
"key": "my-tag",
"read_only": false,
"value": "my-tag-value"
}
]
The UUID of the active task that currently holds a lock on the resource. This lock prevents concurrent modifications to ensure consistency. If null, the resource is not locked.
null
Task state
Bare metal server state
active, building, deleted, error, paused, rescued, resized, shelved, shelved_offloaded, soft-deleted, stopped, suspended "active"
Was this page helpful?