import requests
url = "https://platform.ankra.app/api/v1/org/service-admission/instances/{instance_id}/upgrades"
payload = { "expected_generation": 2 }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({expected_generation: 2})
};
fetch('https://platform.ankra.app/api/v1/org/service-admission/instances/{instance_id}/upgrades', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://platform.ankra.app/api/v1/org/service-admission/instances/{instance_id}/upgrades \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"expected_generation": 2
}
'{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"instance_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"plan": {
"schema_version": 123,
"instance_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"organisation_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"actor_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"cluster_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"generation": 123,
"stack_resource_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"stack_name": "<string>",
"profile_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"from": {
"package_version_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"package_version": "<string>",
"package_digest": "<string>",
"profile_version_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"profile_version": 123,
"profile_digest": "<string>",
"image": "<string>",
"postgresql_major": 123,
"postgresql_version": "<string>",
"chart_version": "<string>"
},
"to": {
"package_version_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"package_version": "<string>",
"package_digest": "<string>",
"profile_version_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"profile_version": 123,
"profile_digest": "<string>",
"image": "<string>",
"postgresql_major": 123,
"postgresql_version": "<string>",
"chart_version": "<string>"
},
"rollback": true,
"changelog": [
{
"profile_version": 123,
"changelog": "<string>"
}
],
"disruption": {
"instances": 123,
"tier": "standard",
"restart": "rolling",
"summary": "<string>"
},
"consumers": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"application_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"cluster_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"namespace": "<string>"
}
],
"backups": {
"policy": "declared",
"enabled": true,
"vault": "<string>",
"schedule": "<string>"
},
"recorded_inputs_digest": "<string>",
"effects": [
"<string>"
],
"expires_at": "2023-11-07T05:31:56Z"
},
"digest": "<string>",
"state": "pending",
"created_at": "2023-11-07T05:31:56Z",
"expires_at": "2023-11-07T05:31:56Z",
"confirmed_at": "2023-11-07T05:31:56Z",
"operation_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"backup_observation": {
"state": "protected",
"reason": "<string>",
"last_complete_restore_point_at": "<string>",
"stale": true,
"not_capturing": true
},
"warnings": [
"<string>"
]
}Prepare a managed-service upgrade review
Requires the applications rollout flag, applications.deploy in the cluster’s project, and clusters.read and clusters.operate on the service’s cluster, all intersected with live token scopes: the authority setting the service up on that cluster needed. Resolves, on the primary database, one upgrade of a running managed PostgreSQL service to a newer version of its package within the same PostgreSQL major (target_version_id, or the newest version the organisation can use): the package version, profile version and PostgreSQL image it moves from, read from the service’s stack, and to, read from the target’s profile version; the profile’s changelog between them; the disruption, from the instances and tier the service runs with and whether the image changes (each instance restarts once, the primary through a switchover where there are replicas, and a single instance is unavailable while it restarts); the applications connected; the backup policy the stack declares, which the update keeps; and in plain words what happens to the running database. It stores an actor-bound plan with a digest and a ten-minute expiry. Nothing changes. Another PostgreSQL major, a version that is not newer, a withdrawn version, a service that is not serving, an open resize or retirement review of the service, a target that pins an older CloudNativePG cluster chart, a target that does not carry a member the service’s stack runs (one the target drops or one added to the stack by hand, which the refusal names; the stack’s own backup policy member is carried across, not removed), a PostgreSQL major that cannot be read on either side, and a stack whose members were renamed when it was set up beside another service on the cluster (an in-place rollout cannot carry renamed members yet) are refused. backup_observation is what the platform last observed of the stack’s backups and is not part of the digest; no backup is taken before the upgrade. The one exit from the serving refusal is a service that is not serving because the roll of the upgrade that set its version failed (its operation ended failed, critical or cancelled): it may be prepared again, to a newer version, or back to the version that upgrade replaced (plan.rollback), whether target_version_id names that version or it is the newest one. A rollback that would move an add-on other than the CloudNativePG cluster to an older chart is refused, naming the add-on and the chart. A roll Ankra cannot prove failed (no operation, one still running or succeeded, one it cannot read) keeps the refusal, which says why. An actor may hold at most 10 open upgrade reviews and an organisation 50.
import requests
url = "https://platform.ankra.app/api/v1/org/service-admission/instances/{instance_id}/upgrades"
payload = { "expected_generation": 2 }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({expected_generation: 2})
};
fetch('https://platform.ankra.app/api/v1/org/service-admission/instances/{instance_id}/upgrades', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://platform.ankra.app/api/v1/org/service-admission/instances/{instance_id}/upgrades \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"expected_generation": 2
}
'{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"instance_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"plan": {
"schema_version": 123,
"instance_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"organisation_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"actor_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"cluster_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"generation": 123,
"stack_resource_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"stack_name": "<string>",
"profile_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"from": {
"package_version_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"package_version": "<string>",
"package_digest": "<string>",
"profile_version_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"profile_version": 123,
"profile_digest": "<string>",
"image": "<string>",
"postgresql_major": 123,
"postgresql_version": "<string>",
"chart_version": "<string>"
},
"to": {
"package_version_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"package_version": "<string>",
"package_digest": "<string>",
"profile_version_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"profile_version": 123,
"profile_digest": "<string>",
"image": "<string>",
"postgresql_major": 123,
"postgresql_version": "<string>",
"chart_version": "<string>"
},
"rollback": true,
"changelog": [
{
"profile_version": 123,
"changelog": "<string>"
}
],
"disruption": {
"instances": 123,
"tier": "standard",
"restart": "rolling",
"summary": "<string>"
},
"consumers": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"application_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"cluster_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"namespace": "<string>"
}
],
"backups": {
"policy": "declared",
"enabled": true,
"vault": "<string>",
"schedule": "<string>"
},
"recorded_inputs_digest": "<string>",
"effects": [
"<string>"
],
"expires_at": "2023-11-07T05:31:56Z"
},
"digest": "<string>",
"state": "pending",
"created_at": "2023-11-07T05:31:56Z",
"expires_at": "2023-11-07T05:31:56Z",
"confirmed_at": "2023-11-07T05:31:56Z",
"operation_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"backup_observation": {
"state": "protected",
"reason": "<string>",
"last_complete_restore_point_at": "<string>",
"stale": true,
"not_capturing": true
},
"warnings": [
"<string>"
]
}Authorizations
Body
One upgrade of a running managed service: the generation the person reviewed and the package version to move to.
Response
The stored upgrade review, its plan and digest.
One upgrade of a managed service, as its preparing actor sees it.