import requests
url = "https://platform.ankra.app/api/v1/org/applications/{application_id}/environments/{environment_id}/size"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://platform.ankra.app/api/v1/org/applications/{application_id}/environments/{environment_id}/size', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request GET \
--url https://platform.ankra.app/api/v1/org/applications/{application_id}/environments/{environment_id}/size \
--header 'Authorization: Bearer <token>'{
"environment_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"read_state": "ok",
"placements": [
{
"cluster_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"namespace": "<string>",
"lane": "installation",
"parked": true,
"parked_copies": 123,
"deploy_mode": "quick",
"stored": {
"copies": {
"value": "<string>",
"source": "set"
},
"cpu_request": {
"value": "<string>",
"source": "set",
"millicores": 123
},
"cpu_limit": {
"value": "<string>",
"source": "set",
"millicores": 123
},
"memory_request": {
"value": "<string>",
"source": "set",
"bytes": 123
},
"memory_limit": {
"value": "<string>",
"source": "set",
"bytes": 123
}
},
"running": {
"state": "read",
"observed_at": "2023-11-07T05:31:56Z",
"workloads": [
{
"name": "<string>",
"generated": true,
"sized_by": "ankra",
"copies_desired": 123,
"copies_ready": 123,
"containers": [
{
"name": "<string>",
"cpu_request": {
"value": "<string>",
"millicores": 123
},
"cpu_limit": {
"value": "<string>",
"millicores": 123
},
"memory_request": {
"value": "<string>",
"bytes": 123
},
"memory_limit": {
"value": "<string>",
"bytes": 123
}
}
],
"containers_capped": true
}
],
"capped": true
},
"matches": true
}
],
"placements_capped": true,
"cluster_outside_projects": true
}Get an environment's size
One environment’s size, for the Settings, Scaling page. For each placement: the copies, CPU and memory the next release renders, where each comes from (set, the deploy mode, the option contract’s default, or not set), whether it is parked, and what the cluster mirror says runs, with whether Ankra’s generated Deployment runs what is stored. The stored values follow applications.read. The running values are shown only on a cluster where the caller holds kubernetes.read, decided as the cluster read decides it; elsewhere they read withheld. environment_id is a stored environment’s id, or the cluster id of a placement no stored environment claims, as the environments read lists them. A caller confined to a project is answered for an environment placed only outside it exactly as for one the application does not have (404), and is told only their own placements of a mixed one. Nothing is written.
import requests
url = "https://platform.ankra.app/api/v1/org/applications/{application_id}/environments/{environment_id}/size"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://platform.ankra.app/api/v1/org/applications/{application_id}/environments/{environment_id}/size', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request GET \
--url https://platform.ankra.app/api/v1/org/applications/{application_id}/environments/{environment_id}/size \
--header 'Authorization: Bearer <token>'{
"environment_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"read_state": "ok",
"placements": [
{
"cluster_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"namespace": "<string>",
"lane": "installation",
"parked": true,
"parked_copies": 123,
"deploy_mode": "quick",
"stored": {
"copies": {
"value": "<string>",
"source": "set"
},
"cpu_request": {
"value": "<string>",
"source": "set",
"millicores": 123
},
"cpu_limit": {
"value": "<string>",
"source": "set",
"millicores": 123
},
"memory_request": {
"value": "<string>",
"source": "set",
"bytes": 123
},
"memory_limit": {
"value": "<string>",
"source": "set",
"bytes": 123
}
},
"running": {
"state": "read",
"observed_at": "2023-11-07T05:31:56Z",
"workloads": [
{
"name": "<string>",
"generated": true,
"sized_by": "ankra",
"copies_desired": 123,
"copies_ready": 123,
"containers": [
{
"name": "<string>",
"cpu_request": {
"value": "<string>",
"millicores": 123
},
"cpu_limit": {
"value": "<string>",
"millicores": 123
},
"memory_request": {
"value": "<string>",
"bytes": 123
},
"memory_limit": {
"value": "<string>",
"bytes": 123
}
}
],
"containers_capped": true
}
],
"capped": true
},
"matches": true
}
],
"placements_capped": true,
"cluster_outside_projects": true
}Authorizations
Response
The environment's stored and running size
One environment's size: for each placement the reader reaches, the copies, CPU and memory stored for its next release and where each comes from, and what the cluster mirror says runs.
ok: every placement the reader reaches is answered. partial: the environment also runs on clusters outside the reader's project, or a placement's stored or running values could not be read. unknown: the read could not be made at all; placements is then empty, which says nothing about the environment.
ok, partial, unknown Set for a reader confined to a project (a project-only member, or a token pinned to a project while projects are on) on an environment that also deploys to a cluster outside that project: only the reader's own placements are listed. Absent for every other environment and for an organisation-wide reader.