otcextensions.sdk.obs.v1.container

The OBS Container (Bucket) Class

The Container class inherits from Resource.

class otcextensions.sdk.obs.v1.container.Container(_synchronized=False, connection=None, **attrs)

The base resource

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

  • connection (openstack.connection.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.

resources_key: ty.Optional[str] = 'Buckets'

Plural form of key for resource.

resource_key: ty.Optional[str] = 'Bucket'

Singular form of key for resource.

allow_head = True

Allow head operation for this resource.

allow_list = True

Allow list operation for this resource.

allow_create = True

Allow create operation for this resource.

allow_delete = True

Allow delete operation for this resource.

create_method = 'PUT'

Method for creating a resource (POST, PUT)

base_path: str = '/'

The base part of the URI for this resource.

requires_id = None

Do calls for this resource require an id

name: ty.Union[Body, URI]

The name of this resource.

classmethod list(session, paginated=False, endpoint_override=None, headers=None, requests_auth=None, **params)

Override default list to incorporate endpoint overriding and custom headers

Since SDK Resource.list method is passing hardcoded headers do override the function

This resource object list generator handles pagination and takes query params for response filtering.

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

  • paginated (bool) – True if a GET to this resource returns a paginated series of responses, or False if a GET returns only one page of data. When paginated is False only one page of data will be returned regardless of the API’s support of pagination.

  • params (dict) – These keyword arguments are passed through the _transpose() method to find if any of them match expected query parameters to be sent in the params argument to get(). They are additionally checked against the base_path format string to see if any path fragments need to be filled in by the contents of this argument.

Returns:

A generator of Resource objects.

Raises:

MethodNotSupported if Resource.allow_list is not set to True.

Raises:

InvalidResourceQuery if query contains invalid params.

create(session, prepend_key=True, endpoint_override=None, headers=None, requests_auth=None)

Create a remote resource based on this instance.

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

  • prepend_key – A boolean indicating whether the resource_key should be prepended in a resource creation request. Default to True.

Returns:

This Resource instance.

Raises:

MethodNotSupported if Resource.allow_create is not set to True.