Python
import os
from gcore import Gcore
client = Gcore(
api_key=os.environ.get("GCORE_API_KEY"), # This is the default and can be omitted
)
registry = client.cloud.registries.create(
project_id=0,
region_id=0,
name="reg-home1",
)
print(registry.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"),
)
registry, err := client.Cloud.Registries.New(context.TODO(), cloud.RegistryNewParams{
ProjectID: gcore.Int(0),
RegionID: gcore.Int(0),
Name: "reg-home1",
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", registry.ID)
}
curl --request POST \
--url https://api.gcore.com/cloud/v1/registries/{project_id}/{region_id} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "reg-home1",
"storage_limit": 5
}
'const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: 'reg-home1', storage_limit: 5})
};
fetch('https://api.gcore.com/cloud/v1/registries/{project_id}/{region_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/registries/{project_id}/{region_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'reg-home1',
'storage_limit' => 5
]),
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.post("https://api.gcore.com/cloud/v1/registries/{project_id}/{region_id}")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"reg-home1\",\n \"storage_limit\": 5\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gcore.com/cloud/v1/registries/{project_id}/{region_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"reg-home1\",\n \"storage_limit\": 5\n}"
response = http.request(request)
puts response.read_body{
"created_at": "2024-06-18T09:36:53.335000Z",
"id": 1,
"name": "company-name",
"repo_count": 1,
"storage_limit": 5,
"storage_used": 1000000000,
"updated_at": "2024-06-18T09:36:53.335000Z",
"url": "<string>"
}Registry
Create registry
Create a new container registry with the specified configuration.
POST
/
cloud
/
v1
/
registries
/
{project_id}
/
{region_id}
Python
import os
from gcore import Gcore
client = Gcore(
api_key=os.environ.get("GCORE_API_KEY"), # This is the default and can be omitted
)
registry = client.cloud.registries.create(
project_id=0,
region_id=0,
name="reg-home1",
)
print(registry.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"),
)
registry, err := client.Cloud.Registries.New(context.TODO(), cloud.RegistryNewParams{
ProjectID: gcore.Int(0),
RegionID: gcore.Int(0),
Name: "reg-home1",
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", registry.ID)
}
curl --request POST \
--url https://api.gcore.com/cloud/v1/registries/{project_id}/{region_id} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "reg-home1",
"storage_limit": 5
}
'const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: 'reg-home1', storage_limit: 5})
};
fetch('https://api.gcore.com/cloud/v1/registries/{project_id}/{region_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/registries/{project_id}/{region_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'reg-home1',
'storage_limit' => 5
]),
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.post("https://api.gcore.com/cloud/v1/registries/{project_id}/{region_id}")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"reg-home1\",\n \"storage_limit\": 5\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gcore.com/cloud/v1/registries/{project_id}/{region_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"reg-home1\",\n \"storage_limit\": 5\n}"
response = http.request(request)
puts response.read_body{
"created_at": "2024-06-18T09:36:53.335000Z",
"id": 1,
"name": "company-name",
"repo_count": 1,
"storage_limit": 5,
"storage_used": 1000000000,
"updated_at": "2024-06-18T09:36:53.335000Z",
"url": "<string>"
}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
Body
application/json
A name for the container registry.
Should be in lowercase, consisting only of numbers, letters and -,
with maximum length of 24 characters
Pattern:
^[a-z][-a-z0-9]{0,22}[a-z0-9]$Example:
"reg-home1"
Registry storage limit, GiB
Required range:
1 <= x <= 1000Example:
5
Response
Created registry details
Registry creation date-time
Example:
"2024-06-18T09:36:53.335000Z"
Registry ID
Example:
1
Registry name
Example:
"company-name"
Number of repositories in the registry
Example:
1
Registry storage limit, GiB
Example:
5
Registry storage used, bytes
Example:
1000000000
Registry modification date-time
Example:
"2024-06-18T09:36:53.335000Z"
Registry url
Was this page helpful?