Skip to content

set_repository_state async

set_repository_state(
    repository_name: RepositoryName,
    repository_type: RepositoryType,
    state: RepositoryState,
    *,
    config_overrides: Optional[AsyncECRPUBLICClientConfig] = None,
    registry_id: Optional[RegistryId] = None,
) -> SetRepositoryStateResponse

Sets the state of a premium repository. Use the state to control whether the repository is shown in the Amazon ECR Public Gallery. A premium repository is listed in the Amazon ECR Public Gallery when it's AVAILABLE and at least one of its Amazon Web Services Marketplace products is public.

Parameters:

  • registry_id (Optional[RegistryId], default: None ) –

    The Amazon Web Services account ID that's associated with the public registry that contains the repository. If you do not specify a registry, the default public registry is assumed. You can specify only your own account ID. Cross-account access through a repository policy isn't supported for this operation.

  • repository_name (RepositoryName) –

    The name of the repository to set the state for.

  • repository_type (RepositoryType) –

    The type of the repository. Currently, you can set the state only for a PREMIUM repository. FREE isn't supported, and the request fails with InvalidParameterException.

  • state (RepositoryState) –

    The state to set on the repository. Valid values:

    • AVAILABLE: Entitled buyers can pull from the repository, and it's listed in the Amazon ECR Public Gallery when at least one of its Amazon Web Services Marketplace products is public.

    • HIDDEN: The repository isn't listed in the Amazon ECR Public Gallery. Buyers with an active entitlement can still pull from it.

    A repository can move from DRAFT to AVAILABLE, and between AVAILABLE and HIDDEN. It can't return to DRAFT. Other changes fail with InvalidParameterException. If you specify the current state, the request succeeds and nothing changes.

Raises:

  • InvalidParameterException –

    The specified parameter is invalid. Review the available parameters for the API request.

  • LimitExceededException –

    The operation didn't succeed because it would have exceeded a service limit for your account. For more information, see Amazon ECR Public service quotas in the Amazon Elastic Container Registry Public User Guide.

  • RepositoryNotFoundException –

    The specified repository can't be found. Check the spelling of the specified repository and ensure that you're performing operations on the correct registry.

  • ServerException –

    These errors are usually caused by a server-side issue. Retry the request. If it continues to fail, contact Amazon Web Services Support.

  • UnsupportedCommandException –

    The action isn't supported in this Region. Check that the action is available in the Amazon Web Services Region that you're using, and try again in a supported Region.

  • UnknownServiceError –

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

Examples:

To make a premium repository available This example moves the premium repository my-premium-repository from the DRAFT state to the AVAILABLE state.

>>> await client.set_repository_state(repository_name='my-premium-repository', repository_type='PREMIUM', state='AVAILABLE')
Source code in docs_src/capo_ecr_public/_services/async_ecrpublic.py
async def set_repository_state(
    self,
    repository_name: "capo_ecr_public.types.repository_name.RepositoryName",
    repository_type: "capo_ecr_public.types.repository_type.RepositoryType",
    state: "capo_ecr_public.types.repository_state.RepositoryState",
    *,
    config_overrides: Optional[AsyncECRPUBLICClientConfig] = None,
    registry_id: Optional["capo_ecr_public.types.registry_id.RegistryId"] = None,
) -> (
    "capo_ecr_public.types.set_repository_state_response.SetRepositoryStateResponse"
):
    """<p>Sets the state of a premium repository. Use the state to control whether the repository is shown in the Amazon ECR Public Gallery. A premium repository is listed in the Amazon ECR Public Gallery when it's <code>AVAILABLE</code> and at least one of its Amazon Web Services Marketplace products is public.</p>

    Args:
        registry_id: <p>The Amazon Web Services account ID that's associated with the public registry that contains the repository. If you do not specify a registry, the default public registry is assumed. You can specify only your own account ID. Cross-account access through a repository policy isn't supported for this operation.</p>
        repository_name: <p>The name of the repository to set the state for.</p>
        repository_type: <p>The type of the repository. Currently, you can set the state only for a <code>PREMIUM</code> repository. <code>FREE</code> isn't supported, and the request fails with <code>InvalidParameterException</code>.</p>
        state: <p>The state to set on the repository. Valid values:</p> <ul> <li> <p> <code>AVAILABLE</code>: Entitled buyers can pull from the repository, and it's listed in the Amazon ECR Public Gallery when at least one of its Amazon Web Services Marketplace products is public.</p> </li> <li> <p> <code>HIDDEN</code>: The repository isn't listed in the Amazon ECR Public Gallery. Buyers with an active entitlement can still pull from it.</p> </li> </ul> <p>A repository can move from <code>DRAFT</code> to <code>AVAILABLE</code>, and between <code>AVAILABLE</code> and <code>HIDDEN</code>. It can't return to <code>DRAFT</code>. Other changes fail with <code>InvalidParameterException</code>. If you specify the current state, the request succeeds and nothing changes.</p>

    Raises:
        capo_ecr_public.errors.invalid_parameter_exception.InvalidParameterException: <p>The specified parameter is invalid. Review the available parameters for the API request.</p>
        capo_ecr_public.errors.limit_exceeded_exception.LimitExceededException: <p>The operation didn't succeed because it would have exceeded a service limit for your account. For more information, see <a href="https://docs.aws.amazon.com/AmazonECR/latest/public/public-service-quotas.html">Amazon ECR Public service quotas</a> in the Amazon Elastic Container Registry Public User Guide.</p>
        capo_ecr_public.errors.repository_not_found_exception.RepositoryNotFoundException: <p>The specified repository can't be found. Check the spelling of the specified repository and ensure that you're performing operations on the correct registry.</p>
        capo_ecr_public.errors.server_exception.ServerException: <p>These errors are usually caused by a server-side issue. Retry the request. If it continues to fail, contact Amazon Web Services Support.</p>
        capo_ecr_public.errors.unsupported_command_exception.UnsupportedCommandException: <p>The action isn't supported in this Region. Check that the action is available in the Amazon Web Services Region that you're using, and try again in a supported Region.</p>
        capo_ecr_public.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To make a premium repository available
        This example moves the premium repository my-premium-repository from the DRAFT state to the AVAILABLE state.

        >>> await client.set_repository_state(repository_name='my-premium-repository', repository_type='PREMIUM', state='AVAILABLE')
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_ecr_public.types.set_repository_state_request.SetRepositoryStateRequest]",
    ) -> AsyncOperationResponse[
        "capo_ecr_public.types.set_repository_state_response.SetRepositoryStateResponse"
    ]:
        import capo_ecr_public._operations.spencer_frontend_service.set_repository_state

        (
            output,
            http_response,
        ) = await capo_ecr_public._operations.spencer_frontend_service.set_repository_state.async_set_repository_state(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("SetRepositoryState")
    )
    input_: capo_ecr_public.types.set_repository_state_request.SetRepositoryStateRequest = {
        "repository_name": repository_name,
        "repository_type": repository_type,
        "state": state,
    }
    if registry_id is not None:
        input_["registry_id"] = registry_id

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