Relations
Relation
dataclass
Basic dataclass to hold the relation information.
RelationMap
RelationMap represents a mapping ParameterName
to Relations List
.
generate_relation_map()
function generates the RelationMap dictionary for given ServiceNode.
ServiceNode caches the RelationMap dictionary to a file, because calculating it requires a lot of loops.
{
"PolicyArn": [
{
"service_name": "iam",
"resource_node_name": "Policy",
"required_shape_name": "PolicyArn",
"target_shape_name": "Arn",
"target_shape_type": "string",
"operation_name": "ListPolicies",
"target_path": "Policies[*].Arn"
}
],
}
deserialize_relation_map(serialized_relations_map)
Deserializes the RelationMap dictionary from a json serialized dictionary.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
serialized_relations_map |
Dict
|
Json serialized dictionary |
required |
Returns:
Name | Type | Description |
---|---|---|
Dict |
Dict
|
RelationMap dictionary |
generate_relation_map(**kwargs)
get_parameters_generated_relations(parameter_name, exclude_operation_name)
Checks the RelationMap
dictionary for the key: parameter_name
to get the generated relations for the given parameter name.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
parameter_name |
str
|
Parameter name to search for its relations |
required |
exclude_operation_name |
str
|
Exclude the given operation_name across found relation dicts |
required |
Returns:
Type | Description |
---|---|
List[Dict]
|
List[Dict]: List of relations |
get_relations_map(refresh=False)
Tries the fetch the cached RelationMap from file, or generates and saves it to file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
refresh |
bool
|
Disables cache. Defaults to False. |
False
|
Returns:
Name | Type | Description |
---|---|---|
Dict |
Dict
|
|
save_relations_map_to_file(relations_map=None)
Saves the generated relations map to {BALCONY_RELATIONS_DIR}/{service_name}.json
Parameters:
Name | Type | Description | Default |
---|---|---|---|
relations_map |
List[Dict]
|
description. Defaults to None. |
None
|
serialize_relations_map(relations_map)
Serializes the RelationMap dictionary to a json serializable dictionary.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
relations_map |
Dict
|
RelationMap dictionary |
required |
Returns:
Name | Type | Description |
---|---|---|
Dict |
Dict
|
Json serialized dictionary |