openstack.placement.v1.usage¶
The Usage Class¶
The Usage class inherits from
Resource.
- class openstack.placement.v1.usage.Usage(_synchronized=False, connection=None, **attrs)¶
Resource usage for one consumer type within a project.
Represents one entry from the
usagesdict returned byGET /usages. Each entry is keyed by consumer type (e.g.INSTANCE,MIGRATION) and contains:consumer_count— the number of consumers of that type with active allocations in the project.resources— a dict of resource class name to total amount consumed across all consumers of that type.
Available from placement microversion 1.38. Call
usages()to retrieve instances.The base resource
- Parameters:
_synchronized – This is not intended to be used directly. See
new()andexisting().connection – Reference to the Connection being used. Defaults to None to allow Resource objects to be used without an active Connection, such as in unit tests. Use of
self._connectionin Resource code should protect itself with a check for None.
- resource_key = None¶
Singular form of key for resource.
- resources_key = None¶
Plural form of key for resource.
- base_path = '/usages'¶
The base part of the URI for this resource.
- requires_id = False¶
Do calls for this resource require an ID.
- allow_list = True¶
Allow list operation for this resource.
- consumer_type¶
The consumer type string, e.g.
INSTANCEorMIGRATION.
- consumer_count¶
The number of consumers of this type with active allocations.
- resources¶
A dict of resource class name to total amount consumed across all consumers of this type, e.g.
{"VCPU": 2, "DISK_GB": 5}.
- classmethod list(session, paginated=True, base_path=None, allow_unknown_params=False, *, microversion=None, **params)¶
This method is a generator which yields resource objects.
A re-implementation of
list()that handles theGET /usagesresponse format. The API returns a singleusagesdict keyed by consumer type; this method yields oneUsageper entry, with the per-resource-class amounts packed into theresourcesfield.Refer to
list()for full documentation including parameter, exception and return type documentation.