�
K�g�% � �� � d dl Z d dlmZ d dlmZ d dlmZ ddlmZ ddl m
Z
ddlmZm
Z
e j e� � Z G d � d
� � Z G d� de� � Z G d
� d� � Z G d� d� � ZdS )� N)�
xform_name)�ActionDocstring)�inject_attribute� )�Action)�create_request_parameters)�
RawHandler�ResourceHandlerc � � e Zd ZdZdd�Zd� ZdS )�
ServiceActiona�
A class representing a callable action on a resource, for example
``sqs.get_queue_by_name(...)`` or ``s3.Bucket('foo').delete()``.
The action may construct parameters from existing resource identifiers
and may return either a raw response or a new resource instance.
:type action_model: :py:class`~boto3.resources.model.Action`
:param action_model: The action model.
:type factory: ResourceFactory
:param factory: The factory that created the resource class to which
this action is attached.
:type service_context: :py:class:`~boto3.utils.ServiceContext`
:param service_context: Context about the AWS service
Nc � � || _ |j }|r*t |j ||||j j �� � | _ d S t |j � � | _ d S )N)�search_path�factory�resource_model�service_context�operation_name)�
_action_model�resourcer
�path�request� operation�_response_handlerr )�self�action_modelr r �resource_response_models �f/home/asafur/pinokio/api/open-webui.git/app/env/lib/python3.11/site-packages/boto3/resources/action.py�__init__zServiceAction.__init__. sn � �)��� #/�"7��"� C�%4�3�8��6� /�+�3�=�&� &� &�D�"�"�"� &0��0A�%B�%B�D�"�"�"� c � � t | j j j � � }t || j j � � }|� |� � t � d|j j ||� � t |j j |� � |i |��}t � d|� � | � |||� � S )a�
Perform the action's request operation after building operation
parameters and build any defined resources from the response.
:type parent: :py:class:`~boto3.resources.base.ServiceResource`
:param parent: The resource instance to which this action is attached.
:rtype: dict or ServiceResource or list(ServiceResource)
:return: The response, either as a raw dict or resource instance(s).
�Calling %s:%s with %r�Response: %r)
r r r r r �update�logger�debug�meta�service_name�getattr�clientr )r �parent�args�kwargsr �params�responses r �__call__zServiceAction.__call__? s� � � $�D�$6�$>�$H�I�I��
+�6�4�3E�3M�N�N���
�
�f�������#��K�$���
�
�
� ?�7�6�;�-�~�>�>��O��O�O�����^�X�.�.�.��%�%�f�f�h�?�?�?r )NN��__name__�
__module__�__qualname__�__doc__r r. � r r r r sJ � � � � � �� �"C� C� C� C�"@� @� @� @� @r r c � � e Zd ZdZd� ZdS )�BatchActiona�
An action which operates on a batch of items in a collection, typically
a single page of results from the collection's underlying service
operation call. For example, this allows you to delete up to 999
S3 objects in a single operation rather than calling ``.delete()`` on
each one individually.
:type action_model: :py:class`~boto3.resources.model.Action`
:param action_model: The action model.
:type factory: ResourceFactory
:param factory: The factory that created the resource class to which
this action is attached.
:type service_context: :py:class:`~boto3.utils.ServiceContext`
:param service_context: Context about the AWS service
c �> � d}d}g }t | j j j � � }|� � � D ]�}i } t |� � D ]>\ }
}|�|j j }|�|j j }t || j j | |
�� � �?| s n�| �
|� � t � d||| � � t ||� � |i | ��}t � d|� � |� | � || |� � � � ��|S )a�
Perform the batch action's operation on every page of results
from the collection.
:type parent:
:py:class:`~boto3.resources.collection.ResourceCollection`
:param parent: The collection iterator to which this action
is attached.
:rtype: list(dict)
:return: A list of low-level response dicts from each call.
N)r, �indexr r! )r r r r �pages� enumerater% r&