Ë
    9àiK  ã                   óD   — d dl mZmZmZ d dlmZ d„ Zd„ Z G d„ d«      Zy)é   )ÚauthÚerrorsÚutils)ÚServiceModec                 ór  — d„ }|�†t        j                  | d«      rd|v r	 |dd«       d|v r	 |dd«       t        j                  | d«      r|j                  d«      d	k(  r	 |d
d«       t        j                  | d«      rd|v r	 |dd«       |�Bt        j                  | d«      r	 |dd«       t        j                  | d«      rd|v r	 |dd«       |�8t        j                  | d«      r"d|v rt        d„ |d   D «       «      r	 |dd«       |��«d|v rt        j                  | d«      r	 |dd«       |j                  d«      rft        j                  | d«      r|d   j                  d«      r	 |dd«       t        j                  | d«      r|d   j                  d«      r	 |dd«       |j                  d«      �r·|j                  d«      }t        j                  | d«      rœ|j                  d«      r	 |dd«       |j                  d «      �	 |d!d«       |j                  d"«      �	 |d#d«       |j                  d$«      �	 |d%d«       |j                  d&«      �	 |d'd«       |j                  d(«      �	 |d)d«       t        j                  | d«      r4|j                  d*«      �	 |d'd«       |j                  d+«      �	 |d,d«       t        j                  | d«      r4|j                  d-«      �	 |d.d«       |j                  d/«      �	 |d0d«       t        j                  | d1«      r|j                  d2«      �	 |d3d1«       t        j                  | d4«      r|j                  d5«      �	 |d6d4«       |j                  d7«      r6t        j                  | d«      r|d7   j                  d8«      r
 |d9d«       y y y y y ):Nc                 ó6   — t        j                  | › d|› �«      ‚)Nz# is not supported in API version < )r   ÚInvalidVersion)ÚparamÚmin_versions     úS/home/factor_ks/STREAMA2026/venv/lib/python3.12/site-packages/docker/api/service.pyÚraise_version_errorz0_check_api_features.<locals>.raise_version_error   s$   € Ü×#Ñ#ØˆgÐ8¸¸ÐFó
