import requests
url = "https://platform.ankra.app/api/v1/org/cloud-cost/autopilot"
payload = {}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({})
};
fetch('https://platform.ankra.app/api/v1/org/cloud-cost/autopilot', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request PUT \
--url https://platform.ankra.app/api/v1/org/cloud-cost/autopilot \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{}'{
"clusters": [
{
"cluster_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"cluster_name": "<string>",
"environment": "<string>",
"environment_kind": "production",
"override": {
"expires_at": "2023-11-07T05:31:56Z",
"reason": "<string>",
"set_at": "2023-11-07T05:31:56Z",
"set_by": "<string>",
"tier": "hands-off"
},
"reason": "<string>",
"source": "override",
"tier": "hands-off"
}
],
"defaults": {},
"environment_kinds": [
"production"
],
"is_set": true,
"notification_route_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"quiet_hours": {
"end": "<string>",
"start": "<string>",
"timezone": "<string>"
},
"recommended_defaults": {},
"tiers": [
{
"applies_to": "<string>",
"does": "<string>",
"name": "<string>",
"proposes": "<string>",
"rollback_window": "<string>",
"tier": "hands-off"
}
],
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
}{
"detail": "Cluster not found"
}{
"detail": "Cluster not found"
}{
"detail": "Cluster not found"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}{
"detail": "Cluster not found"
}Change the cost autopilot policy (bearer twin)
A partial policy write. defaults names only the environment kinds it changes; quiet_hours and notification_route_id change only when present, and null clears them; a field the policy does not have is refused (400). Needs billing.manage and clusters.write (at the organisation); the token stands in for the browser route’s CSRF double-submit. The change and what it replaced are written to the audit log in the same transaction. Bearer-PAT twin of the browser route of the same name under /org; the console’s session cookie is not accepted here and the browser route answers a token with a login redirect.
import requests
url = "https://platform.ankra.app/api/v1/org/cloud-cost/autopilot"
payload = {}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({})
};
fetch('https://platform.ankra.app/api/v1/org/cloud-cost/autopilot', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request PUT \
--url https://platform.ankra.app/api/v1/org/cloud-cost/autopilot \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{}'{
"clusters": [
{
"cluster_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"cluster_name": "<string>",
"environment": "<string>",
"environment_kind": "production",
"override": {
"expires_at": "2023-11-07T05:31:56Z",
"reason": "<string>",
"set_at": "2023-11-07T05:31:56Z",
"set_by": "<string>",
"tier": "hands-off"
},
"reason": "<string>",
"source": "override",
"tier": "hands-off"
}
],
"defaults": {},
"environment_kinds": [
"production"
],
"is_set": true,
"notification_route_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"quiet_hours": {
"end": "<string>",
"start": "<string>",
"timezone": "<string>"
},
"recommended_defaults": {},
"tiers": [
{
"applies_to": "<string>",
"does": "<string>",
"name": "<string>",
"proposes": "<string>",
"rollback_window": "<string>",
"tier": "hands-off"
}
],
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
}{
"detail": "Cluster not found"
}{
"detail": "Cluster not found"
}{
"detail": "Cluster not found"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}{
"detail": "Cluster not found"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
PAT organisation override.
Body
A partial policy write: a field left out keeps its value.
The environment kinds to change and their tiers; kinds left out keep theirs. Cannot be null.
Show child attributes
Show child attributes
A notification route of the organisation; null clears it.
null clears the quiet hours.
Show child attributes
Show child attributes
Response
Successful response
The organisation's cost autopilot policy and every live cluster's tier under it.
Show child attributes
Show child attributes
The tier each environment kind defaults to; every kind is present.
Show child attributes
Show child attributes
production, staging, development, preview, unknown False for an organisation that never set a policy: every kind is then Hands-off.
The route the autopilot's pre-notices go to; null for the organisation's default routing.
When the autopilot starts no change of its own; null for none.
Show child attributes
Show child attributes
The policy the Autopilot view offers to turn on.
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Null until a policy is set.
The Ankra user id of the last change; null until a policy is set.