# AsyncAction

URL: https://developers.cloud66.com/v3/models/async-action/

AsyncActions track the progress and results of long-running background operations. They provide real-time status updates for operations like deployments, server reboots, database operations, and other asynchronous tasks.

<Model>
    <ModelProperty name="id" type="integer">
        The unique identifier of the async action.
    </ModelProperty>
    <ModelProperty name="user" type="string">
        The email address of the user who initiated the action.
    </ModelProperty>
    <ModelProperty name="resource_type" type="string">
        The type of resource being operated on (e.g., "Stack", "Server", "Database").
    </ModelProperty>
    <ModelProperty name="action" type="string">
        The name of the action being performed (e.g., "deploy", "restart", "database_create").
    </ModelProperty>
    <ModelProperty name="resource_id" type="integer">
        The database ID of the target resource.
    </ModelProperty>
    <ModelProperty name="started_via" type="string">
        How the action was initiated (e.g., "api", "web", "hook").
    </ModelProperty>
    <ModelProperty name="started_at" type="string">
        The ISO 8601 timestamp when the action was started.
    </ModelProperty>
    <ModelProperty name="finished_at" type="string|null">
        The ISO 8601 timestamp when the action completed (null if still running).
    </ModelProperty>
    <ModelProperty name="finished_success" type="boolean|null">
        Whether the action completed successfully (null if still running).
    </ModelProperty>
    <ModelProperty name="finished_message" type="string|null">
        Human-readable completion message (null if still running).
    </ModelProperty>
    <ModelProperty name="finished_result" type="object|null">
        Structured result data containing operation-specific details (null if still running).
    </ModelProperty>
    <ModelProperty name="metadata" type="object">
        Additional action-specific metadata and parameters.
    </ModelProperty>
</Model>

**Common Action Types:**
- **deploy**: Stack deployment operations
- **restart**: Server restart operations  
- **database_create**: Database creation
- **database_delete**: Database deletion
- **database_user_create**: Database user creation
- **database_user_delete**: Database user deletion
- **stack_reboot**: Stack server reboot operations

**Stack Action Types:**
- **clear_caches**: Clear all application caches for a stack
- **maintenance_mode**: Enable or disable maintenance mode for a stack
- **promote_slave_db**: Promote a slave database server to master
- **resync_slave_db**: Re-sync a slave database server with its master
- **disable_replication_slave_db**: Disable database replication for a slave server
- **container_restart**: Restart a specific container
- **service_restart**: Restart containers for a specific service
- **service_pause**: Pause containers for a specific service
- **service_resume**: Resume containers for a specific service
- **process_restart**: Restart processes on stack servers
- **process_pause**: Pause processes on stack servers
- **process_resume**: Resume processes on stack servers

**Related models:** Stack, Server, Database, User

## Example

```json
{
  "id": 98765,
  "user": "john@example.com",
  "resource_type": "Stack",
  "action": "deploy",
  "resource_id": 12345,
  "started_via": "api",
  "started_at": "2024-01-15T10:30:00Z",
  "finished_at": "2024-01-15T10:45:00Z",
  "finished_success": true,
  "finished_message": "Deployment completed successfully",
  "finished_result": {
    "deploy_session": "deploy-session-123",
    "git_hash": "a1b2c3d4e5f6",
    "servers_deployed": 3
  },
  "metadata": {
    "git_ref": "main",
    "deployment_strategy": "rolling"
  }
}
```
