troveclient.base module¶
Base utilities to build API operation managers and objects on top of.
- class troveclient.base.Manager(api)¶
Bases:
troveclient.utils.HookableMixin
Manager defining CRUD operations for API.
Managers interact with a particular type of API (servers, flavors, images, etc.) and provide CRUD operations for them.
- completion_cache(cache_type, obj_class, mode)¶
Bash-completion cache.
The completion cache store items that can be used for bash autocompletion, like UUIDs or human-friendly IDs.
A resource listing will clear and repopulate the cache.
A resource create will append to the cache.
Delete is not handled because listings are assumed to be performed often enough to keep the cache reasonably up-to-date.
- resource_class = None¶
- write_to_completion_cache(cache_type, val)¶
- class troveclient.base.ManagerWithFind(api)¶
Bases:
troveclient.base.Manager
Like a Manager, but with additional find()/findall() methods.
- find(**kwargs)¶
Find a single item with attributes matching
**kwargs
.This isn’t very efficient: it loads the entire list then filters on the Python side.
- findall(**kwargs)¶
Find all items with attributes matching
**kwargs
.This isn’t very efficient: it loads the entire list then filters on the Python side.
- abstract list()¶
- class troveclient.base.Resource(manager, info, loaded=False)¶
Bases:
troveclient.apiclient.base.Resource
A resource represents a particular instance of an object like server.
This is pretty much just a bag for attributes. :param manager: Manager object :param info: dictionary representing resource attributes :param loaded: prevent lazy-loading if set to True
- HUMAN_ID = False¶
- troveclient.base.getid(obj)¶
Retrieves an id from object or integer.
Abstracts the common pattern of allowing both an object or an object’s ID as a parameter when dealing with relationships.