File: //lib/python3/dist-packages/awscli/customizations/__pycache__/paginate.cpython-38.pyc
U
<�^�. � @ 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_paramsZ
register_last�add_paging_description)Zevent_handlers� r �@/usr/lib/python3/dist-packages/awscli/customizations/paginate.py�register_paginationL s r
c C sP z| � |�}W n tk
r$ Y d S X z|�|�}W n tk
rJ Y d S X |S �N)Zget_paginator_modelr Z
get_paginator�
ValueError)�session�service_nameZoperation_nameZpaginator_modelZoperation_paginator_configr r r �get_paginator_configQ s �r c K s� t | jtj�sd S | jjj}t| j|| jj�}|s6d S | j j
�� | j �d| j � |�
d�r�|d }t|�tk rx|g}d�dd� |D ��}| j �d| � 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.Z
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 ZOperationModel�
service_modelr r r �name�docZstyleZ
new_paragraphZwriteln�get�type�list�join)Zhelp_command�kwargsr �paginator_configZqueriesr r r r
^ s4
���
��r
c K s� t ||jj|j�}|d krd S t�d|j� t| |� |�dd�}i }t| dt dt
ddd�|� |jj}d} d |kr�||d }
|
j
} | t jkr�td
�| |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�stringZ
StartingToken)�
parse_type�serialized_name�integer� limit_keyzCUnsupported pagination type {0} for operation {1} and parameter {2}z page-sizeZPageSizez max-itemsZMaxItems)r r r r �logger�debug�!_remove_existing_paging_arguments�replace�add_paging_argument�PageArgument�STARTING_TOKEN_HELPZinput_shape�members� type_name�type_map� TypeError�format�PAGE_SIZE_HELP�MAX_ITEMS_HELPr r �check_should_enable_paginationr �_get_all_cli_input_tokens)�argument_tableZoperation_modelZ
event_namer r r! Zparsed_args_event�
shadowed_argsZ
input_membersr/ Zlimit_key_shaper r r r { sr ��
���
������
��r c C s || kr| | ||<