Update service account
curl --request PATCH \
--url https://{region}.api.plerion.com/v1/tenant/service-accounts/aws/{accountId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Plerion scanning (Sydney)",
"templateVersion": "v4"
}
'import requests
url = "https://{region}.api.plerion.com/v1/tenant/service-accounts/aws/{accountId}"
payload = {
"name": "Plerion scanning (Sydney)",
"templateVersion": "v4"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: 'Plerion scanning (Sydney)', templateVersion: 'v4'})
};
fetch('https://{region}.api.plerion.com/v1/tenant/service-accounts/aws/{accountId}', 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://{region}.api.plerion.com/v1/tenant/service-accounts/aws/{accountId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Plerion scanning (Sydney)',
'templateVersion' => 'v4'
]),
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://{region}.api.plerion.com/v1/tenant/service-accounts/aws/{accountId}"
payload := strings.NewReader("{\n \"name\": \"Plerion scanning (Sydney)\",\n \"templateVersion\": \"v4\"\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://{region}.api.plerion.com/v1/tenant/service-accounts/aws/{accountId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Plerion scanning (Sydney)\",\n \"templateVersion\": \"v4\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{region}.api.plerion.com/v1/tenant/service-accounts/aws/{accountId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Plerion scanning (Sydney)\",\n \"templateVersion\": \"v4\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"accountId": "210987654321",
"name": "Plerion scanning",
"controlPlaneRoleArn": "arn:aws:iam::210987654321:role/PlerionControlPlaneRole",
"applianceInstanceProfileArn": "arn:aws:iam::210987654321:instance-profile/PlerionInstanceProfile",
"status": "active",
"enabled": true,
"awsOrganizationId": "o-a1b2c3d4e5",
"templateVersion": "v3"
}
}{
"errors": [
{
"code": "AccountMismatch",
"message": "controlPlaneRoleArn must be in account 210987654321. A service account cannot move to another AWS account."
}
]
}{
"message": "Forbidden"
}{
"errors": [
{
"code": "NotFound",
"message": "Service account not found"
}
]
}{
"errors": [
{
"code": "AccountMismatch",
"message": "instanceProfileArn must be an instance profile in account 123456789012, the account roleArn is in.",
"field": "<string>"
}
]
}{
"errors": [
{
"code": "RoleNotAssumable",
"message": "Plerion could not assume arn:aws:iam::210987654321:role/PlerionControlPlaneRole. The role needs the tag RolePurpose with the value PlerionAccess. A new role can also take a minute or two before it can be assumed."
}
]
}{
"errors": [
{
"code": "AccountMismatch",
"message": "instanceProfileArn must be an instance profile in account 123456789012, the account roleArn is in.",
"field": "<string>"
}
]
}Change a service account
Changes the fields you send and leaves the rest as they are. A new controlPlaneRoleArn must be in the same AWS account, and Plerion assumes it before saving anything. If a CloudFormation stack registered the service account, only name can change here. A request that changes nothing returns the service account as it is.
Requires ServiceAccount:Modify.
PATCH
/
v1
/
tenant
/
service-accounts
/
aws
/
{accountId}
Update service account
curl --request PATCH \
--url https://{region}.api.plerion.com/v1/tenant/service-accounts/aws/{accountId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Plerion scanning (Sydney)",
"templateVersion": "v4"
}
'import requests
url = "https://{region}.api.plerion.com/v1/tenant/service-accounts/aws/{accountId}"
payload = {
"name": "Plerion scanning (Sydney)",
"templateVersion": "v4"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: 'Plerion scanning (Sydney)', templateVersion: 'v4'})
};
fetch('https://{region}.api.plerion.com/v1/tenant/service-accounts/aws/{accountId}', 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://{region}.api.plerion.com/v1/tenant/service-accounts/aws/{accountId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Plerion scanning (Sydney)',
'templateVersion' => 'v4'
]),
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://{region}.api.plerion.com/v1/tenant/service-accounts/aws/{accountId}"
payload := strings.NewReader("{\n \"name\": \"Plerion scanning (Sydney)\",\n \"templateVersion\": \"v4\"\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://{region}.api.plerion.com/v1/tenant/service-accounts/aws/{accountId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Plerion scanning (Sydney)\",\n \"templateVersion\": \"v4\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{region}.api.plerion.com/v1/tenant/service-accounts/aws/{accountId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Plerion scanning (Sydney)\",\n \"templateVersion\": \"v4\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"accountId": "210987654321",
"name": "Plerion scanning",
"controlPlaneRoleArn": "arn:aws:iam::210987654321:role/PlerionControlPlaneRole",
"applianceInstanceProfileArn": "arn:aws:iam::210987654321:instance-profile/PlerionInstanceProfile",
"status": "active",
"enabled": true,
"awsOrganizationId": "o-a1b2c3d4e5",
"templateVersion": "v3"
}
}{
"errors": [
{
"code": "AccountMismatch",
"message": "controlPlaneRoleArn must be in account 210987654321. A service account cannot move to another AWS account."
}
]
}{
"message": "Forbidden"
}{
"errors": [
{
"code": "NotFound",
"message": "Service account not found"
}
]
}{
"errors": [
{
"code": "AccountMismatch",
"message": "instanceProfileArn must be an instance profile in account 123456789012, the account roleArn is in.",
"field": "<string>"
}
]
}{
"errors": [
{
"code": "RoleNotAssumable",
"message": "Plerion could not assume arn:aws:iam::210987654321:role/PlerionControlPlaneRole. The role needs the tag RolePurpose with the value PlerionAccess. A new role can also take a minute or two before it can be assumed."
}
]
}{
"errors": [
{
"code": "AccountMismatch",
"message": "instanceProfileArn must be an instance profile in account 123456789012, the account roleArn is in.",
"field": "<string>"
}
]
}Authorizations
Headers
Path Parameters
Body
application/json
Send at least one field. None of them can be cleared, so null is refused.
Was this page helpful?