
    C                     8    S SK r SSKJr  SSKJr   " S S5      rg)    N   )errors)utilsc                   0   \ rS rSr\R
                  " S5      S
S j5       r\R
                  " S5      \R                  " S5      S 5       5       r\R
                  " S5      \R                  " S5      S 5       5       r	\R
                  " S5      SS j5       r
S	rg)SecretApiMixin   z1.25Nc                    [        U[        5      (       d  UR                  S5      n[        R                  " U5      nUR                  S5      nUUUS.nUb@  [        R                  " U R                  S5      (       a  [        R                  " S5      eXES'   U R                  S5      nU R                  U R                  XeS9S	5      $ )
aW  
Create a secret

Args:
    name (string): Name of the secret
    data (bytes): Secret data to be stored
    labels (dict): A mapping of labels to assign to the secret
    driver (DriverConfig): A custom driver configuration. If
        unspecified, the default ``internal`` driver will be used

Returns (dict): ID of the newly created secret
zutf-8ascii)DataNameLabelsz1.31z6Secret driver is only available for API version > 1.31Driverz/secrets/create)dataT)
isinstancebytesencodebase64	b64encodedecoder   
version_lt_versionr   InvalidVersion_url_result
_post_json)selfnamer   labelsdriverbodyurls          $lib/third_party/docker/api/secret.pycreate_secretSecretApiMixin.create_secret   s     $&&;;w'D%{{7#
 v66++L  $Nii)*||OOCO+T
 	
    idc                 h    U R                  SU5      nU R                  U R                  U5      S5      $ )z
Retrieve secret metadata

Args:
    id (string): Full ID of the secret to inspect

Returns (dict): A dictionary of metadata

Raises:
    :py:class:`docker.errors.NotFound`
        if no secret with that ID exists
/secrets/{0}T)r   r   _get)r   r&   r!   s      r"   inspect_secretSecretApiMixin.inspect_secret.   s-     ii+||DIIcND11r%   c                 l    U R                  SU5      nU R                  U5      nU R                  U5        g)z
Remove a secret

Args:
    id (string): Full ID of the secret to remove

Returns (boolean): True if successful

Raises:
    :py:class:`docker.errors.NotFound`
        if no secret with that ID exists
r(   T)r   _delete_raise_for_status)r   r&   r!   ress       r"   remove_secretSecretApiMixin.remove_secret@   s3     ii+ll3s#r%   c                     U R                  S5      n0 nU(       a  [        R                  " U5      US'   U R                  U R	                  X#S9S5      $ )z
List secrets

Args:
    filters (dict): A map of filters to process on the secrets
    list. Available filters: ``names``

Returns (list): A list of secrets
z/secretsfilters)paramsT)r   r   convert_filtersr   r)   )r   r3   r!   r4   s       r"   secretsSecretApiMixin.secretsT   sK     ii
# % 5 5g >F9||DIIcI94@@r%    )NN)N)__name__
__module____qualname____firstlineno__r   minimum_versionr#   check_resourcer*   r0   r6   __static_attributes__r8   r%   r"   r   r      s    
6"#
 ##
J 6"
$2   #2  6"
$   #$ 6"A #Ar%   r   )r    r   r   r   r8   r%   r"   <module>rA      s      \A \Ar%   