Skip to content

put_premium_repository_products

put_premium_repository_products(
    repository_name: RepositoryName,
    marketplace_products: MarketplaceProductIdList,
    *,
    config_overrides: Optional[ECRPUBLICClientConfig] = None,
    registry_id: Optional[RegistryId] = None,
) -> PutPremiumRepositoryProductsResponse

Replaces the list of Amazon Web Services Marketplace products for a premium repository. You must specify the full list of products, from one to five. To add a product, include it with the existing products.

You can remove a product only while the repository is in the DRAFT state. After the repository leaves the DRAFT state, you can only add products. A request that leaves out an existing product fails with InvalidParameterException.

Parameters:

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

    The Amazon Web Services account ID that's associated with the public registry that contains the premium 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 premium repository to set the products for.

  • marketplace_products (MarketplaceProductIdList) –

    The full list of Amazon Web Services Marketplace product IDs for the premium repository. This list replaces the existing list. You can specify from one to five product IDs. Your account must own each product, and each product must have an Amazon ECR Public Premium delivery option. You can't specify the same product ID more than once.

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 add a product to a premium repository This example adds the AWS Marketplace product prod-9f2EXAMPLE108 to the premium repository my-premium-repository. You must provide the full list of products, so the request also includes the existing product prod-ad8EXAMPLE651.

>>> client.put_premium_repository_products(repository_name='my-premium-repository', marketplace_products=['prod-ad8EXAMPLE651', 'prod-9f2EXAMPLE108'])
Source code in docs_src/capo_ecr_public/_services/ecrpublic.py
def put_premium_repository_products(
    self,
    repository_name: "capo_ecr_public.types.repository_name.RepositoryName",
    marketplace_products: "capo_ecr_public.types.marketplace_product_id_list.MarketplaceProductIdList",
    *,
    config_overrides: Optional[ECRPUBLICClientConfig] = None,
    registry_id: Optional["capo_ecr_public.types.registry_id.RegistryId"] = None,
) -> "capo_ecr_public.types.put_premium_repository_products_response.PutPremiumRepositoryProductsResponse":
    """<p>Replaces the list of Amazon Web Services Marketplace products for a premium repository. You must specify the full list of products, from one to five. To add a product, include it with the existing products.</p> <p>You can remove a product only while the repository is in the <code>DRAFT</code> state. After the repository leaves the <code>DRAFT</code> state, you can only add products. A request that leaves out an existing product fails with <code>InvalidParameterException</code>.</p>

    Args:
        registry_id: <p>The Amazon Web Services account ID that's associated with the public registry that contains the premium 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 premium repository to set the products for.</p>
        marketplace_products: <p>The full list of Amazon Web Services Marketplace product IDs for the premium repository. This list replaces the existing list. You can specify from one to five product IDs. Your account must own each product, and each product must have an Amazon ECR Public Premium delivery option. You can't specify the same product ID more than once.</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 add a product to a premium repository
        This example adds the AWS Marketplace product prod-9f2EXAMPLE108 to the premium repository my-premium-repository. You must provide the full list of products, so the request also includes the existing product prod-ad8EXAMPLE651.

        >>> client.put_premium_repository_products(repository_name='my-premium-repository', marketplace_products=['prod-ad8EXAMPLE651', 'prod-9f2EXAMPLE108'])
    """

    def _handler(
        req: "OperationRequest[capo_ecr_public.types.put_premium_repository_products_request.PutPremiumRepositoryProductsRequest]",
    ) -> OperationResponse[
        "capo_ecr_public.types.put_premium_repository_products_response.PutPremiumRepositoryProductsResponse"
    ]:
        import capo_ecr_public._operations.spencer_frontend_service.put_premium_repository_products

        output, http_response = (
            capo_ecr_public._operations.spencer_frontend_service.put_premium_repository_products.put_premium_repository_products(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("PutPremiumRepositoryProducts")
    )
    input_: capo_ecr_public.types.put_premium_repository_products_request.PutPremiumRepositoryProductsRequest = {
        "repository_name": repository_name,
        "marketplace_products": marketplace_products,
    }
    if registry_id is not None:
        input_["registry_id"] = registry_id

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