import os
from gcore import Gcore
client = Gcore(
api_key=os.environ.get("GCORE_API_KEY"), # This is the default and can be omitted
)
secret = client.cloud.secrets.get(
secret_id="bfc7824b-31b6-4a28-a0c4-7df137139215",
project_id=1,
region_id=1,
)
print(secret.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"),
)
secret, err := client.Cloud.Secrets.Get(
context.TODO(),
"bfc7824b-31b6-4a28-a0c4-7df137139215",
cloud.SecretGetParams{
ProjectID: gcore.Int(1),
RegionID: gcore.Int(1),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", secret.ID)
}
curl --request GET \
--url https://api.gcore.com/cloud/v1/secrets/{project_id}/{region_id}/{secret_id} \
--header 'Authorization: <api-key>'const options = {method: 'GET', headers: {Authorization: '<api-key>'}};
fetch('https://api.gcore.com/cloud/v1/secrets/{project_id}/{region_id}/{secret_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/secrets/{project_id}/{region_id}/{secret_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/secrets/{project_id}/{region_id}/{secret_id}")
.header("Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gcore.com/cloud/v1/secrets/{project_id}/{region_id}/{secret_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{
"id": "bfc7824b-31b6-4a28-a0c4-7df137139215",
"name": "AES key",
"secret_type": "opaque",
"status": "ACTIVE",
"algorithm": "aes",
"bit_length": 256,
"content_types": {
"default": "application/octet-stream"
},
"created": "2023-03-23T20:00:00+00:00",
"expiration": "2023-06-23T20:00:00+00:00",
"mode": "cbc"
}Get secret
import os
from gcore import Gcore
client = Gcore(
api_key=os.environ.get("GCORE_API_KEY"), # This is the default and can be omitted
)
secret = client.cloud.secrets.get(
secret_id="bfc7824b-31b6-4a28-a0c4-7df137139215",
project_id=1,
region_id=1,
)
print(secret.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"),
)
secret, err := client.Cloud.Secrets.Get(
context.TODO(),
"bfc7824b-31b6-4a28-a0c4-7df137139215",
cloud.SecretGetParams{
ProjectID: gcore.Int(1),
RegionID: gcore.Int(1),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", secret.ID)
}
curl --request GET \
--url https://api.gcore.com/cloud/v1/secrets/{project_id}/{region_id}/{secret_id} \
--header 'Authorization: <api-key>'const options = {method: 'GET', headers: {Authorization: '<api-key>'}};
fetch('https://api.gcore.com/cloud/v1/secrets/{project_id}/{region_id}/{secret_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/secrets/{project_id}/{region_id}/{secret_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/secrets/{project_id}/{region_id}/{secret_id}")
.header("Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gcore.com/cloud/v1/secrets/{project_id}/{region_id}/{secret_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{
"id": "bfc7824b-31b6-4a28-a0c4-7df137139215",
"name": "AES key",
"secret_type": "opaque",
"status": "ACTIVE",
"algorithm": "aes",
"bit_length": 256,
"content_types": {
"default": "application/octet-stream"
},
"created": "2023-03-23T20:00:00+00:00",
"expiration": "2023-06-23T20:00:00+00:00",
"mode": "cbc"
}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
Secret ID
"bfc7824b-31b6-4a28-a0c4-7df137139215"
Response
OK
Secret uuid
"bfc7824b-31b6-4a28-a0c4-7df137139215"
Secret name
"AES key"
Secret type, base64 encoded. symmetric - Used for storing byte arrays such as keys suitable for symmetric encryption; public - Used for storing the public key of an asymmetric keypair; private - Used for storing the private key of an asymmetric keypair; passphrase - Used for storing plain text passphrases; certificate - Used for storing cryptographic certificates such as X.509 certificates; opaque - Used for backwards compatibility with previous versions of the API
certificate, opaque, passphrase, private, public, symmetric "opaque"
Status
"ACTIVE"
Metadata provided by a user or system for informational purposes. Defaults to None
"aes"
Metadata provided by a user or system for informational purposes. Value must be greater than zero. Defaults to None
256
Describes the content-types that can be used to retrieve the payload. The content-type used with symmetric secrets is application/octet-stream
Show child attributes
Show child attributes
{ "default": "application/octet-stream" }
Datetime when the secret was created. The format is 2020-01-01T12:00:00+00:00
"2023-03-23T20:00:00+00:00"
Datetime when the secret will expire. The format is 2020-01-01T12:00:00+00:00. Defaults to None
"2023-06-23T20:00:00+00:00"
Metadata provided by a user or system for informational purposes. Defaults to None
"cbc"
Was this page helpful?