A resource ID is a Divvy specific, colon delimited primary key identifier, which denotes the type, organization service, region and cloud provider ID of a resource. As an example, let’s say that you had an instance within the us-east-1 region of Amazon Web Services (AWS) within organization service 10. The resource ID of this particular instance within the DivvyCloud system would look like this:
The format of the resource ID is as follows:
Forming a Resource ID¶
You can form a resource ID object from a string to gain access to a number of functions. Let’s go back to our earlier ID, instance:10:us-east-1:i-6a8f369b:. We can form an object using this string with the code below. The code also shows all of the functions available to you.
>>> from DivvyResource.ResourceIds import ResourceId >>> resource_id = ResourceId.from_string('instance:10:us-east-1:i-6a8f369b:') >>> print dir(resource_id) ['_get_id_fields', 'extra', 'from_string', 'from_string_or_none', 'from_type_location_id', 'get_id', 'get_type', 'instance_id', 'is_billable_resource', 'is_top_level_resource', 'organization_service_id', 'region', 'to_string']