The ironicclient.common.apiclient.base Module¶
Base utilities to build API operation managers and objects on top of.
-
class
ironicclient.common.apiclient.base.BaseManager(client)[source]¶ Bases:
ironicclient.common.apiclient.base.HookableMixinBasic 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¶
-
-
class
ironicclient.common.apiclient.base.CrudManager(client)[source]¶ Bases:
ironicclient.common.apiclient.base.BaseManagerBase manager class for manipulating entities.
Children of this class are expected to define a collection_key and key.
- collection_key: Usually a plural noun by convention (e.g. entities); used to refer collections in both URL’s (e.g. /v3/entities) and JSON objects containing a list of member resources (e.g. {‘entities’: [{}, {}, {}]}).
- key: Usually a singular noun by convention (e.g. entity); used to refer to an individual member of the collection.
-
build_url(base_url=None, **kwargs)[source]¶ 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¶
-
find(base_url=None, **kwargs)[source]¶ Find a single item with attributes matching
**kwargs.Parameters: base_url – if provided, the generated URL will be appended to it
-
key= None¶
-
list(base_url=None, **kwargs)[source]¶ List the collection.
Parameters: base_url – if provided, the generated URL will be appended to it
-
class
ironicclient.common.apiclient.base.Extension(name, module)[source]¶ Bases:
ironicclient.common.apiclient.base.HookableMixinExtension descriptor.
-
SUPPORTED_HOOKS= ('__pre_parse_args__', '__post_parse_args__')¶
-
manager_class= None¶
-
-
class
ironicclient.common.apiclient.base.HookableMixin[source]¶ Bases:
objectMixin so classes can register and run hooks.
-
class
ironicclient.common.apiclient.base.ManagerWithFind(client)[source]¶ Bases:
ironicclient.common.apiclient.base.BaseManagerManager with additional find()/findall() methods.
-
find(**kwargs)[source]¶ Find a single item with attributes matching
**kwargs.This isn’t very efficient: it loads the entire list then filters on the Python side.
-
-
class
ironicclient.common.apiclient.base.Resource(manager, info, loaded=False)[source]¶ Bases:
objectBase class for OpenStack resources (tenant, user, etc.).
This is pretty much just a bag for attributes.
-
HUMAN_ID= False¶
-
NAME_ATTR= 'name'¶
-
get()[source]¶ Support for lazy loading details.
Some clients, such as novaclient have the option to lazy load the details, details which can be loaded with this function.
-
human_id¶ Human-readable ID which can be used for bash completion.
-