Skip to content

create_collection_group async

create_collection_group(
    name: CollectionGroupName,
    standby_replicas: StandbyReplicas,
    *,
    config_overrides: Optional[AsyncOpenSearchServerlessClientConfig] = None,
    description: Optional[str] = None,
    tags: Optional[Tags] = None,
    capacity_limits: Optional[CollectionGroupCapacityLimits] = None,
    generation: Optional[ServerlessGeneration] = None,
    client_token: Optional[ClientToken] = None,
) -> CreateCollectionGroupResponse

Creates a collection group within OpenSearch Serverless. Collection groups let you manage OpenSearch Compute Units (OCUs) at a group level, with multiple collections sharing the group's capacity limits.

For more information, see Managing collection groups.

Parameters:

  • name (CollectionGroupName) –

    The name of the collection group.

  • standby_replicas (StandbyReplicas) –

    Indicates whether standby replicas should be used for a collection group.

  • description (Optional[str], default: None ) –

    A description of the collection group.

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

    An arbitrary set of tags (key–value pairs) to associate with the OpenSearch Serverless collection group.

  • capacity_limits (Optional[CollectionGroupCapacityLimits], default: None ) –

    The capacity limits for the collection group, in OpenSearch Compute Units (OCUs). These limits control the maximum and minimum capacity for collections within the group.

  • generation (Optional[ServerlessGeneration], default: None ) –

    The generation of Amazon OpenSearch Serverless for the collection group. Valid values are CLASSIC and NEXTGEN.

  • client_token (Optional[ClientToken], default: None ) –

    Unique, case-sensitive identifier to ensure idempotency of the request.

Raises:

  • ConflictException –

    When creating a resource, thrown when a resource with the same name already exists or is being created. When deleting a resource, thrown when the resource is not in the ACTIVE, FAILED, or UPDATE_FAILED state.

  • InternalServerException –

    Thrown when an error internal to the service occurs while processing a request.

  • ServiceQuotaExceededException –

    Thrown when you attempt to create more resources than the service allows based on service quotas.

  • ValidationException –

    Thrown when the HTTP request contains invalid input or is missing required input.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_opensearchserverless/_services/async_open_search_serverless.py
async def create_collection_group(
    self,
    name: "capo_opensearchserverless.types.collection_group_name.CollectionGroupName",
    standby_replicas: "capo_opensearchserverless.types.standby_replicas.StandbyReplicas",
    *,
    config_overrides: Optional[AsyncOpenSearchServerlessClientConfig] = None,
    description: Optional[str] = None,
    tags: Optional["capo_opensearchserverless.types.tags.Tags"] = None,
    capacity_limits: Optional[
        "capo_opensearchserverless.types.collection_group_capacity_limits.CollectionGroupCapacityLimits"
    ] = None,
    generation: Optional[
        "capo_opensearchserverless.types.serverless_generation.ServerlessGeneration"
    ] = None,
    client_token: Optional[
        "capo_opensearchserverless.types.client_token.ClientToken"
    ] = None,
) -> "capo_opensearchserverless.types.create_collection_group_response.CreateCollectionGroupResponse":
    """<p>Creates a collection group within OpenSearch Serverless. Collection groups let you manage OpenSearch Compute Units (OCUs) at a group level, with multiple collections sharing the group's capacity limits.</p> <p>For more information, see <a href="https://docs.aws.amazon.com/opensearch-service/latest/developerguide/serverless-collection-groups.html">Managing collection groups</a>.</p>

    Args:
        name: <p>The name of the collection group.</p>
        standby_replicas: <p>Indicates whether standby replicas should be used for a collection group.</p>
        description: <p>A description of the collection group.</p>
        tags: <p>An arbitrary set of tags (key–value pairs) to associate with the OpenSearch Serverless collection group.</p>
        capacity_limits: <p>The capacity limits for the collection group, in OpenSearch Compute Units (OCUs). These limits control the maximum and minimum capacity for collections within the group.</p>
        generation: <p>The generation of Amazon OpenSearch Serverless for the collection group. Valid values are <code>CLASSIC</code> and <code>NEXTGEN</code>.</p>
        client_token: <p>Unique, case-sensitive identifier to ensure idempotency of the request.</p>

    Raises:
        capo_opensearchserverless.errors.conflict_exception.ConflictException: <p>When creating a resource, thrown when a resource with the same name already exists or is being created. When deleting a resource, thrown when the resource is not in the ACTIVE, FAILED, or UPDATE_FAILED state.</p>
        capo_opensearchserverless.errors.internal_server_exception.InternalServerException: <p>Thrown when an error internal to the service occurs while processing a request.</p>
        capo_opensearchserverless.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>Thrown when you attempt to create more resources than the service allows based on service quotas.</p>
        capo_opensearchserverless.errors.validation_exception.ValidationException: <p>Thrown when the HTTP request contains invalid input or is missing required input.</p>
        capo_opensearchserverless.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_opensearchserverless.types.create_collection_group_request.CreateCollectionGroupRequest]",
    ) -> AsyncOperationResponse[
        "capo_opensearchserverless.types.create_collection_group_response.CreateCollectionGroupResponse"
    ]:
        import capo_opensearchserverless._operations.open_search_serverless.create_collection_group

        (
            output,
            http_response,
        ) = await capo_opensearchserverless._operations.open_search_serverless.create_collection_group.async_create_collection_group(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateCollectionGroup")
    )
    input_: capo_opensearchserverless.types.create_collection_group_request.CreateCollectionGroupRequest = {
        "name": name,
        "standby_replicas": standby_replicas,
    }
    if description is not None:
        input_["description"] = description
    if tags is not None:
        input_["tags"] = tags
    if capacity_limits is not None:
        input_["capacity_limits"] = capacity_limits
    if generation is not None:
        input_["generation"] = generation
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token

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