virsh-sandbox 0.0.21b0
virsh-sandbox API
Requires Python: >=3.8
Keywords: OpenAPI, OpenAPI-Generator, virsh-sandbox API

# Virsh Sandbox
API for managing virtual machine sandboxes using libvirt

This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:

- API version: 0.0.1-beta
- Package version: 0.0.21-beta
- Generator version: 7.19.0-SNAPSHOT
- Build package: org.openapitools.codegen.languages.PythonClientCodegen

## Requirements.

Python 3.9+

## Installation & Usage
### pip install

If the python package is hosted on a repository, you can install directly using:

```sh
pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git
```
(you may need to run `pip` with root permission: `sudo pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git`)

Then import the package:
```python
import virsh_sandbox
```

### Setuptools

Install via [Setuptools](http://pypi.python.org/pypi/setuptools).

```sh
python setup.py install --user
```
(or `sudo python setup.py install` to install the package for all users)

Then import the package:
```python
import virsh_sandbox
```

### Tests

Execute `pytest` to run the tests.

## Getting Started

Please follow the [installation procedure](#installation--usage) and then run the following:

### Unified Client (Recommended)

The SDK provides a unified `VirshSandbox` client that simplifies API usage with flattened parameters:

```python
import asyncio
from virsh_sandbox import VirshSandbox

async def main():
    # Create a unified client
    client = VirshSandbox(
        host="http://localhost:8080",
        tmux_host="http://localhost:8081"  # Optional: separate host for tmux operations
    )

    # Create a sandbox with simple parameters - no request objects needed!
    result = await client.sandbox.create_sandbox(
        source_vm_name="ubuntu-base",
        vm_name="my-sandbox",
        cpu=2,
        memory_mb=4096
    )

    # Run commands with flattened parameters
    output = await client.command.run_command(
        command="ls",
        args=["-la"],
        timeout=30
    )

    # File operations
    content = await client.file.read_file(path="/etc/hosts")

    # Tmux operations
    panes = await client.tmux.list_tmux_panes()

    # Clean up
    await client.close()

# Or use as async context manager for automatic cleanup
async def main_with_context():
    async with VirshSandbox(host="http://localhost:8080") as client:
        # All APIs accessible through namespaced properties:
        # - client.sandbox   (SandboxOperations)
        # - client.command   (CommandOperations)
        # - client.file      (FileOperations)
        # - client.tmux      (TmuxOperations)
        # - client.ansible   (AnsibleOperations)
        # - client.audit     (AuditOperations)
        # - client.health    (HealthOperations)
        # - client.human     (HumanOperations)
        # - client.plan      (PlanOperations)
        # - client.vms       (VMsOperations)

        await client.sandbox.create_sandbox(source_vm_name="base-vm")

asyncio.run(main())
```

### Individual API Classes (Advanced)

For more control, you can use the individual API classes directly with request objects:

```python

import virsh_sandbox
from virsh_sandbox.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to http://localhost
# See configuration.py for a list of all supported configuration parameters.
configuration = virsh_sandbox.Configuration(
    host = "http://localhost"
)


# Enter a context with an instance of the API client
with virsh_sandbox.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = virsh_sandbox.AccessApi(api_client)

    try:
        # Get the SSH CA public key
        api_response = api_instance.get_ca_public_key()
        print("The response of AccessApi->get_ca_public_key:\n")
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling AccessApi->get_ca_public_key: %s\n" % e)

```

## Documentation for API Endpoints

All URIs are relative to *http://localhost*

Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*AccessApi* | [**get_ca_public_key**](docs/AccessApi.md#get_ca_public_key) | **GET** /v1/access/ca-pubkey | Get the SSH CA public key
*AccessApi* | [**get_certificate**](docs/AccessApi.md#get_certificate) | **GET** /v1/access/certificate/{certID} | Get certificate details
*AccessApi* | [**list_certificates**](docs/AccessApi.md#list_certificates) | **GET** /v1/access/certificates | List certificates
*AccessApi* | [**list_sessions**](docs/AccessApi.md#list_sessions) | **GET** /v1/access/sessions | List sessions
*AccessApi* | [**record_session_end**](docs/AccessApi.md#record_session_end) | **POST** /v1/access/session/end | Record session end
*AccessApi* | [**record_session_start**](docs/AccessApi.md#record_session_start) | **POST** /v1/access/session/start | Record session start
*AccessApi* | [**request_access**](docs/AccessApi.md#request_access) | **POST** /v1/access/request | Request SSH access to a sandbox
*AccessApi* | [**revoke_certificate**](docs/AccessApi.md#revoke_certificate) | **DELETE** /v1/access/certificate/{certID} | Revoke a certificate
*AnsibleApi* | [**create_ansible_job**](docs/AnsibleApi.md#create_ansible_job) | **POST** /v1/ansible/jobs | Create Ansible job
*AnsibleApi* | [**get_ansible_job**](docs/AnsibleApi.md#get_ansible_job) | **GET** /v1/ansible/jobs/{job_id} | Get Ansible job
*AnsibleApi* | [**stream_ansible_job_output**](docs/AnsibleApi.md#stream_ansible_job_output) | **GET** /v1/ansible/jobs/{job_id}/stream | Stream Ansible job output
*AnsiblePlaybooksApi* | [**add_playbook_task**](docs/AnsiblePlaybooksApi.md#add_playbook_task) | **POST** /v1/ansible/playbooks/{playbook_name}/tasks | Add task to playbook
*AnsiblePlaybooksApi* | [**create_playbook**](docs/AnsiblePlaybooksApi.md#create_playbook) | **POST** /v1/ansible/playbooks | Create playbook
*AnsiblePlaybooksApi* | [**delete_playbook**](docs/AnsiblePlaybooksApi.md#delete_playbook) | **DELETE** /v1/ansible/playbooks/{playbook_name} | Delete playbook
*AnsiblePlaybooksApi* | [**delete_playbook_task**](docs/AnsiblePlaybooksApi.md#delete_playbook_task) | **DELETE** /v1/ansible/playbooks/{playbook_name}/tasks/{task_id} | Delete task
*AnsiblePlaybooksApi* | [**export_playbook**](docs/AnsiblePlaybooksApi.md#export_playbook) | **GET** /v1/ansible/playbooks/{playbook_name}/export | Export playbook
*AnsiblePlaybooksApi* | [**get_playbook**](docs/AnsiblePlaybooksApi.md#get_playbook) | **GET** /v1/ansible/playbooks/{playbook_name} | Get playbook
*AnsiblePlaybooksApi* | [**list_playbooks**](docs/AnsiblePlaybooksApi.md#list_playbooks) | **GET** /v1/ansible/playbooks | List playbooks
*AnsiblePlaybooksApi* | [**reorder_playbook_tasks**](docs/AnsiblePlaybooksApi.md#reorder_playbook_tasks) | **PATCH** /v1/ansible/playbooks/{playbook_name}/tasks/reorder | Reorder tasks
*AnsiblePlaybooksApi* | [**update_playbook_task**](docs/AnsiblePlaybooksApi.md#update_playbook_task) | **PUT** /v1/ansible/playbooks/{playbook_name}/tasks/{task_id} | Update task
*HealthApi* | [**get_health**](docs/HealthApi.md#get_health) | **GET** /v1/health | Health check
*SandboxApi* | [**create_sandbox**](docs/SandboxApi.md#create_sandbox) | **POST** /v1/sandboxes | Create a new sandbox
*SandboxApi* | [**create_snapshot**](docs/SandboxApi.md#create_snapshot) | **POST** /v1/sandboxes/{id}/snapshot | Create snapshot
*SandboxApi* | [**destroy_sandbox**](docs/SandboxApi.md#destroy_sandbox) | **DELETE** /v1/sandboxes/{id} | Destroy sandbox
*SandboxApi* | [**diff_snapshots**](docs/SandboxApi.md#diff_snapshots) | **POST** /v1/sandboxes/{id}/diff | Diff snapshots
*SandboxApi* | [**discover_sandbox_ip**](docs/SandboxApi.md#discover_sandbox_ip) | **GET** /v1/sandboxes/{id}/ip | Discover sandbox IP
*SandboxApi* | [**generate_configuration**](docs/SandboxApi.md#generate_configuration) | **POST** /v1/sandboxes/{id}/generate/{tool} | Generate configuration
*SandboxApi* | [**get_sandbox**](docs/SandboxApi.md#get_sandbox) | **GET** /v1/sandboxes/{id} | Get sandbox details
*SandboxApi* | [**inject_ssh_key**](docs/SandboxApi.md#inject_ssh_key) | **POST** /v1/sandboxes/{id}/sshkey | Inject SSH key into sandbox
*SandboxApi* | [**list_sandbox_commands**](docs/SandboxApi.md#list_sandbox_commands) | **GET** /v1/sandboxes/{id}/commands | List sandbox commands
*SandboxApi* | [**list_sandboxes**](docs/SandboxApi.md#list_sandboxes) | **GET** /v1/sandboxes | List sandboxes
*SandboxApi* | [**publish_changes**](docs/SandboxApi.md#publish_changes) | **POST** /v1/sandboxes/{id}/publish | Publish changes
*SandboxApi* | [**run_sandbox_command**](docs/SandboxApi.md#run_sandbox_command) | **POST** /v1/sandboxes/{id}/run | Run command in sandbox
*SandboxApi* | [**start_sandbox**](docs/SandboxApi.md#start_sandbox) | **POST** /v1/sandboxes/{id}/start | Start sandbox
*SandboxApi* | [**stream_sandbox_activity**](docs/SandboxApi.md#stream_sandbox_activity) | **GET** /v1/sandboxes/{id}/stream | Stream sandbox activity
*VMsApi* | [**list_virtual_machines**](docs/VMsApi.md#list_virtual_machines) | **GET** /v1/vms | List all VMs


## Documentation For Models

 - [InternalAnsibleAddTaskRequest](docs/InternalAnsibleAddTaskRequest.md)
 - [InternalAnsibleAddTaskResponse](docs/InternalAnsibleAddTaskResponse.md)
 - [InternalAnsibleCreatePlaybookRequest](docs/InternalAnsibleCreatePlaybookRequest.md)
 - [InternalAnsibleCreatePlaybookResponse](docs/InternalAnsibleCreatePlaybookResponse.md)
 - [InternalAnsibleExportPlaybookResponse](docs/InternalAnsibleExportPlaybookResponse.md)
 - [InternalAnsibleGetPlaybookResponse](docs/InternalAnsibleGetPlaybookResponse.md)
 - [InternalAnsibleJob](docs/InternalAnsibleJob.md)
 - [InternalAnsibleJobRequest](docs/InternalAnsibleJobRequest.md)
 - [InternalAnsibleJobResponse](docs/InternalAnsibleJobResponse.md)
 - [InternalAnsibleJobStatus](docs/InternalAnsibleJobStatus.md)
 - [InternalAnsibleListPlaybooksResponse](docs/InternalAnsibleListPlaybooksResponse.md)
 - [InternalAnsibleReorderTasksRequest](docs/InternalAnsibleReorderTasksRequest.md)
 - [InternalAnsibleUpdateTaskRequest](docs/InternalAnsibleUpdateTaskRequest.md)
 - [InternalAnsibleUpdateTaskResponse](docs/InternalAnsibleUpdateTaskResponse.md)
 - [InternalRestAccessErrorResponse](docs/InternalRestAccessErrorResponse.md)
 - [InternalRestCaPublicKeyResponse](docs/InternalRestCaPublicKeyResponse.md)
 - [InternalRestCertificateResponse](docs/InternalRestCertificateResponse.md)
 - [InternalRestCreateSandboxRequest](docs/InternalRestCreateSandboxRequest.md)
 - [InternalRestCreateSandboxResponse](docs/InternalRestCreateSandboxResponse.md)
 - [InternalRestDestroySandboxResponse](docs/InternalRestDestroySandboxResponse.md)
 - [InternalRestDiffRequest](docs/InternalRestDiffRequest.md)
 - [InternalRestDiffResponse](docs/InternalRestDiffResponse.md)
 - [InternalRestDiscoverIPResponse](docs/InternalRestDiscoverIPResponse.md)
 - [InternalRestErrorResponse](docs/InternalRestErrorResponse.md)
 - [InternalRestGenerateResponse](docs/InternalRestGenerateResponse.md)
 - [InternalRestGetSandboxResponse](docs/InternalRestGetSandboxResponse.md)
 - [InternalRestHealthResponse](docs/InternalRestHealthResponse.md)
 - [InternalRestInjectSSHKeyRequest](docs/InternalRestInjectSSHKeyRequest.md)
 - [InternalRestListCertificatesResponse](docs/InternalRestListCertificatesResponse.md)
 - [InternalRestListSandboxCommandsResponse](docs/InternalRestListSandboxCommandsResponse.md)
 - [InternalRestListSandboxesResponse](docs/InternalRestListSandboxesResponse.md)
 - [InternalRestListSessionsResponse](docs/InternalRestListSessionsResponse.md)
 - [InternalRestListVMsResponse](docs/InternalRestListVMsResponse.md)
 - [InternalRestPublishRequest](docs/InternalRestPublishRequest.md)
 - [InternalRestPublishResponse](docs/InternalRestPublishResponse.md)
 - [InternalRestRequestAccessRequest](docs/InternalRestRequestAccessRequest.md)
 - [InternalRestRequestAccessResponse](docs/InternalRestRequestAccessResponse.md)
 - [InternalRestRevokeCertificateRequest](docs/InternalRestRevokeCertificateRequest.md)
 - [InternalRestRevokeCertificateResponse](docs/InternalRestRevokeCertificateResponse.md)
 - [InternalRestRunCommandRequest](docs/InternalRestRunCommandRequest.md)
 - [InternalRestRunCommandResponse](docs/InternalRestRunCommandResponse.md)
 - [InternalRestSandboxInfo](docs/InternalRestSandboxInfo.md)
 - [InternalRestSessionEndRequest](docs/InternalRestSessionEndRequest.md)
 - [InternalRestSessionEndResponse](docs/InternalRestSessionEndResponse.md)
 - [InternalRestSessionResponse](docs/InternalRestSessionResponse.md)
 - [InternalRestSessionStartRequest](docs/InternalRestSessionStartRequest.md)
 - [InternalRestSessionStartResponse](docs/InternalRestSessionStartResponse.md)
 - [InternalRestSnapshotRequest](docs/InternalRestSnapshotRequest.md)
 - [InternalRestSnapshotResponse](docs/InternalRestSnapshotResponse.md)
 - [InternalRestStartSandboxRequest](docs/InternalRestStartSandboxRequest.md)
 - [InternalRestStartSandboxResponse](docs/InternalRestStartSandboxResponse.md)
 - [InternalRestVmInfo](docs/InternalRestVmInfo.md)
 - [TimeDuration](docs/TimeDuration.md)
 - [VirshSandboxInternalAnsibleAddTaskRequest](docs/VirshSandboxInternalAnsibleAddTaskRequest.md)
 - [VirshSandboxInternalAnsibleAddTaskResponse](docs/VirshSandboxInternalAnsibleAddTaskResponse.md)
 - [VirshSandboxInternalAnsibleCreatePlaybookRequest](docs/VirshSandboxInternalAnsibleCreatePlaybookRequest.md)
 - [VirshSandboxInternalAnsibleCreatePlaybookResponse](docs/VirshSandboxInternalAnsibleCreatePlaybookResponse.md)
 - [VirshSandboxInternalAnsibleExportPlaybookResponse](docs/VirshSandboxInternalAnsibleExportPlaybookResponse.md)
 - [VirshSandboxInternalAnsibleGetPlaybookResponse](docs/VirshSandboxInternalAnsibleGetPlaybookResponse.md)
 - [VirshSandboxInternalAnsibleJob](docs/VirshSandboxInternalAnsibleJob.md)
 - [VirshSandboxInternalAnsibleJobRequest](docs/VirshSandboxInternalAnsibleJobRequest.md)
 - [VirshSandboxInternalAnsibleJobResponse](docs/VirshSandboxInternalAnsibleJobResponse.md)
 - [VirshSandboxInternalAnsibleJobStatus](docs/VirshSandboxInternalAnsibleJobStatus.md)
 - [VirshSandboxInternalAnsibleListPlaybooksResponse](docs/VirshSandboxInternalAnsibleListPlaybooksResponse.md)
 - [VirshSandboxInternalAnsibleReorderTasksRequest](docs/VirshSandboxInternalAnsibleReorderTasksRequest.md)
 - [VirshSandboxInternalAnsibleUpdateTaskRequest](docs/VirshSandboxInternalAnsibleUpdateTaskRequest.md)
 - [VirshSandboxInternalAnsibleUpdateTaskResponse](docs/VirshSandboxInternalAnsibleUpdateTaskResponse.md)
 - [VirshSandboxInternalErrorErrorResponse](docs/VirshSandboxInternalErrorErrorResponse.md)
 - [VirshSandboxInternalRestAccessErrorResponse](docs/VirshSandboxInternalRestAccessErrorResponse.md)
 - [VirshSandboxInternalRestCaPublicKeyResponse](docs/VirshSandboxInternalRestCaPublicKeyResponse.md)
 - [VirshSandboxInternalRestCertificateResponse](docs/VirshSandboxInternalRestCertificateResponse.md)
 - [VirshSandboxInternalRestCreateSandboxRequest](docs/VirshSandboxInternalRestCreateSandboxRequest.md)
 - [VirshSandboxInternalRestCreateSandboxResponse](docs/VirshSandboxInternalRestCreateSandboxResponse.md)
 - [VirshSandboxInternalRestDestroySandboxResponse](docs/VirshSandboxInternalRestDestroySandboxResponse.md)
 - [VirshSandboxInternalRestDiffRequest](docs/VirshSandboxInternalRestDiffRequest.md)
 - [VirshSandboxInternalRestDiffResponse](docs/VirshSandboxInternalRestDiffResponse.md)
 - [VirshSandboxInternalRestDiscoverIPResponse](docs/VirshSandboxInternalRestDiscoverIPResponse.md)
 - [VirshSandboxInternalRestErrorResponse](docs/VirshSandboxInternalRestErrorResponse.md)
 - [VirshSandboxInternalRestGenerateResponse](docs/VirshSandboxInternalRestGenerateResponse.md)
 - [VirshSandboxInternalRestGetSandboxResponse](docs/VirshSandboxInternalRestGetSandboxResponse.md)
 - [VirshSandboxInternalRestHealthResponse](docs/VirshSandboxInternalRestHealthResponse.md)
 - [VirshSandboxInternalRestInjectSSHKeyRequest](docs/VirshSandboxInternalRestInjectSSHKeyRequest.md)
 - [VirshSandboxInternalRestListCertificatesResponse](docs/VirshSandboxInternalRestListCertificatesResponse.md)
 - [VirshSandboxInternalRestListSandboxCommandsResponse](docs/VirshSandboxInternalRestListSandboxCommandsResponse.md)
 - [VirshSandboxInternalRestListSandboxesResponse](docs/VirshSandboxInternalRestListSandboxesResponse.md)
 - [VirshSandboxInternalRestListSessionsResponse](docs/VirshSandboxInternalRestListSessionsResponse.md)
 - [VirshSandboxInternalRestListVMsResponse](docs/VirshSandboxInternalRestListVMsResponse.md)
 - [VirshSandboxInternalRestPublishRequest](docs/VirshSandboxInternalRestPublishRequest.md)
 - [VirshSandboxInternalRestPublishResponse](docs/VirshSandboxInternalRestPublishResponse.md)
 - [VirshSandboxInternalRestRequestAccessRequest](docs/VirshSandboxInternalRestRequestAccessRequest.md)
 - [VirshSandboxInternalRestRequestAccessResponse](docs/VirshSandboxInternalRestRequestAccessResponse.md)
 - [VirshSandboxInternalRestRevokeCertificateRequest](docs/VirshSandboxInternalRestRevokeCertificateRequest.md)
 - [VirshSandboxInternalRestRevokeCertificateResponse](docs/VirshSandboxInternalRestRevokeCertificateResponse.md)
 - [VirshSandboxInternalRestRunCommandRequest](docs/VirshSandboxInternalRestRunCommandRequest.md)
 - [VirshSandboxInternalRestRunCommandResponse](docs/VirshSandboxInternalRestRunCommandResponse.md)
 - [VirshSandboxInternalRestSandboxInfo](docs/VirshSandboxInternalRestSandboxInfo.md)
 - [VirshSandboxInternalRestSessionEndRequest](docs/VirshSandboxInternalRestSessionEndRequest.md)
 - [VirshSandboxInternalRestSessionEndResponse](docs/VirshSandboxInternalRestSessionEndResponse.md)
 - [VirshSandboxInternalRestSessionResponse](docs/VirshSandboxInternalRestSessionResponse.md)
 - [VirshSandboxInternalRestSessionStartRequest](docs/VirshSandboxInternalRestSessionStartRequest.md)
 - [VirshSandboxInternalRestSessionStartResponse](docs/VirshSandboxInternalRestSessionStartResponse.md)
 - [VirshSandboxInternalRestSnapshotRequest](docs/VirshSandboxInternalRestSnapshotRequest.md)
 - [VirshSandboxInternalRestSnapshotResponse](docs/VirshSandboxInternalRestSnapshotResponse.md)
 - [VirshSandboxInternalRestStartSandboxRequest](docs/VirshSandboxInternalRestStartSandboxRequest.md)
 - [VirshSandboxInternalRestStartSandboxResponse](docs/VirshSandboxInternalRestStartSandboxResponse.md)
 - [VirshSandboxInternalRestVmInfo](docs/VirshSandboxInternalRestVmInfo.md)
 - [VirshSandboxInternalStoreChangeDiff](docs/VirshSandboxInternalStoreChangeDiff.md)
 - [VirshSandboxInternalStoreCommand](docs/VirshSandboxInternalStoreCommand.md)
 - [VirshSandboxInternalStoreCommandExecRecord](docs/VirshSandboxInternalStoreCommandExecRecord.md)
 - [VirshSandboxInternalStoreCommandSummary](docs/VirshSandboxInternalStoreCommandSummary.md)
 - [VirshSandboxInternalStoreDiff](docs/VirshSandboxInternalStoreDiff.md)
 - [VirshSandboxInternalStorePackageInfo](docs/VirshSandboxInternalStorePackageInfo.md)
 - [VirshSandboxInternalStorePlaybook](docs/VirshSandboxInternalStorePlaybook.md)
 - [VirshSandboxInternalStorePlaybookTask](docs/VirshSandboxInternalStorePlaybookTask.md)
 - [VirshSandboxInternalStoreSandbox](docs/VirshSandboxInternalStoreSandbox.md)
 - [VirshSandboxInternalStoreSandboxState](docs/VirshSandboxInternalStoreSandboxState.md)
 - [VirshSandboxInternalStoreServiceChange](docs/VirshSandboxInternalStoreServiceChange.md)
 - [VirshSandboxInternalStoreSnapshot](docs/VirshSandboxInternalStoreSnapshot.md)
 - [VirshSandboxInternalStoreSnapshotKind](docs/VirshSandboxInternalStoreSnapshotKind.md)


<a id="documentation-for-authorization"></a>
## Documentation For Authorization

Endpoints do not require authorization.


## Author