ð 	
ó    ú1.25ÚMaxFailureRatiozUpdateConfig.max_failure_ratioÚMonitorzUpdateConfig.monitorz1.28ÚFailureActionÚrollbackz$UpdateConfig.failure_action rollbackú1.29ÚOrderzUpdateConfig.orderÚrollback_configzRollbackConfig.orderz1.32ÚPortsc              3   ó>   K  — | ]  }|j                  d «      –— Œ y­w)ÚPublishModeN)Úget)Ú.0Úps     r   ú	<genexpr>z&_check_api_features.<locals>.<genexpr>(   s   è ø€ ÒH¨A�1—5‘5˜×'ÑHùs   ‚zEndpointSpec.Ports[].modeÚForceUpdateÚforce_updateÚ	Placementz1.30Ú	PlatformszPlacement.platformsz1.27ÚPreferenceszPlacement.preferencesÚContainerSpecÚTTYzContainerSpec.ttyÚHostnamezContainerSpec.hostnameÚHostszContainerSpec.hostsÚGroupszContainerSpec.groupsÚ	DNSConfigzContainerSpec.dns_configÚHealthcheckzContainerSpec.healthcheckÚReadOnlyÚ
StopSignalzContainerSpec.stop_signalÚConfigszContainerSpec.configsÚ
PrivilegeszContainerSpec.privilegesz1.35Ú	IsolationzContainerSpec.isolationz1.38ÚInitzContainerSpec.initÚ	ResourcesÚGenericResourceszResources.generic_resources)r   Ú
version_ltr   Úany)ÚversionÚtask_templateÚupdate_configÚendpoint_specr   r   Úcontainer_specs          r   Ú_check_api_featuresr9      s»  € ò
ð
 Ð Ü×Ñ˜G VÔ,Ø  MÑ1Ù#Ð$DÀfÔMØ˜MÑ)Ù#Ð$:¸FÔCä×Ñ˜G VÔ,Ø× Ñ  Ó1°ZÒ?Ù#Ø:¸Fôô ×Ñ˜G VÔ,Ø˜-Ñ'Ù#Ð$8¸&ÔAàÐ"Ü×Ñ˜G VÔ,ÙÐ 1°6Ô:ä×Ñ˜G VÔ,Ø˜-Ñ'Ù#Ð$:¸FÔCàÐ Ü×Ñ˜G VÔ,°¸MÑ1IÜÑH°¸wÑ1GÔHÔHÙ#Ð$?ÀÔHàÑ Ø˜MÑ)¬e×.>Ñ.>Ø˜ô/!á °Ô7à×Ñ˜[Ô)Ü×Ñ ¨Ô0Ø  Ñ-×1Ñ1°+Ô>Ù'Ð(=¸vÔFÜ×Ñ ¨Ô0Ø  Ñ-×1Ñ1°-Ô@Ù'Ð(?ÀÔHà×Ñ˜_Õ-Ø*×.Ñ.¨Ó?ˆNä×Ñ ¨Ô0Ø!×%Ñ% eÔ,Ù'Ð(;¸VÔDØ!×%Ñ% jÓ1Ð=Ù'Ð(@À&ÔIØ!×%Ñ% gÓ.Ð:Ù'Ð(=¸vÔFØ!×%Ñ% hÓ/Ð;Ù'Ð(>ÀÔGØ!×%Ñ% kÓ2Ð>Ù'Ð(BÀFÔKØ!×%Ñ% mÓ4Ð@Ù'Ð(CÀVÔLä×Ñ ¨Ô0Ø!×%Ñ% jÓ1Ð=Ù'Ð(BÀFÔKØ!×%Ñ% lÓ3Ð?Ù'Ð(CÀVÔLä×Ñ ¨Ô0Ø!×%Ñ% iÓ0Ð<Ù'Ð(?ÀÔHØ!×%Ñ% lÓ3Ð?Ù'Ð(BÀFÔKä×Ñ ¨Ô0Ø!×%Ñ% kÓ2Ð>Ù'Ð(AÀ6ÔJä×Ñ ¨Ô0Ø!×%Ñ% fÓ-Ð9Ù'Ð(<¸fÔEà×Ñ˜[Ô)Ü×Ñ ¨Ô0Ø  Ñ-×1Ñ1Ð2DÔEÙ'Ð(EÀvÕNð Fð 1ð *ðe !r   c                 óÔ   — | j                  «       }|�U|j                  «       D ]B  \  }}|dk(  r0d|vri |d<   |d   j                  «       D ]  \  }}|€Œ	||d   |<   Œ Œ;|€Œ>|||<   ŒD |S )Nr#   )ÚcopyÚitems)ÚcurrentÚoverrideÚmergedÚts_keyÚts_valueÚcs_keyÚcs_values          r   Ú_merge_task_templaterD   c   s™   € Ø�\‰\‹^€FØÐØ (§¡Ó 0ò 	*ÑˆF�HØ˜Ò(Ø"¨&Ñ0Ø.0�F˜?Ñ+Ø(0°Ñ(A×(GÑ(GÓ(Iò CÑ$�F˜HØÑ+Ø:B˜˜Ñ/°Ò7ñCð Ñ%Ø!)��v’ð	*ð €Mr   c                   ó€  — e Zd Z ej                  d«      	 	 	 dd„«       Z ej                  d«       ej                  d«      dd„«       «       Z ej                  d«       ej                  d«      d„ «       «       Z ej                  d«       ej                  d«      d„ «       «       Z	 ej                  d«      dd	„«       Z
 ej                  d
«       ej                  d«      	 	 	 dd„«       «       Z ej                  d«      dd„«       Z ej                  d«       ej                  d«      	 	 	 	 	 dd„«       «       Zy)ÚServiceApiMixinz1.24Nc
                 óx  — t        | j                  ||||	«       | j                  d«      }
