File manager - Edit - /usr/local/CyberPanel/lib/python3.10/site-packages/docker/context/__pycache__/api.cpython-310.pyc
Back
o �h� � @ sR d dl Z d dlZd dlmZ ddlmZmZmZmZ ddl m Z G dd� d�ZdS )� N)�errors� )�METAFILE�get_current_context_name�get_meta_dir�#write_context_name_to_docker_config)�Contextc @ sz e Zd ZdZedd�Ze ddd��Zeddd ��Zed d� �Z edd � �Z eddd��Zedd� �Zeddd��Z dS )� ContextAPIzfContext API. Contains methods for context management: create, list, remove, get, inspect. �default�swarmNFc C sv |st �d��|dkrt �d��t�|�}|rt �|��d}|r&|dkr&|}t||�}|j|||||d� |�� |S )aR 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 } } } �namer z$"default" is a reserved context name�dockerr )�skip_tls_verify� def_namespace)r �MissingContextParameter�ContextExceptionr �load_context�ContextAlreadyExists�set_endpoint�save) �clsr �orchestrator�host�tls_cfg�default_namespacer �ctx�endpoint� r �H/usr/local/CyberPanel/lib/python3.10/site-packages/docker/context/api.py�create_context s( � �zContextAPI.create_contextc C s"