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_config = client.cdn.logs_uploader.configs.replace(
id=0,
name="name",
policy=0,
target=0,
)
print(logs_uploader_config.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"),
)
logsUploaderConfig, err := client.CDN.LogsUploader.Configs.Replace(
context.TODO(),
0,
cdn.LogsUploaderConfigReplaceParams{
Name: "name",
Policy: 0,
Target: 0,
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", logsUploaderConfig.ID)
}
curl --request PUT \
--url https://api.gcore.com/cdn/logs_uploader/configs/{id} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"policy": 123,
"target": 123,
"enabled": true,
"for_all_resources": false,
"resources": [
123
],
"for_all_clients": false,
"clients": [
123
]
}
'const options = {
method: 'PUT',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
policy: 123,
target: 123,
enabled: true,
for_all_resources: false,
resources: [123],
for_all_clients: false,
clients: [123]
})
};
fetch('https://api.gcore.com/cdn/logs_uploader/configs/{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/cdn/logs_uploader/configs/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'policy' => 123,
'target' => 123,
'enabled' => true,
'for_all_resources' => false,
'resources' => [
123
],
'for_all_clients' => false,
'clients' => [
123
]
]),
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.put("https://api.gcore.com/cdn/logs_uploader/configs/{id}")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"policy\": 123,\n \"target\": 123,\n \"enabled\": true,\n \"for_all_resources\": false,\n \"resources\": [\n 123\n ],\n \"for_all_clients\": false,\n \"clients\": [\n 123\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gcore.com/cdn/logs_uploader/configs/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"policy\": 123,\n \"target\": 123,\n \"enabled\": true,\n \"for_all_resources\": false,\n \"resources\": [\n 123\n ],\n \"for_all_clients\": false,\n \"clients\": [\n 123\n ]\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",
"enabled": true,
"name": "<string>",
"policy": 123,
"target": 123,
"for_all_resources": true,
"resources": [
123
],
"status": {
"status": "in_progress",
"code": 123,
"updated": "2023-11-07T05:31:56Z",
"details": "<string>"
},
"for_all_clients": true,
"clients": [
123
]
}Change config
Change logs uploader config.
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_config = client.cdn.logs_uploader.configs.replace(
id=0,
name="name",
policy=0,
target=0,
)
print(logs_uploader_config.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"),
)
logsUploaderConfig, err := client.CDN.LogsUploader.Configs.Replace(
context.TODO(),
0,
cdn.LogsUploaderConfigReplaceParams{
Name: "name",
Policy: 0,
Target: 0,
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", logsUploaderConfig.ID)
}
curl --request PUT \
--url https://api.gcore.com/cdn/logs_uploader/configs/{id} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"policy": 123,
"target": 123,
"enabled": true,
"for_all_resources": false,
"resources": [
123
],
"for_all_clients": false,
"clients": [
123
]
}
'const options = {
method: 'PUT',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
policy: 123,
target: 123,
enabled: true,
for_all_resources: false,
resources: [123],
for_all_clients: false,
clients: [123]
})
};
fetch('https://api.gcore.com/cdn/logs_uploader/configs/{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/cdn/logs_uploader/configs/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'policy' => 123,
'target' => 123,
'enabled' => true,
'for_all_resources' => false,
'resources' => [
123
],
'for_all_clients' => false,
'clients' => [
123
]
]),
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.put("https://api.gcore.com/cdn/logs_uploader/configs/{id}")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"policy\": 123,\n \"target\": 123,\n \"enabled\": true,\n \"for_all_resources\": false,\n \"resources\": [\n 123\n ],\n \"for_all_clients\": false,\n \"clients\": [\n 123\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gcore.com/cdn/logs_uploader/configs/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"policy\": 123,\n \"target\": 123,\n \"enabled\": true,\n \"for_all_resources\": false,\n \"resources\": [\n 123\n ],\n \"for_all_clients\": false,\n \"clients\": [\n 123\n ]\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",
"enabled": true,
"name": "<string>",
"policy": 123,
"target": 123,
"for_all_resources": true,
"resources": [
123
],
"status": {
"status": "in_progress",
"code": 123,
"updated": "2023-11-07T05:31:56Z",
"details": "<string>"
},
"for_all_clients": true,
"clients": [
123
]
}Authorizations
Body
Reseller-specific scoping fields. for_all_clients (sub-clients only) and
for_all_resources (tech-client only) cover orthogonal scopes and can be
combined. Only for_all_clients ↔ clients and for_all_resources ↔ resources
are mutually exclusive.
If set to true, the config will be applied to all resources of every
sub-client under the reseller. Resources owned directly by the reseller's
own tech-client are not matched — use for_all_resources (additionally or
instead) to cover the tech-client's resources.
Mutually exclusive with clients.
Response
Successful.
Reseller-specific scoping fields. for_all_clients (sub-clients only) and
for_all_resources (tech-client only) cover orthogonal scopes and can be
combined. Only for_all_clients ↔ clients and for_all_resources ↔ resources
are mutually exclusive.
If set to true, the config will be applied to all resources of every
sub-client under the reseller. Resources owned directly by the reseller's
own tech-client are not matched — use for_all_resources (additionally or
instead) to cover the tech-client's resources.
Mutually exclusive with clients.
Was this page helpful?