i }|j                  di «      j                  dd«      }|€t	        j
                  d«      ‚|rt        |t        «      st        |«      }t        j                  |«      \  }}t        j                  | |«      }|r||d<   t        j                  | j                  d«      r|xs |j                  dd«      }||||t        j                  |«      |d	œ}|�||d
<   |	�|	|d<   | j!                  | j#                  |
||¬«      d«      S )a  
        Create a service.

        Args:
            task_template (TaskTemplate): Specification of the task to start as
                part of the new service.
            name (string): User-defined name for the service. Optional.
            labels (dict): A map of labels to associate with the service.
                Optional.
            mode (ServiceMode): Scheduling mode for the service (replicated
                or global). Defaults to replicated.
            update_config (UpdateConfig): Specification for the update strategy
                of the service. Default: ``None``
            rollback_config (RollbackConfig): Specification for the rollback
                strategy of the service. Default: ``None``
            networks (:py:class:`list`): List of network names or IDs or
                :py:class:`~docker.types.NetworkAttachmentConfig` to attach the
                service to. Default: ``None``.
            endpoint_spec (EndpointSpec): Properties that can be configured to
                access and load balance a service. Default: ``None``.

        Returns:
            A dictionary containing an ``ID`` key for the newly created
            service.

        Raises:
            :py:class:`docker.errors.APIError`
                If the server returns an error.
        z/services/creater#   ÚImageNz,Missing mandatory Image key in ContainerSpecúX-Registry-Authr   ÚNetworks)ÚNameÚLabelsÚTaskTemplateÚModerJ   ÚEndpointSpecÚUpdateConfigÚRollbackConfig)ÚdataÚheadersT)r9   Ú_versionÚ_urlr   r   ÚDockerExceptionÚ
