System operations
An operation is an action performed by the Neon Control Plane on a Neon object or resource. Operations are typically initiated by user actions, such as creating a branch or deleting a database. Other operations may be initiated by the Neon Control Plane, such as suspending a compute endpoint after a period of inactivity or checking its availability. You can monitor operations to keep an eye on the overall health of your Neon project or to check the status of specific operations. When working with the Neon API, you can poll the status of operations to ensure that an API request is completed before issuing the next API request. For more information, see Poll operation status.
Operation | Description |
---|---|
apply_config | Applies a new configuration to a Neon object or resource. For example, creating, deleting, or updating PostgreSQL users and databases initiates this operation. |
apply_storage_config | Applies a new configuration to a Neon storage object or resource. For example, updating the history retention period for a project initiates this operation. |
check_availability | Checks the availability of data in a branch and that a compute endpoint can start on a branch. Branches without a compute endpoint are not checked. This operation, performed by the availability checker, is a periodic load generated by the Control Plane. |
create_branch | Creates a branch in a Neon project. For related information, see Manage branches. |
create_timeline | Creates a project with a default branch. |
delete_tenant | Deletes stored data when a Neon project is deleted. |
start_compute | Starts a compute endpoint when there is an event or action that requires compute resources. For example, connecting to a suspended compute endpoint initiates this operation. |
suspend_compute | Suspends a compute endpoint after a period of inactivity. For information about how Neon manages compute resources, see Compute lifecycle. |
View operations
You can view system operations via the Neon Console, Neon CLI, or Neon API.
Operations and the Neon API
This section describes how to work with operations using the Neon API. The following topics are covered:
- List operations: Describes how to list all operations for a Neon project.
- List operations with pagination: Describes how to list all operations for a Neon project and paginate the response.
- Get operation: Describes how to retrieve the details for a specific operation by the operation ID.
- Poll operation status: Describes how to poll an operation for its status, which may be necessary to avoid failed requests due to in-progress operations when using the Neon API programmatically.
List operations
Lists operations for the specified project. This method supports response pagination. For more information, see List operations with pagination.
cURL command:
Response body
List operations with pagination
Pagination allows you to limit the number of operations displayed, as the number of operations for a project can be large. To paginate responses, issue an initial request with a limit
value. For brevity, the limit is set to 1 in the following example.
cURL command:
Response body
To list the next page of operations, add the cursor
value returned in the response body of the previous request and a limit
value for the next page.
Response body
Get operation
This method shows only the details for the specified operation ID.
cURL command:
Response body
Poll operation status
Some Neon API requests may take a few moments to complete. When using the Neon API programmatically, you can check the status
of an operation before proceeding with the next API request. For example, you may want to check the operation status of a create branch request before issuing a create database request for that branch.
The response to a Neon API request includes information about the operations that were initiated. For example, a create branch request initiates create_branch
and start_compute
operations.
You can use the Get operation details method to poll the status of an operation by the operation ID. You might do this at intervals of 5 seconds until the status
of the operation changes to finished
before issuing the next request. For example, this request polls the start_compute
operation shown above:
Response body
Possible operation status
values include running
, finished
, failed
, scheduling
. Initially, the status of an operation might be scheduling
. Before issuing the next API request, you would poll the operation until the status changes to finished
. You could also add logic to handle a failed
status.
Need help?
Join our Discord Server to ask questions or see what others are doing with Neon. Users on paid plans can open a support ticket from the console. For more detail, see Getting Support.
Last updated on