boto3.resources.params

Module Contents

INDEX_RE
get_data_member(parent, path)

Get a data member from a parent using a JMESPath search query, loading the parent if required. If the parent cannot be loaded and no data is present then an exception is raised.

Parameters:
  • parent (ServiceResource) – The resource instance to which contains data we are interested in.
  • path (string) – The JMESPath expression to query
Raises:

ResourceLoadException – When no data is present and the resource cannot be loaded.

Returns:

The queried data or None.

create_request_parameters(parent, request_model, params=None, index=None)

Handle request parameters that can be filled in from identifiers, resource data members or constants.

By passing params, you can invoke this method multiple times and build up a parameter dict over time, which is particularly useful for reverse JMESPath expressions that append to lists.

Parameters:
  • parent (ServiceResource) – The resource instance to which this action is attached.
  • request_model (Request) – The action request model.
  • params (dict) – If set, then add to this existing dict. It is both edited in-place and returned.
  • index (int) – The position of an item within a list
Return type:

dict

Returns:

Pre-filled parameters to be sent to the request operation.

build_param_structure(params, target, value, index=None)

This method provides a basic reverse JMESPath implementation that lets you go from a JMESPath-like string to a possibly deeply nested object. The params are mutated in-place, so subsequent calls can modify the same element by its index.

>>> build_param_structure(params, 'test[0]', 1)
>>> print(params)
{'test': [1]}
>>> build_param_structure(params, 'foo.bar[0].baz', 'hello world')
>>> print(params)
{'test': [1], 'foo': {'bar': [{'baz': 'hello, world'}]}}