virsh-sandbox API
Project description
Virsh Sandbox
API for managing virtual machine sandboxes using libvirt
This Python package is automatically generated by the OpenAPI Generator project:
- API version: 0.0.1-beta
- Package version: 0.0.19-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:
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:
import virsh_sandbox
Setuptools
Install via Setuptools.
python setup.py install --user
(or sudo python setup.py install to install the package for all users)
Then import the package:
import virsh_sandbox
Tests
Execute pytest to run the tests.
Getting Started
Please follow the installation procedure and then run the following:
Unified Client (Recommended)
The SDK provides a unified VirshSandbox client that simplifies API usage with flattened parameters:
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:
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 | GET /v1/access/ca-pubkey | Get the SSH CA public key |
| AccessApi | get_certificate | GET /v1/access/certificate/{certID} | Get certificate details |
| AccessApi | list_certificates | GET /v1/access/certificates | List certificates |
| AccessApi | list_sessions | GET /v1/access/sessions | List sessions |
| AccessApi | record_session_end | POST /v1/access/session/end | Record session end |
| AccessApi | record_session_start | POST /v1/access/session/start | Record session start |
| AccessApi | request_access | POST /v1/access/request | Request SSH access to a sandbox |
| AccessApi | revoke_certificate | DELETE /v1/access/certificate/{certID} | Revoke a certificate |
| AnsibleApi | create_ansible_job | POST /v1/ansible/jobs | Create Ansible job |
| AnsibleApi | get_ansible_job | GET /v1/ansible/jobs/{job_id} | Get Ansible job |
| AnsibleApi | stream_ansible_job_output | GET /v1/ansible/jobs/{job_id}/stream | Stream Ansible job output |
| AnsiblePlaybooksApi | add_playbook_task | POST /v1/ansible/playbooks/{playbook_name}/tasks | Add task to playbook |
| AnsiblePlaybooksApi | create_playbook | POST /v1/ansible/playbooks | Create playbook |
| AnsiblePlaybooksApi | delete_playbook | DELETE /v1/ansible/playbooks/{playbook_name} | Delete playbook |
| AnsiblePlaybooksApi | delete_playbook_task | DELETE /v1/ansible/playbooks/{playbook_name}/tasks/{task_id} | Delete task |
| AnsiblePlaybooksApi | export_playbook | GET /v1/ansible/playbooks/{playbook_name}/export | Export playbook |
| AnsiblePlaybooksApi | get_playbook | GET /v1/ansible/playbooks/{playbook_name} | Get playbook |
| AnsiblePlaybooksApi | list_playbooks | GET /v1/ansible/playbooks | List playbooks |
| AnsiblePlaybooksApi | reorder_playbook_tasks | PATCH /v1/ansible/playbooks/{playbook_name}/tasks/reorder | Reorder tasks |
| AnsiblePlaybooksApi | update_playbook_task | PUT /v1/ansible/playbooks/{playbook_name}/tasks/{task_id} | Update task |
| AuditApi | get_audit_stats | GET /v1/audit/stats | Get audit stats |
| AuditApi | query_audit_log | POST /v1/audit/query | Query audit log |
| CommandApi | get_allowed_commands | GET /v1/command/allowed | Get allowed commands |
| CommandApi | run_command | POST /v1/command/run | Run command |
| FileApi | check_file_exists | POST /v1/file/exists | Check if file exists |
| FileApi | copy_file | POST /v1/file/copy | Copy file |
| FileApi | delete_file | POST /v1/file/delete | Delete file |
| FileApi | edit_file | POST /v1/file/edit | Edit file |
| FileApi | get_file_hash | POST /v1/file/hash | Get file hash |
| FileApi | list_directory | POST /v1/file/list | List directory contents |
| FileApi | read_file | POST /v1/file/read | Read file |
| FileApi | write_file | POST /v1/file/write | Write file |
| HealthApi | get_health | GET /v1/health | Get health status |
| HumanApi | ask_human | POST /v1/human/ask | Request human approval |
| HumanApi | ask_human_async | POST /v1/human/ask-async | Request human approval asynchronously |
| HumanApi | cancel_approval | DELETE /v1/human/pending/{requestID} | Cancel approval |
| HumanApi | get_pending_approval | GET /v1/human/pending/{requestID} | Get pending approval |
| HumanApi | list_pending_approvals | GET /v1/human/pending | List pending approvals |
| HumanApi | respond_to_approval | POST /v1/human/respond | Respond to approval |
| PlanApi | abort_plan | POST /v1/plan/{planID}/abort | Abort plan |
| PlanApi | advance_plan_step | POST /v1/plan/{planID}/advance | Advance plan step |
| PlanApi | create_plan | POST /v1/plan/create | Create plan |
| PlanApi | delete_plan | DELETE /v1/plan/{planID} | Delete plan |
| PlanApi | get_plan | GET /v1/plan/{planID} | Get plan |
| PlanApi | list_plans | GET /v1/plan/ | List plans |
| PlanApi | update_plan | POST /v1/plan/update | Update plan |
| SandboxApi | create_sandbox | POST /v1/sandboxes | Create a new sandbox |
| SandboxApi | create_sandbox_session | POST /v1/sandbox/sessions/create | Create sandbox session |
| SandboxApi | create_snapshot | POST /v1/sandboxes/{id}/snapshot | Create snapshot |
| SandboxApi | destroy_sandbox | DELETE /v1/sandboxes/{id} | Destroy sandbox |
| SandboxApi | diff_snapshots | POST /v1/sandboxes/{id}/diff | Diff snapshots |
| SandboxApi | discover_sandbox_ip | GET /v1/sandboxes/{id}/ip | Discover sandbox IP |
| SandboxApi | generate_configuration | POST /v1/sandboxes/{id}/generate/{tool} | Generate configuration |
| SandboxApi | get_sandbox | GET /v1/sandboxes/{id} | Get sandbox details |
| SandboxApi | get_sandbox_session | GET /v1/sandbox/sessions/{sessionName} | Get sandbox session |
| SandboxApi | inject_ssh_key | POST /v1/sandboxes/{id}/sshkey | Inject SSH key into sandbox |
| SandboxApi | kill_sandbox_session | DELETE /v1/sandbox/sessions/{sessionName} | Kill sandbox session |
| SandboxApi | list_sandbox_commands | GET /v1/sandboxes/{id}/commands | List sandbox commands |
| SandboxApi | list_sandbox_sessions | GET /v1/sandbox/sessions | List sandbox sessions |
| SandboxApi | list_sandboxes | GET /v1/sandboxes | List sandboxes |
| SandboxApi | publish_changes | POST /v1/sandboxes/{id}/publish | Publish changes |
| SandboxApi | run_sandbox_command | POST /v1/sandboxes/{id}/run | Run command in sandbox |
| SandboxApi | sandbox_api_health | GET /v1/sandbox/health | Check sandbox API health |
| SandboxApi | start_sandbox | POST /v1/sandboxes/{id}/start | Start sandbox |
| SandboxApi | stream_sandbox_activity | GET /v1/sandboxes/{id}/stream | Stream sandbox activity |
| TmuxApi | create_tmux_pane | POST /v1/tmux/panes/create | Create tmux pane |
| TmuxApi | create_tmux_session | POST /v1/tmux/sessions/create | Create tmux session |
| TmuxApi | kill_tmux_pane | DELETE /v1/tmux/panes/{paneID} | Kill tmux pane |
| TmuxApi | kill_tmux_session | DELETE /v1/tmux/sessions/{sessionName} | Kill tmux session |
| TmuxApi | list_tmux_panes | GET /v1/tmux/panes | List tmux panes |
| TmuxApi | list_tmux_sessions | GET /v1/tmux/sessions | List tmux sessions |
| TmuxApi | list_tmux_windows | GET /v1/tmux/windows | List tmux windows |
| TmuxApi | read_tmux_pane | POST /v1/tmux/panes/read | Read tmux pane |
| TmuxApi | release_tmux_session | POST /v1/tmux/sessions/{sessionId}/release | Release tmux session |
| TmuxApi | send_keys_to_pane | POST /v1/tmux/panes/send-keys | Send keys to tmux pane |
| TmuxApi | switch_tmux_pane | POST /v1/tmux/panes/switch | Switch tmux pane |
| VMsApi | list_virtual_machines | GET /v1/vms | List all VMs |
Documentation For Models
- InternalAnsibleJobStatus
- InternalApiSandboxSessionInfo
- InternalRestCertificateResponse
- InternalRestSandboxInfo
- InternalRestSessionResponse
- InternalRestVmInfo
- TimeDuration
- TmuxClientInternalApiCreateSandboxSessionRequest
- TmuxClientInternalApiCreateSandboxSessionResponse
- TmuxClientInternalApiListSandboxSessionsResponse
- TmuxClientInternalApiSandboxSessionInfo
- TmuxClientInternalTypesAPIError
- TmuxClientInternalTypesApprovalStatus
- TmuxClientInternalTypesApproveRequest
- TmuxClientInternalTypesAskHumanRequest
- TmuxClientInternalTypesAskHumanResponse
- TmuxClientInternalTypesAuditEntry
- TmuxClientInternalTypesAuditQuery
- TmuxClientInternalTypesAuditQueryResponse
- TmuxClientInternalTypesComponentHealth
- TmuxClientInternalTypesCopyFileRequest
- TmuxClientInternalTypesCopyFileResponse
- TmuxClientInternalTypesCreatePaneRequest
- TmuxClientInternalTypesCreatePaneResponse
- TmuxClientInternalTypesCreatePlanRequest
- TmuxClientInternalTypesCreatePlanResponse
- TmuxClientInternalTypesDeleteFileRequest
- TmuxClientInternalTypesDeleteFileResponse
- TmuxClientInternalTypesEditFileRequest
- TmuxClientInternalTypesEditFileResponse
- TmuxClientInternalTypesFileInfo
- TmuxClientInternalTypesGetPlanResponse
- TmuxClientInternalTypesHealthResponse
- TmuxClientInternalTypesHealthStatus
- TmuxClientInternalTypesKillSessionResponse
- TmuxClientInternalTypesListApprovalsResponse
- TmuxClientInternalTypesListDirRequest
- TmuxClientInternalTypesListDirResponse
- TmuxClientInternalTypesListPanesResponse
- TmuxClientInternalTypesListPlansResponse
- TmuxClientInternalTypesPaneInfo
- TmuxClientInternalTypesPendingApproval
- TmuxClientInternalTypesPlan
- TmuxClientInternalTypesPlanStatus
- TmuxClientInternalTypesPlanStep
- TmuxClientInternalTypesReadFileRequest
- TmuxClientInternalTypesReadFileResponse
- TmuxClientInternalTypesReadPaneRequest
- TmuxClientInternalTypesReadPaneResponse
- TmuxClientInternalTypesRunCommandRequest
- TmuxClientInternalTypesRunCommandResponse
- TmuxClientInternalTypesSendKeysRequest
- TmuxClientInternalTypesSendKeysResponse
- TmuxClientInternalTypesSessionInfo
- TmuxClientInternalTypesStepStatus
- TmuxClientInternalTypesSwitchPaneRequest
- TmuxClientInternalTypesSwitchPaneResponse
- TmuxClientInternalTypesUpdatePlanRequest
- TmuxClientInternalTypesUpdatePlanResponse
- TmuxClientInternalTypesWindowInfo
- TmuxClientInternalTypesWriteFileRequest
- TmuxClientInternalTypesWriteFileResponse
- VirshSandboxInternalAnsibleAddTaskRequest
- VirshSandboxInternalAnsibleAddTaskResponse
- VirshSandboxInternalAnsibleCreatePlaybookRequest
- VirshSandboxInternalAnsibleCreatePlaybookResponse
- VirshSandboxInternalAnsibleExportPlaybookResponse
- VirshSandboxInternalAnsibleGetPlaybookResponse
- VirshSandboxInternalAnsibleJob
- VirshSandboxInternalAnsibleJobRequest
- VirshSandboxInternalAnsibleJobResponse
- VirshSandboxInternalAnsibleJobStatus
- VirshSandboxInternalAnsibleListPlaybooksResponse
- VirshSandboxInternalAnsibleReorderTasksRequest
- VirshSandboxInternalAnsibleUpdateTaskRequest
- VirshSandboxInternalAnsibleUpdateTaskResponse
- VirshSandboxInternalErrorErrorResponse
- VirshSandboxInternalRestAccessErrorResponse
- VirshSandboxInternalRestCaPublicKeyResponse
- VirshSandboxInternalRestCertificateResponse
- VirshSandboxInternalRestCreateSandboxRequest
- VirshSandboxInternalRestCreateSandboxResponse
- VirshSandboxInternalRestDestroySandboxResponse
- VirshSandboxInternalRestDiffRequest
- VirshSandboxInternalRestDiffResponse
- VirshSandboxInternalRestDiscoverIPResponse
- VirshSandboxInternalRestErrorResponse
- VirshSandboxInternalRestGenerateResponse
- VirshSandboxInternalRestGetSandboxResponse
- VirshSandboxInternalRestInjectSSHKeyRequest
- VirshSandboxInternalRestListCertificatesResponse
- VirshSandboxInternalRestListSandboxCommandsResponse
- VirshSandboxInternalRestListSandboxesResponse
- VirshSandboxInternalRestListSessionsResponse
- VirshSandboxInternalRestListVMsResponse
- VirshSandboxInternalRestPublishRequest
- VirshSandboxInternalRestPublishResponse
- VirshSandboxInternalRestRequestAccessRequest
- VirshSandboxInternalRestRequestAccessResponse
- VirshSandboxInternalRestRevokeCertificateRequest
- VirshSandboxInternalRestRevokeCertificateResponse
- VirshSandboxInternalRestRunCommandRequest
- VirshSandboxInternalRestRunCommandResponse
- VirshSandboxInternalRestSandboxInfo
- VirshSandboxInternalRestSessionEndRequest
- VirshSandboxInternalRestSessionEndResponse
- VirshSandboxInternalRestSessionResponse
- VirshSandboxInternalRestSessionStartRequest
- VirshSandboxInternalRestSessionStartResponse
- VirshSandboxInternalRestSnapshotRequest
- VirshSandboxInternalRestSnapshotResponse
- VirshSandboxInternalRestStartSandboxRequest
- VirshSandboxInternalRestStartSandboxResponse
- VirshSandboxInternalRestVmInfo
- VirshSandboxInternalStoreChangeDiff
- VirshSandboxInternalStoreCommand
- VirshSandboxInternalStoreCommandExecRecord
- VirshSandboxInternalStoreCommandSummary
- VirshSandboxInternalStoreDiff
- VirshSandboxInternalStorePackageInfo
- VirshSandboxInternalStorePlaybook
- VirshSandboxInternalStorePlaybookTask
- VirshSandboxInternalStoreSandbox
- VirshSandboxInternalStoreSandboxState
- VirshSandboxInternalStoreServiceChange
- VirshSandboxInternalStoreSnapshot
- VirshSandboxInternalStoreSnapshotKind
Documentation For Authorization
Endpoints do not require authorization.
Author
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file virsh_sandbox-0.0.19b0.tar.gz.
File metadata
- Download URL: virsh_sandbox-0.0.19b0.tar.gz
- Upload date:
- Size: 124.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
abb8662e58f1433acd3e761b2310adb867f4f3570de5b4a0579de57eff2d26ff
|
|
| MD5 |
3db29860bb3ba5c610ae860bc0ac97b7
|
|
| BLAKE2b-256 |
809b0341b682f5be48d7038a4a076cca7c900a10f4beac47b231d530eec01810
|
File details
Details for the file virsh_sandbox-0.0.19b0-py3-none-any.whl.
File metadata
- Download URL: virsh_sandbox-0.0.19b0-py3-none-any.whl
- Upload date:
- Size: 471.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1e4caf5d102438660c742c9764fc6cb85819ee677a522128b2eaa032d6b19d96
|
|
| MD5 |
eb0219d2e0239a0a6ab5a49114925167
|
|
| BLAKE2b-256 |
054e928fe629d58ea45f775bdeb86dacbde2887445121d5a5e2e0fd5aeccd5ee
|