File: //lib/python3/dist-packages/awscli/customizations/__pycache__/paginate.cpython-310.pyc
o
.&�a�. � @ s� d Z ddlZddlmZ ddlmZ ddlmZmZ ddlm Z ddl
mZ e�e
�ZdZd Zd
Zdd� Zd
d� Zdd� Zdd� Zdd� Zdd� Zdd� Zdd� Zdd� Zdd� Zdd � ZG d!d"� d"e�ZdS )#a' This module has customizations to unify paging paramters.
For any operation that can be paginated, we will:
* Hide the service specific pagination params. This can vary across
services and we're going to replace them with a consistent set of
arguments. The arguments will still work, but they are not
documented. This allows us to add a pagination config after
the fact and still remain backwards compatible with users that
were manually doing pagination.
* Add a ``--starting-token`` and a ``--max-items`` argument.
� N)�partial)�
xform_name)�DataNotFoundError�PaginationError)�model)�BaseCLIArgumenta/
<p>A token to specify where to start paginating. This is the
<code>NextToken</code> from a previously truncated response.</p>
<p>For usage examples, see <a
href="https://docs.aws.amazon.com/cli/latest/userguide/pagination.html"
>Pagination</a> in the <i>AWS Command Line Interface User
Guide</i>.</p>
a`
<p>The total number of items to return in the command's output.
If the total number of items available is more than the value
specified, a <code>NextToken</code> is provided in the command's
output. To resume pagination, provide the
<code>NextToken</code> value in the <code>starting-token</code>
argument of a subsequent command. <b>Do not</b> use the
<code>NextToken</code> response element directly outside of the
AWS CLI.</p>
<p>For usage examples, see <a
href="https://docs.aws.amazon.com/cli/latest/userguide/pagination.html"
>Pagination</a> in the <i>AWS Command Line Interface User
Guide</i>.</p>
a�
<p>The size of each page to get in the AWS service call. This
does not affect the number of items returned in the command's
output. Setting a smaller page size results in more calls to
the AWS service, retrieving fewer items in each call. This can
help prevent the AWS service calls from timing out.</p>
<p>For usage examples, see <a
href="https://docs.aws.amazon.com/cli/latest/userguide/pagination.html"
>Pagination</a> in the <i>AWS Command Line Interface User
Guide</i>.</p>
c C s | � dt� | �dt� d S )Nzbuilding-argument-tablezdoc-description)�register�unify_paging_params�
register_last�add_paging_description)�event_handlers� r
�@/usr/lib/python3/dist-packages/awscli/customizations/paginate.py�register_paginationL s r c C sJ z| � |�}W n
ty Y d S w z|�|�}W |S ty$ Y d S w �N)�get_paginator_modelr �
get_paginator�
ValueError)�session�service_name�operation_name�paginator_model�operation_paginator_configr
r
r �get_paginator_configQ s ����r c K s� t | jtj�s d S | jjj}t| j|| jj�}|sd S | j j
�� | j �d| j � |�
d�rP|d }t|�tur<|g}d�dd� |D ��}| j �d| � d S d S )Nz�``%s`` is a paginated operation. Multiple API calls may be issued in order to retrieve the entire data set of results. You can disable pagination by providing the ``--no-paginate`` argument.�
result_key�, c S s g | ]}d | �qS )z``%s``r
)�.0�sr
r
r �
<listcomp>s s z*add_paging_description.<locals>.<listcomp>z�When using ``--output text`` and the ``--query`` argument on a paginated response, the ``--query`` argument must extract data from the results of the following query expressions: %s)�
isinstance�objr �OperationModel�
service_modelr r r �name�doc�style�
new_paragraph�writeln�get�type�list�join)�help_command�kwargsr �paginator_config�queriesr
r
r r ^ s2
���
���r c K s� t ||jj|j�}|d u rd S t�d|j� t| |� |�dd�}i }t| dt dt
ddd�|� |jj}d} d |v ra||d }
|
j
} | t jvrTtd
�| |j|d ���t| dt dt| dd�|� t| d
t d
t| dd�|� |�|tttt|��|| �� d S )Nz-Modifying paging parameters for operation: %szbuilding-argument-table.zoperation-args-parsed.zstarting-token�string�
StartingToken)�
parse_type�serialized_name�integer� limit_keyzCUnsupported pagination type {0} for operation {1} and parameter {2}z page-size�PageSizez max-items�MaxItems)r r"