curl --request POST \
--url https://use.hoop.dev/api/dbroles/jobs \
--header 'Content-Type: */*' \
--data '
{
"agent_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"aws": {
"instance_arn": "arn:aws:rds:us-west-2:123456789012:db:my-instance"
},
"connection_prefix_name": "prod-postgres-",
"job_steps": [
"create-connections",
"send-webhook"
]
}
'import requests
url = "https://use.hoop.dev/api/dbroles/jobs"
payload = {
"agent_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"aws": { "instance_arn": "arn:aws:rds:us-west-2:123456789012:db:my-instance" },
"connection_prefix_name": "prod-postgres-",
"job_steps": ["create-connections", "send-webhook"]
}
headers = {"Content-Type": "*/*"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': '*/*'},
body: JSON.stringify({
agent_id: 'a1b2c3d4-e5f6-7890-abcd-ef1234567890',
aws: {instance_arn: 'arn:aws:rds:us-west-2:123456789012:db:my-instance'},
connection_prefix_name: 'prod-postgres-',
job_steps: ['create-connections', 'send-webhook']
})
};
fetch('https://use.hoop.dev/api/dbroles/jobs', 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://use.hoop.dev/api/dbroles/jobs",
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([
'agent_id' => 'a1b2c3d4-e5f6-7890-abcd-ef1234567890',
'aws' => [
'instance_arn' => 'arn:aws:rds:us-west-2:123456789012:db:my-instance'
],
'connection_prefix_name' => 'prod-postgres-',
'job_steps' => [
'create-connections',
'send-webhook'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: */*"
],
]);
$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://use.hoop.dev/api/dbroles/jobs"
payload := strings.NewReader("{\n \"agent_id\": \"a1b2c3d4-e5f6-7890-abcd-ef1234567890\",\n \"aws\": {\n \"instance_arn\": \"arn:aws:rds:us-west-2:123456789012:db:my-instance\"\n },\n \"connection_prefix_name\": \"prod-postgres-\",\n \"job_steps\": [\n \"create-connections\",\n \"send-webhook\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "*/*")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://use.hoop.dev/api/dbroles/jobs")
.header("Content-Type", "*/*")
.body("{\n \"agent_id\": \"a1b2c3d4-e5f6-7890-abcd-ef1234567890\",\n \"aws\": {\n \"instance_arn\": \"arn:aws:rds:us-west-2:123456789012:db:my-instance\"\n },\n \"connection_prefix_name\": \"prod-postgres-\",\n \"job_steps\": [\n \"create-connections\",\n \"send-webhook\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://use.hoop.dev/api/dbroles/jobs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = '*/*'
request.body = "{\n \"agent_id\": \"a1b2c3d4-e5f6-7890-abcd-ef1234567890\",\n \"aws\": {\n \"instance_arn\": \"arn:aws:rds:us-west-2:123456789012:db:my-instance\"\n },\n \"connection_prefix_name\": \"prod-postgres-\",\n \"job_steps\": [\n \"create-connections\",\n \"send-webhook\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"job_id": "8F680C64-DBFD-48E1-9855-6650D9CAD62C"
}{
"message": "the error description"
}{
"message": "the error description"
}Create Database Role Job
It creates a job that performs the provisioning of default database roles
curl --request POST \
--url https://use.hoop.dev/api/dbroles/jobs \
--header 'Content-Type: */*' \
--data '
{
"agent_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"aws": {
"instance_arn": "arn:aws:rds:us-west-2:123456789012:db:my-instance"
},
"connection_prefix_name": "prod-postgres-",
"job_steps": [
"create-connections",
"send-webhook"
]
}
'import requests
url = "https://use.hoop.dev/api/dbroles/jobs"
payload = {
"agent_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"aws": { "instance_arn": "arn:aws:rds:us-west-2:123456789012:db:my-instance" },
"connection_prefix_name": "prod-postgres-",
"job_steps": ["create-connections", "send-webhook"]
}
headers = {"Content-Type": "*/*"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': '*/*'},
body: JSON.stringify({
agent_id: 'a1b2c3d4-e5f6-7890-abcd-ef1234567890',
aws: {instance_arn: 'arn:aws:rds:us-west-2:123456789012:db:my-instance'},
connection_prefix_name: 'prod-postgres-',
job_steps: ['create-connections', 'send-webhook']
})
};
fetch('https://use.hoop.dev/api/dbroles/jobs', 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://use.hoop.dev/api/dbroles/jobs",
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([
'agent_id' => 'a1b2c3d4-e5f6-7890-abcd-ef1234567890',
'aws' => [
'instance_arn' => 'arn:aws:rds:us-west-2:123456789012:db:my-instance'
],
'connection_prefix_name' => 'prod-postgres-',
'job_steps' => [
'create-connections',
'send-webhook'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: */*"
],
]);
$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://use.hoop.dev/api/dbroles/jobs"
payload := strings.NewReader("{\n \"agent_id\": \"a1b2c3d4-e5f6-7890-abcd-ef1234567890\",\n \"aws\": {\n \"instance_arn\": \"arn:aws:rds:us-west-2:123456789012:db:my-instance\"\n },\n \"connection_prefix_name\": \"prod-postgres-\",\n \"job_steps\": [\n \"create-connections\",\n \"send-webhook\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "*/*")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://use.hoop.dev/api/dbroles/jobs")
.header("Content-Type", "*/*")
.body("{\n \"agent_id\": \"a1b2c3d4-e5f6-7890-abcd-ef1234567890\",\n \"aws\": {\n \"instance_arn\": \"arn:aws:rds:us-west-2:123456789012:db:my-instance\"\n },\n \"connection_prefix_name\": \"prod-postgres-\",\n \"job_steps\": [\n \"create-connections\",\n \"send-webhook\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://use.hoop.dev/api/dbroles/jobs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = '*/*'
request.body = "{\n \"agent_id\": \"a1b2c3d4-e5f6-7890-abcd-ef1234567890\",\n \"aws\": {\n \"instance_arn\": \"arn:aws:rds:us-west-2:123456789012:db:my-instance\"\n },\n \"connection_prefix_name\": \"prod-postgres-\",\n \"job_steps\": [\n \"create-connections\",\n \"send-webhook\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"job_id": "8F680C64-DBFD-48E1-9855-6650D9CAD62C"
}{
"message": "the error description"
}{
"message": "the error description"
}Body
The request body resource
Unique identifier of the agent hosting the database resource
36"a1b2c3d4-e5f6-7890-abcd-ef1234567890"
AWS-specific configuration for the database role creation job
Show child attributes
Show child attributes
Base prefix for connection names - the role name will be appended to this prefix when creating the database connection (e.g., "prod-postgres-ro")
"prod-postgres-"
The additional steps to execute
create-connections, send-webhook ["create-connections", "send-webhook"]Vault Provider uses HashiCorp Vault to store the provisioned credentials. The target agent must be configured with the Vault Credentials in order for this operation to work
Show child attributes
Show child attributes
Response
Accepted
Unique identifier for the asynchronous job that will create the database role
"8F680C64-DBFD-48E1-9855-6650D9CAD62C"
Was this page helpful?