mirror of
https://github.com/bentoml/OpenLLM.git
synced 2026-01-31 02:41:51 -05:00
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
130 lines
3.8 KiB
Python
Generated
130 lines
3.8 KiB
Python
Generated
"""This type stub file was generated by pyright."""
|
|
|
|
class ContextAPI:
|
|
"""Context API.
|
|
Contains methods for context management:
|
|
create, list, remove, get, inspect.
|
|
"""
|
|
|
|
DEFAULT_CONTEXT = ...
|
|
@classmethod
|
|
def create_context(
|
|
cls, name, orchestrator=..., host=..., tls_cfg=..., default_namespace=..., skip_tls_verify=...
|
|
): # -> Context:
|
|
"""Creates a new context.
|
|
|
|
Returns:
|
|
(Context): a Context object.
|
|
|
|
Raises:
|
|
:py:class:`docker.errors.MissingContextParameter`
|
|
If a context name is not provided.
|
|
:py:class:`docker.errors.ContextAlreadyExists`
|
|
If a context with the name already exists.
|
|
:py:class:`docker.errors.ContextException`
|
|
If name is default.
|
|
|
|
Example:
|
|
>>> from docker.context import ContextAPI
|
|
>>> ctx = ContextAPI.create_context(name='test')
|
|
>>> print(ctx.Metadata)
|
|
{
|
|
"Name": "test",
|
|
"Metadata": {},
|
|
"Endpoints": {
|
|
"docker": {
|
|
"Host": "unix:///var/run/docker.sock",
|
|
"SkipTLSVerify": false
|
|
}
|
|
}
|
|
}
|
|
"""
|
|
...
|
|
@classmethod
|
|
def get_context(cls, name=...): # -> Context | None:
|
|
"""Retrieves a context object.
|
|
|
|
Args:
|
|
name (str): The name of the context.
|
|
|
|
Example:
|
|
>>> from docker.context import ContextAPI
|
|
>>> ctx = ContextAPI.get_context(name='test')
|
|
>>> print(ctx.Metadata)
|
|
{
|
|
"Name": "test",
|
|
"Metadata": {},
|
|
"Endpoints": {
|
|
"docker": {
|
|
"Host": "unix:///var/run/docker.sock",
|
|
"SkipTLSVerify": false
|
|
}
|
|
}
|
|
}
|
|
"""
|
|
...
|
|
@classmethod
|
|
def contexts(cls): # -> list[Context]:
|
|
"""Context list.
|
|
|
|
Returns:
|
|
(Context): List of context objects.
|
|
|
|
Raises:
|
|
:py:class:`docker.errors.APIError`
|
|
If the server returns an error.
|
|
"""
|
|
...
|
|
@classmethod
|
|
def get_current_context(cls): # -> Context | None:
|
|
"""Get current context.
|
|
|
|
Returns:
|
|
(Context): current context object.
|
|
"""
|
|
...
|
|
@classmethod
|
|
def set_current_context(cls, name=...): ...
|
|
@classmethod
|
|
def remove_context(cls, name): # -> None:
|
|
"""Remove a context. Similar to the ``docker context rm`` command.
|
|
|
|
Args:
|
|
name (str): The name of the context
|
|
|
|
Raises:
|
|
:py:class:`docker.errors.MissingContextParameter`
|
|
If a context name is not provided.
|
|
:py:class:`docker.errors.ContextNotFound`
|
|
If a context with the name does not exist.
|
|
:py:class:`docker.errors.ContextException`
|
|
If name is default.
|
|
|
|
Example:
|
|
>>> from docker.context import ContextAPI
|
|
>>> ContextAPI.remove_context(name='test')
|
|
>>>
|
|
"""
|
|
...
|
|
@classmethod
|
|
def inspect_context(
|
|
cls, name=...
|
|
): # -> dict[str, str | dict[str, Unknown] | dict[Unknown | str, dict[str, bytes | Unknown | str | bool]]] | dict[str, Unknown | dict[str, Unknown] | dict[Unknown | str, dict[str, bytes | Unknown | str | bool]]]:
|
|
"""Remove a context. Similar to the ``docker context inspect`` command.
|
|
|
|
Args:
|
|
name (str): The name of the context
|
|
|
|
Raises:
|
|
:py:class:`docker.errors.MissingContextParameter`
|
|
If a context name is not provided.
|
|
:py:class:`docker.errors.ContextNotFound`
|
|
If a context with the name does not exist.
|
|
|
|
Example:
|
|
>>> from docker.context import ContextAPI
|
|
>>> ContextAPI.remove_context(name='test')
|
|
>>>
|
|
"""
|
|
...
|