isinstanceÚdictr   r   Úresolve_repository_nameÚget_config_headerr   r2   ÚpopÚconvert_service_networksÚ_resultÚ
_post_json)Úselfr5   ÚnameÚlabelsÚmoder6   ÚnetworksÚendpoint_configr7   r   ÚurlrS   ÚimageÚregistryÚ	repo_nameÚauth_headerrR   s                    r   Úcreate_servicezServiceApiMixin.create_services   sQ  € ôH 	Ø�M‰M˜=¨-¸Øô	
ð
 �i‰iÐ*Ó+ˆØˆØ×!Ñ! /°2Ó6×:Ñ:¸7ÀDÓIˆØˆ=Ü×(Ñ(Ø>óð ñ œ
 4¬Ô.Ü˜tÓ$ˆDä"×:Ñ:¸5ÓAÑˆ�)Ü×,Ñ,¨T°8Ó<ˆÙØ)4ˆGÐ%Ñ&Ü×Ñ˜DŸM™M¨6Ô2ØÒF =×#4Ñ#4°ZÀÓ#FˆHàØØ)ØÜ×6Ñ6°xÓ@Ø)ñ
ˆð Ð$Ø#0ˆD�Ñ àÐ&Ø%4ˆDÐ!Ñ"à�|‰|Ø�O‰O˜C d°GˆOÓ<¸dó
ð 	
r   Úservicec                 óè   — | j                  d|«      }i }|�:t        j                  | j                  d«      rt	        j
                  d«      ‚||d<   | j                  | j                  ||¬«      d«      S )aú  
        Return information about a service.

        Args:
            service (str): Service name or ID.
            insert_defaults (boolean): If true, default values will be merged
                into the service inspect output.

        Returns:
            (dict): A dictionary of the server-side representation of the
                service, including all relevant properties.

        Raises:
            :py:class:`docker.errors.APIError`
                If the server returns an error.
        ú/services/{0}r   z6insert_defaults is not supported in API version < 1.29ÚinsertDefaults©ÚparamsT)rU   r   r2   rT   r   r	   r]   Ú_get)r_   rk   Úinsert_defaultsre   rp   s        r   Úinspect_servicezServiceApiMixin.inspect_service¿   st   € ð& �i‰i˜¨Ó1ˆØˆØÐ&Ü×Ñ §¡¨vÔ6Ü×+Ñ+ØLóð ð (7ˆFÐ#Ñ$à�|‰|˜DŸI™I c°&˜IÓ9¸4Ó@Ð@r   Útaskc                 óh   — | j                  d|«      }| j                  | j                  |«      d«      S )a  
        Retrieve information about a task.

        Args:
            task (str): Task ID

        Returns:
            (dict): Information about the task.

        Raises:
            :py:class:`docker.errors.APIError`
                If the server returns an error.
        z
/tasks/{0}T)rU   r]   rq   )r_   rt   re   s      r   Úinspect_taskzServiceApiMixin.inspect_taskÝ   s-   € ð  �i‰i˜ dÓ+ˆØ�|‰|˜DŸI™I c›N¨DÓ1Ð1r   c                 ól   — | j                  d|«      }| j                  |«      }| j                  |«       y)a  
        Stop and remove a service.

        Args:
            service (str): Service name or ID

        Returns:
            ``True`` if successful.

        Raises:
            :py:class:`docker.errors.APIError`
                If the server returns an error.
        rm   T)rU   Ú_deleteÚ_raise_for_status)r_   rk   re   Úresps       r   Úremove_servicezServiceApiMixin.remove_serviceð   s3   € ð" �i‰i˜¨Ó1ˆØ�|‰|˜CÓ ˆØ×Ñ˜tÔ$Ør   c                 ó  — d|rt        j                  |«      ndi}|�:t        j                  | j                  d«      rt	        j
                  d«      ‚||d<   | j                  d«      }| j                  | j                  ||¬«      d«      S )	a"  
        List services.

        Args:
            filters (dict): Filters to process on the nodes list. Valid
                filters: ``id``, ``name`` , ``label`` and ``mode``.
                Default: ``None``.
            status (bool): Include the service task count of running and
                desired tasks. Default: ``None``.

        Returns:
            A list of dictionaries containing data about each service.

        Raises:
            :py:class:`docker.errors.APIError`
                If the server returns an error.
        ÚfiltersNz1.41z-status is not supported in API version < 1.41Ústatusz	/servicesro   T)	r   Úconvert_filtersr2   rT   r   r	   rU   r]   rq   )r_   r}   r~   rp   re   s        r   ÚserviceszServiceApiMixin.services  s‰   € ð( ¹”u×,Ñ,¨WÔ5Àdð
ˆð ÐÜ×Ñ §¡¨vÔ6Ü×+Ñ+ØCóð ð  &ˆF�8ÑØ�i‰i˜Ó$ˆØ�|‰|˜DŸI™I c°&˜IÓ9¸4Ó@Ð@r   r   c
                 óà   — |||||||dœ}
| j                  d|«      }| j                  ||
d¬«      }|	€*| j                  |«      d   d   d   j                  dd	«      }	| j	                  d||	«      S )
ar  
            Get log stream for a service.
            Note: This endpoint works only for services with the ``json-file``
            or ``journald`` logging drivers.

            Args:
                service (str): ID or name of the service
                details (bool): Show extra details provided to logs.
                    Default: ``False``
                follow (bool): Keep connection open to read logs as they are
                    sent by the Engine. Default: ``False``
                stdout (bool): Return logs from ``stdout``. Default: ``False``
                stderr (bool): Return logs from ``stderr``. Default: ``False``
                since (int): UNIX timestamp for the logs staring point.
                    Default: 0
                timestamps (bool): Add timestamps to every log line.
                tail (string or int): Number of log lines to be returned,
                    counting from the current end of the logs. Specify an
                    integer or ``'all'`` to output all log lines.
                    Default: ``all``
                is_tty (bool): Whether the service's :py:class:`ContainerSpec`
                    enables the TTY option. If omitted, the method will query
                    the Engine for the information, causing an additional
                    roundtrip.

            Returns (generator): Logs for the service.
        )ÚdetailsÚfollowÚstdoutÚstderrÚsinceÚ
