Skip to content

create_container async

create_container(
    container_name: ContainerName,
    *,
    config_overrides: Optional[AsyncMediaStoreClientConfig] = None,
    tags: Optional[TagList] = None,
) -> CreateContainerOutput

Creates a storage container to hold objects. A container is similar to a bucket in the Amazon S3 service.

Parameters:

  • container_name (ContainerName) –

    The name for the container. The name must be from 1 to 255 characters. Container names must be unique to your AWS account within a specific region. As an example, you could create a container named movies in every region, as long as you don’t have an existing container with that name.

  • tags (Optional[TagList], default: None ) –

    An array of key:value pairs that you define. These values can be anything that you want. Typically, the tag key represents a category (such as "environment") and the tag value represents a specific value within that category (such as "test," "development," or "production"). You can add up to 50 tags to each container. For more information about tagging, including naming and usage conventions, see Tagging Resources in MediaStore.

Raises:

Source code in docs_src/capo_mediastore/_services/async_media_store.py
async def create_container(
    self,
    container_name: "capo_mediastore.types.container_name.ContainerName",
    *,
    config_overrides: Optional[AsyncMediaStoreClientConfig] = None,
    tags: Optional["capo_mediastore.types.tag_list.TagList"] = None,
) -> "capo_mediastore.types.create_container_output.CreateContainerOutput":
    """<p>Creates a storage container to hold objects. A container is similar to a bucket in the Amazon S3 service.</p>

    Args:
        container_name: <p>The name for the container. The name must be from 1 to 255 characters. Container names must be unique to your AWS account within a specific region. As an example, you could create a container named <code>movies</code> in every region, as long as you don’t have an existing container with that name.</p>
        tags: <p>An array of key:value pairs that you define. These values can be anything that you want. Typically, the tag key represents a category (such as "environment") and the tag value represents a specific value within that category (such as "test," "development," or "production"). You can add up to 50 tags to each container. For more information about tagging, including naming and usage conventions, see <a href="https://docs.aws.amazon.com/mediastore/latest/ug/tagging.html">Tagging Resources in MediaStore</a>.</p>

    Raises:
        capo_mediastore.errors.container_in_use_exception.ContainerInUseException: <p>The container that you specified in the request already exists or is being updated.</p>
        capo_mediastore.errors.internal_server_error.InternalServerError: <p>The service is temporarily unavailable.</p>
        capo_mediastore.errors.limit_exceeded_exception.LimitExceededException: <p>A service limit has been exceeded.</p>
        capo_mediastore.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_mediastore.types.create_container_input.CreateContainerInput]",
    ) -> AsyncOperationResponse[
        "capo_mediastore.types.create_container_output.CreateContainerOutput"
    ]:
        import capo_mediastore._operations.media_store_20170901.create_container

        (
            output,
            http_response,
        ) = await capo_mediastore._operations.media_store_20170901.create_container.async_create_container(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateContainer")
    )
    input_: capo_mediastore.types.create_container_input.CreateContainerInput = {
        "container_name": container_name
    }
    if tags is not None:
        input_["tags"] = tags

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output