Util for generic operations for Resources.

create_resource(resource_id, resource_type, **kwargs)[source]

Factory to create a certain kind of Resource.

  • resource_id (str) – The resource id.
  • resource_type (str) – The resource type.
  • **kwargs (dict) – Extra args.

The new Resource based on the type, if supported, otherwise None.

Return type:



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

Determine the pluralized form of the resource type.

Parameters:resource_type (str) – The resource type for which to get its plural form.
Returns:The pluralized version of the resource type, if supported, otherwise None.
Return type:str

Determine resource type from resource name.

Parameters:resource_name (str) – The unique resoure name, with the format “{resource_type}/{resource_id}”.
Returns:The resource type, if it exists, otherwise None.
Return type:str