openstack.placement.v1.trait

The Trait Class

The Trait class inherits from Resource.

class openstack.placement.v1.trait.Trait(_synchronized=False, connection=None, **attrs)

The base resource

Parameters:
  • _synchronized – This is not intended to be used directly. See new() and existing().

  • 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._connection in 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 = '/traits'

The base part of the URI for this resource.

allow_create = True

Allow create operation for this resource.

create_method = 'PUT'

DEPRECATED: Use create_opts.method instead. Method for creating a resource.

allow_fetch = True

Allow get operation for this resource.

allow_delete = True

Allow delete operation for this resource.

allow_list = True

Allow list operation for this resource.

create_opts = CreateOpts(request_key=<Unset.UNSET: 'UNSET'>, response_key=<Unset.UNSET: 'UNSET'>, method='PUT', requires_id=<Unset.UNSET: 'UNSET'>, has_body=<Unset.UNSET: 'UNSET'>)

Class-level configuration for the create operation. Subclasses can override this to set per-resource defaults without overriding create().

name

The name of this resource.

create(session, prepend_key=True, base_path=None, *, microversion=None, **kwargs)

Create a remote resource based on this instance.

Parameters:
  • session – The session to use for making this request.

  • prepend_key – DEPRECATED Configure create_opts instead. Whether the resource_key should be prepended in a resource creation request. Default to True.

  • base_path – Base part of the URI for creating resources, if different from base_path.

  • resource_request_key – DEPRECATED Configure create_opts instead. Overrides the usage of resource_key when prepending a key to the request body. Ignored if prepend_key is false.

  • resource_response_key – DEPRECATED Configure create_opts instead. Overrides the usage of resource_key when processing response bodies. Ignored if prepend_key is false.

  • microversion – API version to override the negotiated one.

  • params – Additional params to pass.

Returns:

This Resource instance.

Raises:

MethodNotSupported if Resource.allow_create is not set to True.

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 the list of strings (as opposed to a list of objects) that this call returns.

Refer to list() for full documentation including parameter, exception and return type documentation.