Skip to content

YamlResourceNode

Bases: ResourceNode

__init__(service_node, name, operation_names, yaml_config=None)

Initializes the YamlResourceNode with yaml_config.

Parameters:

Name Type Description Default
service_node ServiceNode

ServiceNode object

required
name str

Name of the ResourceNode

required
operation_names List[str]

Names of the ResourceNode's operations

required
yaml_config Dict

Yaml Configuration defined in the custom_yamls/*. Defaults to None.

None

complement_api_parameters_list(operation_name, related_operations_data, relations_of_operation, raw_api_parameters_list)

After the api parameter genereation is done, this function will be called for each api_parameter generated to complement(add/remove parameters) it.

Example yaml_config def. for complement_api_parameters
# This option overrides the `complement_api_parameters_list` function.
complement_api_parameters:
# This option will be evoked after api parameter generation is
# complete. You can use this feature to add key/value pairs,
- action: add
  data:
    any: data
    is: OK
    to: add
#  or remove keys from all generated API parameters.
- action: remove
  keys:
    - remove
    - these
    - keys

Parameters:

Name Type Description Default
operation_name str

description

required
related_operations_data Union[List, Dict]

description

required
relations_of_operation List[Dict]

description

required
raw_api_parameters_list List

description

required

Returns:

Name Type Description
List List

description

define_extra_relations()

Reads the Yaml Configuration for extra_relations defined, and returns the Relation objects.

Returns:

Type Description
Union[List[Dict], List[Relation]]

Union[List[Dict], List[Relation]]: Extra relations if they're defined in the Yaml configuration.

generate_api_parameters_from_operation_data(operation_name, relations_of_operation, related_operations_data)

Finds the override_api_parameters in the yaml_config for the selected operation.

Parameters:

Name Type Description Default
operation_name str

AWS Operation name

required
relations_of_operation List[Dict]

Relation obj list for the Operation

required
related_operations_data Union[List, Dict]

Related operations are called beforehand and this is their data.

required

Returns:

Type Description
Tuple[Union[List, bool], Union[Error, None]]

Tuple[Union[List, bool], Union[Error, None]]: (value, error) tuple.

generate_jmespath_selector_from_relations(operation_name, relation_list)

Finds the jmespath_selector definition in the yaml_config for the selected Operation.

Parameters:

Name Type Description Default
operation_name str

AWS Operation name.

required
relation_list List[Dict]

List of relations for the operation

required

Returns:

Name Type Description
str str

JMESPath selector string for extracting api parameters.

get_operations_relations(operation_name)

Finds the defined explicit_relations in the yaml_config for the given operation.

Parameters:

Name Type Description Default
operation_name str

AWS Operation Name.

required

Returns:

Type Description
Tuple[Union[List[Dict], bool], Union[Error, None]]

Tuple[Union[List[Dict], bool], Union[Error, None]]: Returns (value, error) tuple.

get_pagination_token_output_to_parameter_name_mapping(operation_name)

Tries to find the pagination token in the yaml_config for the given operation.

pagination_token_output_to_parameter_name_mapping example
{
    "parameter_name": "",
    "output_key": ""
}

Parameters:

Name Type Description Default
operation_name str

AWS Operation name.

required

Returns:

Type Description
Union[Dict[str, str], bool]

Union[Dict[str, str], bool]: A dictionary with pagination token as key and parameter name as value.

Union[Dict[str, str], bool]

If no pagination token is defined, then returns False.