timestampsÚtailz/services/{0}/logsT)rp   ÚstreamÚSpecrM   r#   r$   F)rU   rq   rs   r   Ú_get_result_tty)r_   rk   r‚   rƒ   r„   r…   r†   r‡   rˆ   Úis_ttyrp   re   Úress                r   Úservice_logszServiceApiMixin.service_logs%  sž   € ðB ØØØØØ$Øñ
ˆð �i‰iÐ,¨gÓ6ˆØ�i‰i˜ F°4ˆiÓ8ˆØˆ>Ø×)Ñ)Øóàñà$ñ&à&5ñ7ç7:±s¸5À%Ó7Hð ð ×#Ñ# D¨#¨vÓ6Ð6r   c                 ó    — d|rt        j                  |«      ndi}| j                  d«      }| j                  | j	                  ||¬«      d«      S )a»  
        Retrieve a list of tasks.

        Args:
            filters (dict): A map of filters to process on the tasks list.
                Valid filters: ``id``, ``name``, ``service``, ``node``,
                ``label`` and ``desired-state``.

        Returns:
            (:py:class:`list`): List of task dictionaries.

        Raises:
            :py:class:`docker.errors.APIError`
                If the server returns an error.
        r}   Nz/tasksro   T)r   r   rU   r]   rq   )r_   r}   rp   re   s       r   ÚtaskszServiceApiMixin.tasksW  sM   € ð& ¹”u×,Ñ,¨WÔ5Àdð
ˆð �i‰i˜Ó!ˆØ�|‰|˜DŸI™I c°&˜IÓ9¸4Ó@Ð@r   c                 ó@  — t        | j                  |||
|«       |r;d}t        j                  | j                  d«      rd}| j	                  ||¬«      d   }ni }| j                  d|«      }i }i }|€|j                  d«      n||d<   |€|j                  d«      n||d<   |�!t        |t        «      st        |«      }||d	<   n|j                  d	«      |d	<   t        |j                  d
i «      |«      |d
<   |d
   j                  di «      }|j                  dd«      }|�5t        j                  |«      \  }}t        j                  | |«      }|r||d<   |�||d<   n|j                  d«      |d<   |�||d<   n|j                  d«      |d<   |�Dt        j                  |«      }t        j                  | j                  d«      r||d<   n’||d
   d<   n‰t        j                  | j                  d«      r|j                  d«      |d<   nT|d
   j                  d«      €@|j                  d
i «      }|j                  d«      }|€|j                  d«      }|�||d
   d<   |
�|
|d<   n|j                  d«      |d<   | j                  ||d|i|¬«      }| j!                  |d¬«      S )a€  
        Update a service.

        Args:
            service (string): A service identifier (either its name or service
                ID).
            version (int): The version number of the service object being
                updated. This is required to avoid conflicting writes.
            task_template (TaskTemplate): Specification of the updated task to
                start as part of the service.
            name (string): New name for the service. Optional.
            labels (dict): A map of labels to associate with the service.
                Optional.
            mode (ServiceMode): Scheduling mode for the service (replicated
                or global). Defaults to replicated.
            update_config (UpdateConfig): Specification for the update strategy
                of the service. Default: ``None``.
            rollback_config (RollbackConfig): Specification for the rollback
                strategy of the service. Default: ``None``
            networks (:py:class:`list`): List of network names or IDs or
                :py:class:`~docker.types.NetworkAttachmentConfig` to attach the
                service to. Default: ``None``.
            endpoint_spec (EndpointSpec): Properties that can be configured to
                access and load balance a service. Default: ``None``.
            fetch_current_spec (boolean): Use the undefined settings from the
                current specification of the service. Default: ``False``

        Returns:
            A dictionary containing a ``Warnings`` key.

        Raises:
            :py:class:`docker.errors.APIError`
                If the server returns an error.
        Tr   N)rr   rŠ   z/services/{0}/updaterK   rL   rN   rM   r#   rH   rI   rP   rQ   r   rJ   rO   r4   )rR   rp   rS   )Újson)r9   rT   r   r2   rs   rU   r   rW   rX   r   rD   r   rY   rZ   r\   r^   r]   )r_   rk   r4   r5   r`   ra   rb   r6   rc   rd   r7   Úfetch_current_specr   Úinspect_defaultsr=   re   rR   rS   r8   rf   rg   rh   ri   Úconverted_networksÚcurrent_task_templateÚcurrent_networksrz   s                              r   Úupdate_servicezServiceApiMixin.update_serviceo  sà  € ôT 	Ø�M‰M˜=¨-¸Øô	
