Create endpoint access key
curl --request POST \
--url https://storage.nks.europe-west4.nscale.com/api/v1/objectstorageendpoints/{objectStorageEndpointID}/accesskeys \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"metadata": {
"name": "bucket-admin-key",
"description": "Access key for bucket administration"
},
"spec": {
"identityPolicy": "bucket-admin"
}
}
'import requests
url = "https://storage.nks.europe-west4.nscale.com/api/v1/objectstorageendpoints/{objectStorageEndpointID}/accesskeys"
payload = {
"metadata": {
"name": "bucket-admin-key",
"description": "Access key for bucket administration"
},
"spec": { "identityPolicy": "bucket-admin" }
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
metadata: {name: 'bucket-admin-key', description: 'Access key for bucket administration'},
spec: {identityPolicy: 'bucket-admin'}
})
};
fetch('https://storage.nks.europe-west4.nscale.com/api/v1/objectstorageendpoints/{objectStorageEndpointID}/accesskeys', 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://storage.nks.europe-west4.nscale.com/api/v1/objectstorageendpoints/{objectStorageEndpointID}/accesskeys",
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([
'metadata' => [
'name' => 'bucket-admin-key',
'description' => 'Access key for bucket administration'
],
'spec' => [
'identityPolicy' => 'bucket-admin'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://storage.nks.europe-west4.nscale.com/api/v1/objectstorageendpoints/{objectStorageEndpointID}/accesskeys"
payload := strings.NewReader("{\n \"metadata\": {\n \"name\": \"bucket-admin-key\",\n \"description\": \"Access key for bucket administration\"\n },\n \"spec\": {\n \"identityPolicy\": \"bucket-admin\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://storage.nks.europe-west4.nscale.com/api/v1/objectstorageendpoints/{objectStorageEndpointID}/accesskeys")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"metadata\": {\n \"name\": \"bucket-admin-key\",\n \"description\": \"Access key for bucket administration\"\n },\n \"spec\": {\n \"identityPolicy\": \"bucket-admin\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://storage.nks.europe-west4.nscale.com/api/v1/objectstorageendpoints/{objectStorageEndpointID}/accesskeys")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"metadata\": {\n \"name\": \"bucket-admin-key\",\n \"description\": \"Access key for bucket administration\"\n },\n \"spec\": {\n \"identityPolicy\": \"bucket-admin\"\n }\n}"
response = http.request(request)
puts response.read_body{
"metadata": {
"id": "4c1de9c4-8d6c-4b32-8413-42e0b070d5d4",
"name": "bucket-admin-key",
"organizationId": "9a8c6370-4065-4d4a-9da0-7678df40cd9d",
"projectId": "e36c058a-8eba-4f5b-91f4-f6ffb983795c",
"creationTime": "2024-05-31T14:11:00Z",
"createdBy": "john.doe@acme.com",
"provisioningStatus": "provisioned",
"healthStatus": "healthy"
},
"spec": {
"identityPolicy": "bucket-admin",
"accessKeyId": "AKIAIOSFODNN7EXAMPLE",
"secret": "..."
}
}{
"error": "invalid_request",
"error_description": "request body invalid",
"trace_id": "57bc14d9bd461f0b5a72db830149b67a"
}{
"error": "access_denied",
"error_description": "authentication failed",
"trace_id": "57bc14d9bd461f0b5a72db830149b67a"
}{
"error": "forbidden",
"error_description": "user credentials do not have the required privileges",
"trace_id": "57bc14d9bd461f0b5a72db830149b67a"
}{
"error": "not_found",
"error_description": "the requested resource does not exist",
"trace_id": "57bc14d9bd461f0b5a72db830149b67a"
}{
"error": "unprocessable_content",
"error_description": "the request body was in the wrong format",
"trace_id": "57bc14d9bd461f0b5a72db830149b67a"
}{
"error": "server_error",
"error_description": "failed to token claim",
"trace_id": "57bc14d9bd461f0b5a72db830149b67a"
}Object storage
Create endpoint access key
Creates an access key for the specified object storage endpoint. The server generates the immutable access key identifier and secret. The secret is returned only once in the create response.
POST
/
api
/
v1
/
objectstorageendpoints
/
{objectStorageEndpointID}
/
accesskeys
Create endpoint access key
curl --request POST \
--url https://storage.nks.europe-west4.nscale.com/api/v1/objectstorageendpoints/{objectStorageEndpointID}/accesskeys \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"metadata": {
"name": "bucket-admin-key",
"description": "Access key for bucket administration"
},
"spec": {
"identityPolicy": "bucket-admin"
}
}
'import requests
url = "https://storage.nks.europe-west4.nscale.com/api/v1/objectstorageendpoints/{objectStorageEndpointID}/accesskeys"
payload = {
"metadata": {
"name": "bucket-admin-key",
"description": "Access key for bucket administration"
},
"spec": { "identityPolicy": "bucket-admin" }
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
metadata: {name: 'bucket-admin-key', description: 'Access key for bucket administration'},
spec: {identityPolicy: 'bucket-admin'}
})
};
fetch('https://storage.nks.europe-west4.nscale.com/api/v1/objectstorageendpoints/{objectStorageEndpointID}/accesskeys', 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://storage.nks.europe-west4.nscale.com/api/v1/objectstorageendpoints/{objectStorageEndpointID}/accesskeys",
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([
'metadata' => [
'name' => 'bucket-admin-key',
'description' => 'Access key for bucket administration'
],
'spec' => [
'identityPolicy' => 'bucket-admin'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://storage.nks.europe-west4.nscale.com/api/v1/objectstorageendpoints/{objectStorageEndpointID}/accesskeys"
payload := strings.NewReader("{\n \"metadata\": {\n \"name\": \"bucket-admin-key\",\n \"description\": \"Access key for bucket administration\"\n },\n \"spec\": {\n \"identityPolicy\": \"bucket-admin\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://storage.nks.europe-west4.nscale.com/api/v1/objectstorageendpoints/{objectStorageEndpointID}/accesskeys")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"metadata\": {\n \"name\": \"bucket-admin-key\",\n \"description\": \"Access key for bucket administration\"\n },\n \"spec\": {\n \"identityPolicy\": \"bucket-admin\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://storage.nks.europe-west4.nscale.com/api/v1/objectstorageendpoints/{objectStorageEndpointID}/accesskeys")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"metadata\": {\n \"name\": \"bucket-admin-key\",\n \"description\": \"Access key for bucket administration\"\n },\n \"spec\": {\n \"identityPolicy\": \"bucket-admin\"\n }\n}"
response = http.request(request)
puts response.read_body{
"metadata": {
"id": "4c1de9c4-8d6c-4b32-8413-42e0b070d5d4",
"name": "bucket-admin-key",
"organizationId": "9a8c6370-4065-4d4a-9da0-7678df40cd9d",
"projectId": "e36c058a-8eba-4f5b-91f4-f6ffb983795c",
"creationTime": "2024-05-31T14:11:00Z",
"createdBy": "john.doe@acme.com",
"provisioningStatus": "provisioned",
"healthStatus": "healthy"
},
"spec": {
"identityPolicy": "bucket-admin",
"accessKeyId": "AKIAIOSFODNN7EXAMPLE",
"secret": "..."
}
}{
"error": "invalid_request",
"error_description": "request body invalid",
"trace_id": "57bc14d9bd461f0b5a72db830149b67a"
}{
"error": "access_denied",
"error_description": "authentication failed",
"trace_id": "57bc14d9bd461f0b5a72db830149b67a"
}{
"error": "forbidden",
"error_description": "user credentials do not have the required privileges",
"trace_id": "57bc14d9bd461f0b5a72db830149b67a"
}{
"error": "not_found",
"error_description": "the requested resource does not exist",
"trace_id": "57bc14d9bd461f0b5a72db830149b67a"
}{
"error": "unprocessable_content",
"error_description": "the request body was in the wrong format",
"trace_id": "57bc14d9bd461f0b5a72db830149b67a"
}{
"error": "server_error",
"error_description": "failed to token claim",
"trace_id": "57bc14d9bd461f0b5a72db830149b67a"
}Authorizations
Operation requires OAuth 2.0 bearer token authentication.
Path Parameters
The object storage endpoint unique identifier. A Kubernetes name. Must be a valid DNS containing only lower case characters, numbers or hyphens, start and end with a character or number, and be at most 63 characters in length.
Required string length:
1 - 63Body
application/json
A request to create an object storage access key.
Response
A newly created object storage access key. The generated secret is returned only once.
Was this page helpful?
⌘I