import os
from gcore import Gcore
client = Gcore(
api_key=os.environ.get("GCORE_API_KEY"), # This is the default and can be omitted
)
router = client.cloud.networks.routers.get(
router_id="ccd5b925-e35c-4611-a511-67ab503104c8",
project_id=1,
region_id=1,
)
print(router.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"),
)
router, err := client.Cloud.Networks.Routers.Get(
context.TODO(),
"ccd5b925-e35c-4611-a511-67ab503104c8",
cloud.NetworkRouterGetParams{
ProjectID: gcore.Int(1),
RegionID: gcore.Int(1),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", router.ID)
}
curl --request GET \
--url https://api.gcore.com/cloud/v1/routers/{project_id}/{region_id}/{router_id} \
--header 'Authorization: <api-key>'const options = {method: 'GET', headers: {Authorization: '<api-key>'}};
fetch('https://api.gcore.com/cloud/v1/routers/{project_id}/{region_id}/{router_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/routers/{project_id}/{region_id}/{router_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.get("https://api.gcore.com/cloud/v1/routers/{project_id}/{region_id}/{router_id}")
.header("Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gcore.com/cloud/v1/routers/{project_id}/{region_id}/{router_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"created_at": "2023-11-07T05:31:56Z",
"creator_task_id": "<string>",
"distributed": true,
"external_gateway_info": {
"enable_snat": true,
"external_fixed_ips": [
{
"ip_address": "172.24.4.6",
"subnet_id": "b930d7f6-ceb7-40a0-8b81-a425dd994ccf"
}
],
"network_id": "ae34051f-aa6c-4c75-abf5-50dc9ac99ef3"
},
"id": "<string>",
"interfaces": [
{
"ip_assignments": [
{
"ip_address": "192.168.123.20",
"subnet_id": "351b0dd7-ca09-431c-be53-935db3785067"
},
{
"ip_address": "192.168.120.16",
"subnet_id": "0a641ef8-62dc-4146-91e5-6ab4b464df6d"
}
],
"mac_address": "00:16:3e:f2:87:16",
"network_id": "bc688791-f1b0-44eb-97d4-07697294b1e1",
"port_id": "1f0ca628-a73b-42c0-bdac-7b10d023e097"
}
],
"name": "<string>",
"project_id": 1337,
"region": "Luxembourg 1",
"region_id": 7,
"routes": [
{
"destination": "10.0.3.0/24",
"nexthop": "10.0.0.13"
}
],
"status": "<string>",
"task_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z"
}Get router
Get detailed information about a specific router.
import os
from gcore import Gcore
client = Gcore(
api_key=os.environ.get("GCORE_API_KEY"), # This is the default and can be omitted
)
router = client.cloud.networks.routers.get(
router_id="ccd5b925-e35c-4611-a511-67ab503104c8",
project_id=1,
region_id=1,
)
print(router.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"),
)
router, err := client.Cloud.Networks.Routers.Get(
context.TODO(),
"ccd5b925-e35c-4611-a511-67ab503104c8",
cloud.NetworkRouterGetParams{
ProjectID: gcore.Int(1),
RegionID: gcore.Int(1),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", router.ID)
}
curl --request GET \
--url https://api.gcore.com/cloud/v1/routers/{project_id}/{region_id}/{router_id} \
--header 'Authorization: <api-key>'const options = {method: 'GET', headers: {Authorization: '<api-key>'}};
fetch('https://api.gcore.com/cloud/v1/routers/{project_id}/{region_id}/{router_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/routers/{project_id}/{region_id}/{router_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.get("https://api.gcore.com/cloud/v1/routers/{project_id}/{region_id}/{router_id}")
.header("Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gcore.com/cloud/v1/routers/{project_id}/{region_id}/{router_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"created_at": "2023-11-07T05:31:56Z",
"creator_task_id": "<string>",
"distributed": true,
"external_gateway_info": {
"enable_snat": true,
"external_fixed_ips": [
{
"ip_address": "172.24.4.6",
"subnet_id": "b930d7f6-ceb7-40a0-8b81-a425dd994ccf"
}
],
"network_id": "ae34051f-aa6c-4c75-abf5-50dc9ac99ef3"
},
"id": "<string>",
"interfaces": [
{
"ip_assignments": [
{
"ip_address": "192.168.123.20",
"subnet_id": "351b0dd7-ca09-431c-be53-935db3785067"
},
{
"ip_address": "192.168.120.16",
"subnet_id": "0a641ef8-62dc-4146-91e5-6ab4b464df6d"
}
],
"mac_address": "00:16:3e:f2:87:16",
"network_id": "bc688791-f1b0-44eb-97d4-07697294b1e1",
"port_id": "1f0ca628-a73b-42c0-bdac-7b10d023e097"
}
],
"name": "<string>",
"project_id": 1337,
"region": "Luxembourg 1",
"region_id": 7,
"routes": [
{
"destination": "10.0.3.0/24",
"nexthop": "10.0.0.13"
}
],
"status": "<string>",
"task_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z"
}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
Router ID
"ccd5b925-e35c-4611-a511-67ab503104c8"
Response
Router
Datetime when the router was created
Task that created this entity. Null when the router wasn't created via a tracked task.
Whether the router is distributed or centralized.
true
false
State of this router's external gateway. Null when the router has no external gateway.
Show child attributes
Show child attributes
Router ID
List of router interfaces.
Show child attributes
Show child attributes
Router name
Project ID
1337
Region name
"Luxembourg 1"
Region ID
7
List of custom routes.
Show child attributes
Show child attributes
Status of the router.
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.
Datetime when the router was last updated
Was this page helpful?