Skip to content

associate_repositories async

associate_repositories(
    repository_name: RepositoryName,
    repository_type: RepositoryType,
    associated_repository_name: RepositoryName,
    associated_repository_type: RepositoryType,
    *,
    config_overrides: Optional[AsyncECRPUBLICClientConfig] = None,
    registry_id: Optional[RegistryId] = None,
) -> AssociateRepositoriesResponse

Associates a repository with another repository of a different type in the same public registry, so that the Amazon ECR Public Gallery shows them side by side. One repository must be FREE and the other must be PREMIUM. Both repositories must already exist, and each repository can have at most one associated repository.

Parameters:

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

    The Amazon Web Services account ID that's associated with the public registry that contains the repositories to associate. 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 source repository.

  • repository_type (RepositoryType) –

    The type of the source repository. Valid values:

    • FREE: A free repository.

    • PREMIUM: A premium repository that holds paid content.

  • associated_repository_name (RepositoryName) –

    The name of the repository to associate with the source repository.

  • associated_repository_type (RepositoryType) –

    The type of the repository to associate with the source repository. This must be different from the type of the source repository. Valid values:

    • FREE: A free repository.

    • PREMIUM: A premium repository that holds paid content.

Raises:

  • AssociationAlreadyExistsException –

    One of the specified repositories is already associated with another repository. A repository can have only one associated repository. Use DisassociateRepositories to remove the existing association, then try again.

  • 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 associate a free repository with a premium repository This example associates the free repository my-free-repository with the premium repository my-premium-repository in your default registry.

>>> await client.associate_repositories(repository_name='my-premium-repository', repository_type='PREMIUM', associated_repository_name='my-free-repository', associated_repository_type='FREE')
Source code in docs_src/capo_ecr_public/_services/async_ecrpublic.py
async def associate_repositories(
    self,
    repository_name: "capo_ecr_public.types.repository_name.RepositoryName",
    repository_type: "capo_ecr_public.types.repository_type.RepositoryType",
    associated_repository_name: "capo_ecr_public.types.repository_name.RepositoryName",
    associated_repository_type: "capo_ecr_public.types.repository_type.RepositoryType",
    *,
    config_overrides: Optional[AsyncECRPUBLICClientConfig] = None,
    registry_id: Optional["capo_ecr_public.types.registry_id.RegistryId"] = None,
) -> "capo_ecr_public.types.associate_repositories_response.AssociateRepositoriesResponse":
    """<p>Associates a repository with another repository of a different type in the same public registry, so that the Amazon ECR Public Gallery shows them side by side. One repository must be <code>FREE</code> and the other must be <code>PREMIUM</code>. Both repositories must already exist, and each repository can have at most one associated repository.</p>

    Args:
        registry_id: <p>The Amazon Web Services account ID that's associated with the public registry that contains the repositories to associate. 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 source repository.</p>
        repository_type: <p>The type of the source repository. Valid values:</p> <ul> <li> <p> <code>FREE</code>: A free repository.</p> </li> <li> <p> <code>PREMIUM</code>: A premium repository that holds paid content.</p> </li> </ul>
        associated_repository_name: <p>The name of the repository to associate with the source repository.</p>
        associated_repository_type: <p>The type of the repository to associate with the source repository. This must be different from the type of the source repository. Valid values:</p> <ul> <li> <p> <code>FREE</code>: A free repository.</p> </li> <li> <p> <code>PREMIUM</code>: A premium repository that holds paid content.</p> </li> </ul>

    Raises:
        capo_ecr_public.errors.association_already_exists_exception.AssociationAlreadyExistsException: <p>One of the specified repositories is already associated with another repository. A repository can have only one associated repository. Use <code>DisassociateRepositories</code> to remove the existing association, then try again.</p>
        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 associate a free repository with a premium repository
        This example associates the free repository my-free-repository with the premium repository my-premium-repository in your default registry.

        >>> await client.associate_repositories(repository_name='my-premium-repository', repository_type='PREMIUM', associated_repository_name='my-free-repository', associated_repository_type='FREE')
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_ecr_public.types.associate_repositories_request.AssociateRepositoriesRequest]",
    ) -> AsyncOperationResponse[
        "capo_ecr_public.types.associate_repositories_response.AssociateRepositoriesResponse"
    ]:
        import capo_ecr_public._operations.spencer_frontend_service.associate_repositories

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("AssociateRepositories")
    )
    input_: capo_ecr_public.types.associate_repositories_request.AssociateRepositoriesRequest = {
        "repository_name": repository_name,
        "repository_type": repository_type,
        "associated_repository_name": associated_repository_name,
        "associated_repository_type": associated_repository_type,
    }
    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