troveclient.apiclient.base Module¶Base utilities to build API operation managers and objects on top of.
troveclient.apiclient.base.BaseManager(client)¶Bases: troveclient.apiclient.base.HookableMixin
Basic manager type providing common operations.
Managers interact with a particular type of API (servers, flavors, images, etc.) and provide CRUD operations for them.
resource_class = None¶troveclient.apiclient.base.CrudManager(client)¶Bases: troveclient.apiclient.base.BaseManager
Base manager class for manipulating entities.
Children of this class are expected to define a collection_key and key.
build_url(base_url=None, **kwargs)¶Builds a resource URL for the given kwargs.
Given an example collection where collection_key = ‘entities’ and key = ‘entity’, the following URL’s could be generated.
By default, the URL will represent a collection of entities, e.g.:
/entities
If kwargs contains an entity_id, then the URL will represent a specific member, e.g.:
/entities/{entity_id}
| Parameters: | base_url – if provided, the generated URL will be appended to it |
|---|
collection_key = None¶create(**kwargs)¶delete(**kwargs)¶find(base_url=None, **kwargs)¶Find a single item with attributes matching **kwargs.
| Parameters: | base_url – if provided, the generated URL will be appended to it |
|---|
get(**kwargs)¶head(**kwargs)¶key = None¶list(base_url=None, **kwargs)¶List the collection.
| Parameters: | base_url – if provided, the generated URL will be appended to it |
|---|
put(base_url=None, **kwargs)¶Update an element.
| Parameters: | base_url – if provided, the generated URL will be appended to it |
|---|
update(**kwargs)¶troveclient.apiclient.base.Extension(name, module)¶Bases: troveclient.apiclient.base.HookableMixin
Extension descriptor.
SUPPORTED_HOOKS = ('__pre_parse_args__', '__post_parse_args__')¶manager_class = None¶troveclient.apiclient.base.HookableMixin¶Bases: object
Mixin so classes can register and run hooks.
add_hook(hook_type, hook_func)¶Add a new hook of specified type.
| Parameters: |
|
|---|
run_hooks(hook_type, *args, **kwargs)¶Run all hooks of specified type.
| Parameters: |
|
|---|
troveclient.apiclient.base.ManagerWithFind(client)¶Bases: troveclient.apiclient.base.BaseManager
Manager 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.
list()¶troveclient.apiclient.base.Resource(manager, info, loaded=False)¶Bases: object
Base class for OpenStack resources (tenant, user, etc.).
This is pretty much just a bag for attributes.
HUMAN_ID = False¶NAME_ATTR = 'name'¶human_id¶Human-readable ID which can be used for bash completion.
is_loaded¶to_dict()¶troveclient.apiclient.base.getid(obj)¶Return id if argument is a Resource.
Abstracts the common pattern of allowing both an object or an object’s ID (UUID) as a parameter when dealing with relationships.
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.