Util for generic operations for Resources.
cast_to_gcp_resources
(resources_to_cast)[source]¶Get a list Resource objects from a list of dict resource descriptors
Parameters: | resources_to_cast (list) – A list of resource descriptors as dictionaries. [{‘resourceId’: {‘id’: ‘3456’, ‘type’: ‘Project’}} {‘resourceId’: {‘id’: ‘1234’, ‘type’: ‘Organization’}}] |
---|---|
Returns: | A list of cast Resource objects |
Return type: | list |
create_resource
(resource_id, resource_type, **kwargs)[source]¶Factory to create a certain kind of Resource.
Parameters: |
|
---|---|
Returns: | The new Resource based on the type, if supported, otherwise None. |
Return type: |
create_resource_from_db_row
(row)[source]¶Create a resource type from a database resource row.
Parameters: | row (Resource) – the database resource row. |
---|---|
Returns: | the concrete resource type. |
Return type: | Resource |
create_resource_from_json
(resource_type, parent, json_string)[source]¶Factory to create a certain kind of Resource from JSON data.
Parameters: |
|
---|---|
Returns: | The new Resource based on the type, if supported, otherwise None. |
Return type: |
get_ancestors_from_full_name
(full_name)[source]¶Creates a Resource for each resource in the full ancestory path.
Parameters: | full_name (str) – The full resource name from the model, includes all parent resources in the hierarchy to the root organization. |
---|---|
Returns: | A list of Resource objects, from parent to base ancestor. |
Return type: | list |