ñ
 Ø#ÐÜ×Ñ §¡¨vÔ6Ø#'Ð Ø×*Ñ*ØÐ)9ð +ó àñ‰Gð
 ˆGà�i‰iÐ.°Ó8ˆØˆØˆà.2¨l�w—{‘{ 6Ô*ÀˆˆV‰à28°.˜Ÿ™ XÔ.ÀfˆˆX‰àÐÜ˜d¤DÔ)Ü" 4Ó(�ØˆD�ŠLà"Ÿ;™; vÓ.ˆD�‰Lä3Ø�K‰K˜¨Ó+¨]ó 
ˆˆ^Ñð ˜nÑ-×1Ñ1°/À2ÓFˆØ×"Ñ" 7¨DÓ1ˆØÐÜ"&×">Ñ">¸uÓ"EÑˆH�iÜ×0Ñ0°°xÓ@ˆKÙØ-8�Ð)Ñ*àÐ$Ø#0ˆD�Ò à#*§;¡;¨~Ó#>ˆD�Ñ àÐ&Ø%4ˆDÐ!Ò"à%,§[¡[Ð1AÓ%BˆDÐ!Ñ"àÐÜ!&×!?Ñ!?ÀÓ!IÐÜ×Ñ §¡¨vÔ6Ø#5��ZÒ à3E��^Ñ$ ZÒ0Ü×Ñ˜dŸm™m¨VÔ4Ø&Ÿ{™{¨:Ó6ˆD�ÒØ�.Ñ!×%Ñ% jÓ1Ð9Ø$+§K¡K°ÀÓ$CÐ!Ø4×8Ñ8¸ÓDÐØÐ'Ø#*§;¡;¨zÓ#:Ð ØÐ+Ø3C��^Ñ$ ZÑ0àÐ$Ø#0ˆD�Ò à#*§;¡;¨~Ó#>ˆD�Ñ à�‰Ø�d I¨wÐ#7Àð ó 
ˆð �|‰|˜D tˆ|Ó,Ð,r   )NNNNNNNN)N)NN)FFFFé    FÚallN)
NNNNNNNNFN)Ú__name__Ú
__module__Ú__qualname__r   Úminimum_versionrj   Úcheck_resourcers   rv   r{   r€   rŽ   r�   r˜   © r   r   rF   rF   r   sž  „ Ø€U×Ñ˜6Ó"à>BØ?CØ04òI
ó #ðI
ðV €U×Ñ˜6Ó"Ø€U×Ñ˜)Ó$òAó %ó #ðAð8 €U×Ñ˜6Ó"Ø€U×Ñ˜&Ó!ñ2ó "ó #ð2ð" €U×Ñ˜6Ó"Ø€U×Ñ˜)Ó$ñó %ó #ðð( €U×Ñ˜6Ó"òAó #ðAð< €U×Ñ˜6Ó"Ø€U×Ñ˜)Ó$ØHMØCHØ ò.7ó %ó #ð.7ð` €U×Ñ˜6Ó"òAó #ðAð. €U×Ñ˜6Ó"Ø€U×Ñ˜)Ó$ØHLØ=AØ6:Ø>CØ'+ò	u-ó %ó #ñu-r   rF   N)	Ú r   r   r   Útypesr   r9   rD   rF   r    r   r   ú<module>r£      s'   ðß "Ñ "Ý ò[Oò|÷t-ò t-r   