Metadata-Version: 2.4
Name: unikraft-cloud-plugin-sandbox-api
Version: 1.1.0
Summary: Generated Python client for the Unikraft Cloud `sandbox` plugin API
Keywords: unikraft,unikraft-cloud,plugin,sandbox,sdk
Author: Unikraft GmbH
License-Expression: BSD-3-Clause
License-File: LICENSE.md
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Dist: pydantic>=2.7
Requires-Dist: typing-extensions>=4.4
Requires-Python: >=3.10
Project-URL: Homepage, https://unikraft.com
Project-URL: Repository, https://github.com/unikraft-cloud/plugins
Description-Content-Type: text/markdown

# unikraft-cloud-plugin-sandbox-api

The generated client for the Unikraft Cloud `sandbox` plugin API.
openapi-gen generates it from the plugin's OpenAPI specification, so **do not
edit it by hand**.

This package is the raw ("plumbing") layer. Each method carries the name of its
`operationId` and returns the response envelope exactly as the specification
describes it. If you want the idiomatic layer, use
[`unikraft-cloud`](https://pypi.org/project/unikraft-cloud/), which wraps this
package and resolves the instance for you.

## Install

```sh
pip install unikraft-cloud-plugin-sandbox-api
```

The package depends on pydantic and typing_extensions only. Each generated
class takes a `Transport`,
an object with `request()`, `request_no_content()`, `request_bytes()` and
`stream()`. The `ApiClient` of `unikraft-cloud`
0.2.0 or later is one. If you want to use it as the transport, install
the SDK.

## Usage

The plugin runs inside a single instance and answers on that instance's plugin
route, so `base_url` is the full plugin endpoint rather than a metro root.

```python
import os

from unikraft_cloud.core.http import ApiClient, ApiClientConfig
from unikraft_cloud_plugin_sandbox_api import SandboxPluginApi

uuid = "..."  # The instance the plugin is attached to.
api = SandboxPluginApi(
    ApiClient(
        ApiClientConfig(
            base_url=f"https://api.fra.unikraft.cloud/v1/instances/{uuid}/plugins/sandbox",
            token=os.environ["UKC_TOKEN"],
        )
    )
)
```

The last path segment is whatever name the plugin was attached under in the
instance's `plugins` array, so it is not necessarily `sandbox`. To let the
SDK build that URL for you, use `unikraft-cloud` instead.

## Exports

Everything below is importable from `unikraft_cloud_plugin_sandbox_api`.

| Name | Carries |
| --- | --- |
| `SandboxPluginApi` | Every resource of the plugin behind one transport |
| `CommandsApi` | The `commands` resource |
| `FsApi` | The `fs` resource |
| `models` | The wire models, an alias of `unikraft_cloud_plugin_sandbox_api.models_gen` |
| `PLUGIN_NAME` | `"sandbox"`, the name the plugin is attached under unless the instance's creator chose another |
| `Transport`, `RawResponse` | The protocols a transport and a raw-bytes response satisfy |
| `CallOptions` | The options every method takes as `**options`: `headers`, `base_url` and `timeout` |
| `QueryValue` | What a query parameter may hold |
| `VERSION`, `SDK_MIN` | This package's version, and the oldest `unikraft-cloud` whose `ApiClient` is a transport for it |
| `SPEC_HASH`, `TEMPLATES_HASH`, `CONFIG_HASH` | SHA-256 fingerprints of the specification, the templates and the configuration this package was built from |

A `CallOptions` key that is absent leaves the transport's default in place, so
`timeout=None` lifts the timeout for one call and no `timeout` at all keeps the
client's.

`SandboxPluginApi` groups one client per resource:

- `api.commands`: the `commands` resource
- `api.fs`: the `fs` resource
