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",
"project_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
],
"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>",
"scope": {
"project_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"project_name": "<string>",
"all_projects": true,
"partial": true
},
"project_defaults": [
{
"project_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"project_name": "<string>",
"defaults": {},
"set_by": "<string>",
"set_at": "2023-11-07T05:31:56Z"
}
]
}{
"detail": "Cluster not found"
}{
"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
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. The policy answered lists the clusters of the scope project_id names, as the read does.
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",
"project_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
],
"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>",
"scope": {
"project_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"project_name": "<string>",
"all_projects": true,
"partial": true
},
"project_defaults": [
{
"project_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"project_name": "<string>",
"defaults": {},
"set_by": "<string>",
"set_at": "2023-11-07T05:31:56Z"
}
]
}{
"detail": "Cluster not found"
}{
"detail": "Cluster not found"
}{
"detail": "Cluster not found"
}{
"detail": "Cluster not found"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}{
"detail": "Cluster not found"
}Authorizations
Query Parameters
Body
A partial policy write: a field left out keeps its value.
Response
Successful response
The organisation's cost autopilot policy and every live cluster's tier under it.