Make a database the database of an application
const url = 'https://dashboard.quantcdn.io/api/v3/organizations/example/applications/example/database/example/promote';const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://dashboard.quantcdn.io/api/v3/organizations/example/applications/example/database/example/promote \ --header 'Authorization: Bearer <token>'Makes the ready database the one every environment, backup, restore and new environment uses, and redeploys each environment onto it (a brief interruption per environment). The previous database is kept, so promoting it again is the rollback. Take a backup before promoting: the retired database is not reachable through the backups API afterwards. Environments are redeployed within about 15 seconds of the call: redeployed, redeployQueued (not done yet), redeployFailed (with a reason) and upToDate list the outcome, and redeployRequired is failed plus queued. Repeating the request only touches environments not yet on the new revision. Refused with 409, changing nothing, when another database operation holds the application’s lock, when the database is not ready, when a previous database is still kept (delete it first), when an environment has no user on it or its credentials cannot be read (environments lists them), or when it has no endpoint yet. Needs the delete_applications permission and the cloud:delete scope.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”The organisation ID
The application ID
The database instance identifier
Responses
Section titled “Responses”The database is now the active database
object
The database now in use.
The database kept for rollback. Absent when there was none.
Every environment that uses the database.
Environments whose service was updated onto a new task definition revision with a forced new deployment.
Environments whose redeploy did not fit the request’s time budget and was queued. Not done yet; a failure is only logged.
Environments whose redeploy could not be started. The switch is done; they still run the previous revision, which still works.
object
A short reason. Never a credential.
Environments that needed no redeploy: already on the new revision, or without a running service.
RedeployFailed plus redeployQueued: the environments that still run the previous task definition.
Environments whose variables could not be updated. Repeat the request.
Examplegenerated
{ "message": "example", "orgName": "example", "appName": "example", "active": "example", "previous": "example", "environments": [ "example" ], "redeployed": [ "example" ], "redeployQueued": [ "example" ], "redeployFailed": [ { "environment": "example", "error": "example" } ], "upToDate": [ "example" ], "redeployRequired": [ "example" ], "warnings": [ "example" ], "note": "example"}The application or the database was not found
Another database operation holds the lock, not ready, a previous database is still kept, or an environment has no user (or unreadable credentials) on it
object
409 only: the operation that holds the application’s lock.
409 only: the operation that was refused.
409 only: the pending or previous database that blocks the request, or the provision in flight.
409 only: for a provision in flight, the path to poll on the platform (this API serves it at the database route).
Promote 409 only: the environments that have no user, or unreadable credentials, on the instance.
Delete 500 only: what could not be cleaned up.
Example
{ "operation": "provision", "requested": "provision"}The platform could not complete the request
object
409 only: the operation that holds the application’s lock.
409 only: the operation that was refused.
409 only: the pending or previous database that blocks the request, or the provision in flight.
409 only: for a provision in flight, the path to poll on the platform (this API serves it at the database route).
Promote 409 only: the environments that have no user, or unreadable credentials, on the instance.
Delete 500 only: what could not be cleaned up.
Example
{ "operation": "provision", "requested": "provision"}The promote did not answer in time and may have completed. Read the databases, or repeat the promote (it is idempotent)
object
409 only: the operation that holds the application’s lock.
409 only: the operation that was refused.
409 only: the pending or previous database that blocks the request, or the provision in flight.
409 only: for a provision in flight, the path to poll on the platform (this API serves it at the database route).
Promote 409 only: the environments that have no user, or unreadable credentials, on the instance.
Delete 500 only: what could not be cleaned up.
Example
{ "operation": "provision", "requested": "provision"}