(
argument_table, operation_model, event_name, session, **kwargs
)
| 131 | |
| 132 | |
| 133 | def unify_paging_params( |
| 134 | argument_table, operation_model, event_name, session, **kwargs |
| 135 | ): |
| 136 | paginator_config = get_paginator_config( |
| 137 | session, |
| 138 | operation_model.service_model.service_name, |
| 139 | operation_model.name, |
| 140 | ) |
| 141 | if paginator_config is None: |
| 142 | # We only apply these customizations to paginated responses. |
| 143 | return |
| 144 | logger.debug( |
| 145 | "Modifying paging parameters for operation: %s", operation_model.name |
| 146 | ) |
| 147 | _remove_existing_paging_arguments(argument_table, paginator_config) |
| 148 | parsed_args_event = event_name.replace( |
| 149 | 'building-argument-table.', 'operation-args-parsed.' |
| 150 | ) |
| 151 | call_parameters_event = event_name.replace( |
| 152 | 'building-argument-table', 'calling-command' |
| 153 | ) |
| 154 | shadowed_args = {} |
| 155 | add_paging_argument( |
| 156 | argument_table, |
| 157 | 'starting-token', |
| 158 | PageArgument( |
| 159 | 'starting-token', |
| 160 | STARTING_TOKEN_HELP, |
| 161 | parse_type='string', |
| 162 | serialized_name='StartingToken', |
| 163 | ), |
| 164 | shadowed_args, |
| 165 | ) |
| 166 | input_members = operation_model.input_shape.members |
| 167 | type_name = 'integer' |
| 168 | if 'limit_key' in paginator_config: |
| 169 | limit_key_shape = input_members[paginator_config['limit_key']] |
| 170 | type_name = limit_key_shape.type_name |
| 171 | if type_name not in PageArgument.type_map: |
| 172 | raise TypeError( |
| 173 | ( |
| 174 | 'Unsupported pagination type {0} for operation {1}' |
| 175 | ' and parameter {2}' |
| 176 | ).format( |
| 177 | type_name, |
| 178 | operation_model.name, |
| 179 | paginator_config['limit_key'], |
| 180 | ) |
| 181 | ) |
| 182 | add_paging_argument( |
| 183 | argument_table, |
| 184 | 'page-size', |
| 185 | PageArgument( |
| 186 | 'page-size', |
| 187 | PAGE_SIZE_HELP, |
| 188 | parse_type=type_name, |
| 189 | serialized_name='PageSize', |
| 190 | shape_metadata=limit_key_shape.metadata, |
nothing calls this directly
no test coverage detected