# openstack.object_store.v1.container

## The Container Class

The `Container` class inherits from `Resource`.

class openstack.object_store.v1.container.Container(metadata=None, **attrs)

  Process and save metadata known at creation stage

  base_path = '/'

    The base part of the URI for this resource.

  pagination_key = 'X-Account-Container-Count'

    Key used for pagination links

  allow_create = True

    Allow create operation for this resource.

  allow_fetch = True

    Allow get operation for this resource.

  allow_commit = True

    Allow update operation for this resource.

  allow_delete = True

    Allow delete operation for this resource.

  allow_list = True

    Allow list operation for this resource.

  allow_head = True

    Allow head operation for this resource.

  name

    The name of the container.

  count

    The number of objects in the container.

  bytes

    The total number of bytes that are stored in Object Storage for the container.

  object_count

    The number of objects.

  bytes_used

    The count of bytes used in total.

  timestamp

    The timestamp of the transaction.

  is_newest

    If set to True, Object Storage queries all replicas to return the most recent one. If you omit this header, Object Storage responds faster after it finds one valid replica. Because setting this header to True is more expensive for the back end, use it only when it is absolutely needed. Type: bool

  read_ACL

    The ACL that grants read access. If not set, this header is not returned by this operation.

  write_ACL

    The ACL that grants write access. If not set, this header is not returned by this operation.

  sync_to

    The destination for container synchronization. If not set, this header is not returned by this operation.

  sync_key

    The secret key for container synchronization. If not set, this header is not returned by this operation.

  versions_location

    Enables versioning on this container. The value is the name of another container. You must UTF-8-encode and then URL-encode the name before you include it in the header. To disable versioning, set the header to an empty string.

  history_location

    Enables versioning on the container.

  content_type

    The MIME type of the list of names.

  is_content_type_detected

    If set to true, Object Storage guesses the content type based on the file extension and ignores the value sent in the Content-Type header, if present. Type: bool

  storage_policy

    Storage policy used by the container. It is not possible to change policy of an existing container

  if_none_match

    In combination with Expect: 100-Continue, specify an “If-None-Match: *” header to query whether the server already has a copy of the object before any data is sent.

  meta_temp_url_key

    The secret key value for temporary URLs. If not set, this header is not returned by this operation.

  meta_temp_url_key_2

    A second secret key value for temporary URLs. If not set, this header is not returned by this operation.

  classmethod new(**kwargs)

    Create a new instance of this resource.

    When creating the instance set the `_synchronized` parameter of `Resource` to `False` to indicate that the resource does not yet exist on the server side. This marks all attributes passed in `**kwargs` as “dirty” on the resource, and thusly tracked as necessary in subsequent calls such as `update()`.

    Parameters:

      kwargs (dict) – Each of the named arguments will be set as attributes on the resulting Resource object.

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

    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`.

  set_temp_url_key(proxy, key, secondary=False)

    Set the temporary url key for a container.

    Parameters:

      - proxy (`Proxy`) – The proxy to use for making this request.

      - container – The value can be the name of a container or a `Container` instance.

      - key – Text of the key to use.

      - secondary (bool) – Whether this should set the second key. (defaults to False)

this page last updated: 2026-01-16 23:06:19

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.