Skip to content

delete_container_group_definition

delete_container_group_definition(
    *,
    config_overrides: Optional[GameLiftClientConfig] = None,
    name: Optional[ContainerGroupDefinitionNameOrArn] = None,
    version_number: Optional[PositiveInteger] = None,
    version_count_to_retain: Optional[WholeNumber] = None,
) -> DeleteContainerGroupDefinitionOutput

This API works with the following fleet types: Container

Request options:

Deletes a container group definition.

  • Delete an entire container group definition, including all versions. Specify the container group definition name, or use an ARN value without the version number.

  • Delete a particular version. Specify the container group definition name and a version number, or use an ARN value that includes the version number.

  • Keep the newest versions and delete all older versions. Specify the container group definition name and the number of versions to retain. For example, set VersionCountToRetain to 5 to delete all but the five most recent versions.

Result

If successful, Amazon GameLift Servers removes the container group definition versions that you request deletion for. This request will fail for any requested versions if the following is true:

  • If the version is being used in an active fleet

  • If the version is being deployed to a fleet in a deployment that's currently in progress.

  • If the version is designated as a rollback definition in a fleet deployment that's currently in progress.

Learn more

Parameters:

  • name (Optional[ContainerGroupDefinitionNameOrArn], default: None ) –

    The unique identifier for the container group definition to delete. You can use either the Name or ARN value.

  • version_number (Optional[PositiveInteger], default: None ) –

    The specific version to delete.

  • version_count_to_retain (Optional[WholeNumber], default: None ) –

    The number of most recent versions to keep while deleting all older versions.

Raises:

  • InternalServiceException –

    The service encountered an unrecoverable internal failure while processing the request. Clients can retry such requests immediately or after a waiting period.

  • InvalidRequestException –

    One or more parameter values in the request are invalid. Correct the invalid parameter values before retrying.

  • NotFoundException –

    The requested resource was not found. The resource was either not created yet or deleted.

  • TaggingFailedException –

    The requested tagging operation did not succeed. This may be due to invalid tag format or the maximum tag limit may have been exceeded. Resolve the issue before retrying.

  • UnauthorizedException –

    The client failed authentication. Clients should not retry such requests.

  • UnsupportedRegionException –

    The requested operation is not supported in the Region specified.

  • UnknownServiceError –

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

Source code in docs_src/capo_gamelift/_services/game_lift.py
def delete_container_group_definition(
    self,
    *,
    config_overrides: Optional[GameLiftClientConfig] = None,
    name: Optional[
        "capo_gamelift.types.container_group_definition_name_or_arn.ContainerGroupDefinitionNameOrArn"
    ] = None,
    version_number: Optional[
        "capo_gamelift.types.positive_integer.PositiveInteger"
    ] = None,
    version_count_to_retain: Optional[
        "capo_gamelift.types.whole_number.WholeNumber"
    ] = None,
) -> "capo_gamelift.types.delete_container_group_definition_output.DeleteContainerGroupDefinitionOutput":
    """<p> <b>This API works with the following fleet types:</b> Container</p> <p> <b>Request options:</b> </p> <p>Deletes a container group definition. </p> <ul> <li> <p>Delete an entire container group definition, including all versions. Specify the container group definition name, or use an ARN value without the version number.</p> </li> <li> <p>Delete a particular version. Specify the container group definition name and a version number, or use an ARN value that includes the version number.</p> </li> <li> <p>Keep the newest versions and delete all older versions. Specify the container group definition name and the number of versions to retain. For example, set <code>VersionCountToRetain</code> to 5 to delete all but the five most recent versions.</p> </li> </ul> <p> <b>Result</b> </p> <p>If successful, Amazon GameLift Servers removes the container group definition versions that you request deletion for. This request will fail for any requested versions if the following is true: </p> <ul> <li> <p>If the version is being used in an active fleet</p> </li> <li> <p>If the version is being deployed to a fleet in a deployment that's currently in progress.</p> </li> <li> <p>If the version is designated as a rollback definition in a fleet deployment that's currently in progress.</p> </li> </ul> <p> <b>Learn more</b> </p> <ul> <li> <p> <a href="https://docs.aws.amazon.com/gamelift/latest/developerguide/containers-create-groups.html">Manage a container group definition</a> </p> </li> </ul>

    Args:
        name: <p>The unique identifier for the container group definition to delete. You can use either the <code>Name</code> or <code>ARN</code> value.</p>
        version_number: <p>The specific version to delete.</p>
        version_count_to_retain: <p>The number of most recent versions to keep while deleting all older versions.</p>

    Raises:
        capo_gamelift.errors.internal_service_exception.InternalServiceException: <p>The service encountered an unrecoverable internal failure while processing the request. Clients can retry such requests immediately or after a waiting period.</p>
        capo_gamelift.errors.invalid_request_exception.InvalidRequestException: <p>One or more parameter values in the request are invalid. Correct the invalid parameter values before retrying.</p>
        capo_gamelift.errors.not_found_exception.NotFoundException: <p>The requested resource was not found. The resource was either not created yet or deleted.</p>
        capo_gamelift.errors.tagging_failed_exception.TaggingFailedException: <p>The requested tagging operation did not succeed. This may be due to invalid tag format or the maximum tag limit may have been exceeded. Resolve the issue before retrying.</p>
        capo_gamelift.errors.unauthorized_exception.UnauthorizedException: <p>The client failed authentication. Clients should not retry such requests.</p>
        capo_gamelift.errors.unsupported_region_exception.UnsupportedRegionException: <p>The requested operation is not supported in the Region specified.</p>
        capo_gamelift.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_gamelift.types.delete_container_group_definition_input.DeleteContainerGroupDefinitionInput]",
    ) -> OperationResponse[
        "capo_gamelift.types.delete_container_group_definition_output.DeleteContainerGroupDefinitionOutput"
    ]:
        import capo_gamelift._operations.game_lift.delete_container_group_definition

        output, http_response = (
            capo_gamelift._operations.game_lift.delete_container_group_definition.delete_container_group_definition(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DeleteContainerGroupDefinition")
    )
    input_: capo_gamelift.types.delete_container_group_definition_input.DeleteContainerGroupDefinitionInput = {}
    if name is not None:
        input_["name"] = name
    if version_number is not None:
        input_["version_number"] = version_number
    if version_count_to_retain is not None:
        input_["version_count_to_retain"] = version_count_to_retain

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output