Update Machine Identity
curl --request PUT \
--url https://use.hoop.dev/api/machineidentities/{name} \
--header 'Content-Type: application/json' \
--data '
{
"name": "backend-prod",
"attributes": [
"env:prod",
"team:backend"
],
"connection_names": [
"prod-postgres",
"api-proxy"
],
"description": "Production backend service identity"
}
'import requests
url = "https://use.hoop.dev/api/machineidentities/{name}"
payload = {
"name": "backend-prod",
"attributes": ["env:prod", "team:backend"],
"connection_names": ["prod-postgres", "api-proxy"],
"description": "Production backend service identity"
}
headers = {"Content-Type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'backend-prod',
attributes: ['env:prod', 'team:backend'],
connection_names: ['prod-postgres', 'api-proxy'],
description: 'Production backend service identity'
})
};
fetch('https://use.hoop.dev/api/machineidentities/{name}', 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/machineidentities/{name}",
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' => 'backend-prod',
'attributes' => [
'env:prod',
'team:backend'
],
'connection_names' => [
'prod-postgres',
'api-proxy'
],
'description' => 'Production backend service identity'
]),
CURLOPT_HTTPHEADER => [
"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://use.hoop.dev/api/machineidentities/{name}"
payload := strings.NewReader("{\n \"name\": \"backend-prod\",\n \"attributes\": [\n \"env:prod\",\n \"team:backend\"\n ],\n \"connection_names\": [\n \"prod-postgres\",\n \"api-proxy\"\n ],\n \"description\": \"Production backend service identity\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
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.put("https://use.hoop.dev/api/machineidentities/{name}")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"backend-prod\",\n \"attributes\": [\n \"env:prod\",\n \"team:backend\"\n ],\n \"connection_names\": [\n \"prod-postgres\",\n \"api-proxy\"\n ],\n \"description\": \"Production backend service identity\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://use.hoop.dev/api/machineidentities/{name}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"backend-prod\",\n \"attributes\": [\n \"env:prod\",\n \"team:backend\"\n ],\n \"connection_names\": [\n \"prod-postgres\",\n \"api-proxy\"\n ],\n \"description\": \"Production backend service identity\"\n}"
response = http.request(request)
puts response.read_body{
"name": "backend-prod",
"attributes": [
"env:prod",
"team:backend"
],
"connection_names": [
"prod-postgres",
"api-proxy"
],
"created_at": "2024-07-25T15:56:35.317601Z",
"description": "Production backend service identity",
"id": "BF997324-5A27-4778-806A-41EE83598494",
"new_credentials": [
{
"aws_access_key_id": "<string>",
"aws_secret_access_key": "<string>",
"command": "<string>",
"connection_name": "<string>",
"connection_string": "<string>",
"connection_subtype": "<string>",
"connection_type": "<string>",
"database_name": "<string>",
"endpoint_url": "<string>",
"hostname": "<string>",
"password": "<string>",
"port": "<string>",
"proxy_token": "<string>",
"secret_key": "<string>",
"username": "<string>"
}
],
"updated_at": "2024-07-25T15:56:35.317601Z"
}{
"message": "the error description"
}{
"message": "the error description"
}{
"message": "the error description"
}{
"message": "the error description"
}{
"message": "the error description"
}Machine Identities
Update Machine Identity
Update a machine identity. Adding connections provisions new credentials; removing connections revokes them.
PUT
/
machineidentities
/
{name}
Update Machine Identity
curl --request PUT \
--url https://use.hoop.dev/api/machineidentities/{name} \
--header 'Content-Type: application/json' \
--data '
{
"name": "backend-prod",
"attributes": [
"env:prod",
"team:backend"
],
"connection_names": [
"prod-postgres",
"api-proxy"
],
"description": "Production backend service identity"
}
'import requests
url = "https://use.hoop.dev/api/machineidentities/{name}"
payload = {
"name": "backend-prod",
"attributes": ["env:prod", "team:backend"],
"connection_names": ["prod-postgres", "api-proxy"],
"description": "Production backend service identity"
}
headers = {"Content-Type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'backend-prod',
attributes: ['env:prod', 'team:backend'],
connection_names: ['prod-postgres', 'api-proxy'],
description: 'Production backend service identity'
})
};
fetch('https://use.hoop.dev/api/machineidentities/{name}', 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/machineidentities/{name}",
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' => 'backend-prod',
'attributes' => [
'env:prod',
'team:backend'
],
'connection_names' => [
'prod-postgres',
'api-proxy'
],
'description' => 'Production backend service identity'
]),
CURLOPT_HTTPHEADER => [
"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://use.hoop.dev/api/machineidentities/{name}"
payload := strings.NewReader("{\n \"name\": \"backend-prod\",\n \"attributes\": [\n \"env:prod\",\n \"team:backend\"\n ],\n \"connection_names\": [\n \"prod-postgres\",\n \"api-proxy\"\n ],\n \"description\": \"Production backend service identity\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
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.put("https://use.hoop.dev/api/machineidentities/{name}")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"backend-prod\",\n \"attributes\": [\n \"env:prod\",\n \"team:backend\"\n ],\n \"connection_names\": [\n \"prod-postgres\",\n \"api-proxy\"\n ],\n \"description\": \"Production backend service identity\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://use.hoop.dev/api/machineidentities/{name}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"backend-prod\",\n \"attributes\": [\n \"env:prod\",\n \"team:backend\"\n ],\n \"connection_names\": [\n \"prod-postgres\",\n \"api-proxy\"\n ],\n \"description\": \"Production backend service identity\"\n}"
response = http.request(request)
puts response.read_body{
"name": "backend-prod",
"attributes": [
"env:prod",
"team:backend"
],
"connection_names": [
"prod-postgres",
"api-proxy"
],
"created_at": "2024-07-25T15:56:35.317601Z",
"description": "Production backend service identity",
"id": "BF997324-5A27-4778-806A-41EE83598494",
"new_credentials": [
{
"aws_access_key_id": "<string>",
"aws_secret_access_key": "<string>",
"command": "<string>",
"connection_name": "<string>",
"connection_string": "<string>",
"connection_subtype": "<string>",
"connection_type": "<string>",
"database_name": "<string>",
"endpoint_url": "<string>",
"hostname": "<string>",
"password": "<string>",
"port": "<string>",
"proxy_token": "<string>",
"secret_key": "<string>",
"username": "<string>"
}
],
"updated_at": "2024-07-25T15:56:35.317601Z"
}{
"message": "the error description"
}{
"message": "the error description"
}{
"message": "the error description"
}{
"message": "the error description"
}{
"message": "the error description"
}Path Parameters
Machine Identity Name
Body
application/json
The request body resource
Response
OK
Example:
"backend-prod"
Example:
["env:prod", "team:backend"]Example:
["prod-postgres", "api-proxy"]Example:
"2024-07-25T15:56:35.317601Z"
Example:
"Production backend service identity"
Example:
"BF997324-5A27-4778-806A-41EE83598494"
Show child attributes
Show child attributes
Example:
"2024-07-25T15:56:35.317601Z"
Was this page helpful?
⌘I