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
)
logs_uploader_target = client.cdn.logs_uploader.targets.create(
config={
"access_key_id": "access_key_id",
"bucket_name": "bucket_name",
"endpoint": "endpoint",
"region": "region",
"secret_access_key": "secret_access_key",
},
storage_type="s3_gcore",
)
print(logs_uploader_target.id)package main
import (
"context"
"fmt"
"github.com/G-Core/gcore-go"
"github.com/G-Core/gcore-go/cdn"
"github.com/G-Core/gcore-go/option"
)
func main() {
client := gcore.NewClient(
option.WithAPIKey("My API Key"),
)
logsUploaderTarget, err := client.CDN.LogsUploader.Targets.New(context.TODO(), cdn.LogsUploaderTargetNewParams{
Config: cdn.LogsUploaderTargetNewParamsConfigUnion{
OfS3GcoreConfig: &cdn.LogsUploaderTargetNewParamsConfigS3GcoreConfig{
AccessKeyID: "access_key_id",
BucketName: "bucket_name",
Endpoint: "endpoint",
Region: "region",
SecretAccessKey: "secret_access_key",
},
},
StorageType: cdn.LogsUploaderTargetNewParamsStorageTypeS3Gcore,
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", logsUploaderTarget.ID)
}
curl --request POST \
--url https://api.gcore.com/cdn/logs_uploader/targets \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"config": {
"access_key_id": "<string>",
"secret_access_key": "<string>",
"region": "<string>",
"bucket_name": "<string>",
"endpoint": "<string>",
"directory": "<string>",
"use_path_style": true
},
"name": "Target",
"description": "<string>"
}
'const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
config: {
access_key_id: '<string>',
secret_access_key: '<string>',
region: '<string>',
bucket_name: '<string>',
endpoint: '<string>',
directory: '<string>',
use_path_style: true
},
name: 'Target',
description: '<string>'
})
};
fetch('https://api.gcore.com/cdn/logs_uploader/targets', 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/cdn/logs_uploader/targets",
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([
'config' => [
'access_key_id' => '<string>',
'secret_access_key' => '<string>',
'region' => '<string>',
'bucket_name' => '<string>',
'endpoint' => '<string>',
'directory' => '<string>',
'use_path_style' => true
],
'name' => 'Target',
'description' => '<string>'
]),
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/cdn/logs_uploader/targets")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"config\": {\n \"access_key_id\": \"<string>\",\n \"secret_access_key\": \"<string>\",\n \"region\": \"<string>\",\n \"bucket_name\": \"<string>\",\n \"endpoint\": \"<string>\",\n \"directory\": \"<string>\",\n \"use_path_style\": true\n },\n \"name\": \"Target\",\n \"description\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gcore.com/cdn/logs_uploader/targets")
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 \"config\": {\n \"access_key_id\": \"<string>\",\n \"secret_access_key\": \"<string>\",\n \"region\": \"<string>\",\n \"bucket_name\": \"<string>\",\n \"endpoint\": \"<string>\",\n \"directory\": \"<string>\",\n \"use_path_style\": true\n },\n \"name\": \"Target\",\n \"description\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": 123,
"client_id": 123,
"created": "2023-11-07T05:31:56Z",
"updated": "2023-11-07T05:31:56Z",
"name": "<string>",
"description": "<string>",
"related_uploader_configs": [
123
],
"status": {
"code": 123,
"updated": "2023-11-07T05:31:56Z",
"details": "<string>"
},
"config": {
"access_key_id": "<string>",
"region": "<string>",
"bucket_name": "<string>",
"directory": "<string>",
"endpoint": "<string>",
"use_path_style": true
}
}Logs uploader
Create target
Create logs uploader target.
POST
/
cdn
/
logs_uploader
/
targets
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
)
logs_uploader_target = client.cdn.logs_uploader.targets.create(
config={
"access_key_id": "access_key_id",
"bucket_name": "bucket_name",
"endpoint": "endpoint",
"region": "region",
"secret_access_key": "secret_access_key",
},
storage_type="s3_gcore",
)
print(logs_uploader_target.id)package main
import (
"context"
"fmt"
"github.com/G-Core/gcore-go"
"github.com/G-Core/gcore-go/cdn"
"github.com/G-Core/gcore-go/option"
)
func main() {
client := gcore.NewClient(
option.WithAPIKey("My API Key"),
)
logsUploaderTarget, err := client.CDN.LogsUploader.Targets.New(context.TODO(), cdn.LogsUploaderTargetNewParams{
Config: cdn.LogsUploaderTargetNewParamsConfigUnion{
OfS3GcoreConfig: &cdn.LogsUploaderTargetNewParamsConfigS3GcoreConfig{
AccessKeyID: "access_key_id",
BucketName: "bucket_name",
Endpoint: "endpoint",
Region: "region",
SecretAccessKey: "secret_access_key",
},
},
StorageType: cdn.LogsUploaderTargetNewParamsStorageTypeS3Gcore,
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", logsUploaderTarget.ID)
}
curl --request POST \
--url https://api.gcore.com/cdn/logs_uploader/targets \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"config": {
"access_key_id": "<string>",
"secret_access_key": "<string>",
"region": "<string>",
"bucket_name": "<string>",
"endpoint": "<string>",
"directory": "<string>",
"use_path_style": true
},
"name": "Target",
"description": "<string>"
}
'const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
config: {
access_key_id: '<string>',
secret_access_key: '<string>',
region: '<string>',
bucket_name: '<string>',
endpoint: '<string>',
directory: '<string>',
use_path_style: true
},
name: 'Target',
description: '<string>'
})
};
fetch('https://api.gcore.com/cdn/logs_uploader/targets', 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/cdn/logs_uploader/targets",
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([
'config' => [
'access_key_id' => '<string>',
'secret_access_key' => '<string>',
'region' => '<string>',
'bucket_name' => '<string>',
'endpoint' => '<string>',
'directory' => '<string>',
'use_path_style' => true
],
'name' => 'Target',
'description' => '<string>'
]),
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/cdn/logs_uploader/targets")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"config\": {\n \"access_key_id\": \"<string>\",\n \"secret_access_key\": \"<string>\",\n \"region\": \"<string>\",\n \"bucket_name\": \"<string>\",\n \"endpoint\": \"<string>\",\n \"directory\": \"<string>\",\n \"use_path_style\": true\n },\n \"name\": \"Target\",\n \"description\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gcore.com/cdn/logs_uploader/targets")
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 \"config\": {\n \"access_key_id\": \"<string>\",\n \"secret_access_key\": \"<string>\",\n \"region\": \"<string>\",\n \"bucket_name\": \"<string>\",\n \"endpoint\": \"<string>\",\n \"directory\": \"<string>\",\n \"use_path_style\": true\n },\n \"name\": \"Target\",\n \"description\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": 123,
"client_id": 123,
"created": "2023-11-07T05:31:56Z",
"updated": "2023-11-07T05:31:56Z",
"name": "<string>",
"description": "<string>",
"related_uploader_configs": [
123
],
"status": {
"code": 123,
"updated": "2023-11-07T05:31:56Z",
"details": "<string>"
},
"config": {
"access_key_id": "<string>",
"region": "<string>",
"bucket_name": "<string>",
"directory": "<string>",
"endpoint": "<string>",
"use_path_style": true
}
}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
Type of storage for logs.
Available options:
s3_gcore, s3_amazon, s3_oss, s3_other, s3_v1, ftp, sftp, http, azure_blob Config for specific storage type.
- S3 Gcore Config
- S3 Amazon Config
- S3 OSS Config
- S3 Other Config
- S3 V1 Config
- FTP Config
- SFTP Config
- HTTP Config
- Azure Blob Config
Show child attributes
Show child attributes
Name of the target.
Maximum string length:
255Description of the target.
Maximum string length:
255Response
Successful.
Client that owns the target.
Time when logs uploader target was created.
Time when logs uploader target was updated.
Type of storage for logs.
Available options:
s3_gcore, s3_amazon, s3_oss, s3_other, s3_v1, ftp, sftp, http, azure_blob Name of the target.
Maximum string length:
255Description of the target.
Maximum string length:
255List of logs uploader configs that use this target.
Validation status of the logs uploader target. Informs if the specified target is reachable.
Show child attributes
Show child attributes
Config for specific storage type.
- S3 Gcore Config
- S3 Amazon Config
- S3 OSS Config
- S3 Other Config
- S3 V1 Config
- FTP Config
- SFTP Config
- HTTP Config
- Azure Blob Config
Show child attributes
Show child attributes
Was this page helpful?
⌘I