CodeArtifact / Client / put_package_origin_configuration

put_package_origin_configuration#

CodeArtifact.Client.put_package_origin_configuration(**kwargs)#

Sets the package origin configuration for a package.

The package origin configuration determines how new versions of a package can be added to a repository. You can allow or block direct publishing of new package versions, or ingestion and retaining of new package versions from an external connection or upstream source. For more information about package origin controls and configuration, see Editing package origin controls in the CodeArtifact User Guide.

PutPackageOriginConfiguration can be called on a package that doesn’t yet exist in the repository. When called on a package that does not exist, a package is created in the repository with no versions and the requested restrictions are set on the package. This can be used to preemptively block ingesting or retaining any versions from external connections or upstream repositories, or to block publishing any versions of the package into the repository before connecting any package managers or publishers to the repository.

See also: AWS API Documentation

Request Syntax

response = client.put_package_origin_configuration(
    domain='string',
    domainOwner='string',
    repository='string',
    format='npm'|'pypi'|'maven'|'nuget'|'generic'|'swift',
    namespace='string',
    package='string',
    restrictions={
        'publish': 'ALLOW'|'BLOCK',
        'upstream': 'ALLOW'|'BLOCK'
    }
)
Parameters:
  • domain (string) –

    [REQUIRED]

    The name of the domain that contains the repository that contains the package.

  • domainOwner (string) – The 12-digit account number of the Amazon Web Services account that owns the domain. It does not include dashes or spaces.

  • repository (string) –

    [REQUIRED]

    The name of the repository that contains the package.

  • format (string) –

    [REQUIRED]

    A format that specifies the type of the package to be updated.

  • namespace (string) –

    The namespace of the package to be updated. The package component that specifies its namespace depends on its type. For example:

    • The namespace of a Maven package version is its groupId.

    • The namespace of an npm or Swift package version is its scope.

    • The namespace of a generic package is its namespace.

    • Python and NuGet package versions do not contain a corresponding component, package versions of those formats do not have a namespace.

  • package (string) –

    [REQUIRED]

    The name of the package to be updated.

  • restrictions (dict) –

    [REQUIRED]

    A PackageOriginRestrictions object that contains information about the upstream and publish package origin restrictions. The upstream restriction determines if new package versions can be ingested or retained from external connections or upstream repositories. The publish restriction determines if new package versions can be published directly to the repository.

    You must include both the desired upstream and publish restrictions.

    • publish (string) – [REQUIRED]

      The package origin configuration that determines if new versions of the package can be published directly to the repository.

    • upstream (string) – [REQUIRED]

      The package origin configuration that determines if new versions of the package can be added to the repository from an external connection or upstream source.

Return type:

dict

Returns:

Response Syntax

{
    'originConfiguration': {
        'restrictions': {
            'publish': 'ALLOW'|'BLOCK',
            'upstream': 'ALLOW'|'BLOCK'
        }
    }
}

Response Structure

  • (dict) –

    • originConfiguration (dict) –

      A PackageOriginConfiguration object that describes the origin configuration set for the package. It contains a PackageOriginRestrictions object that describes how new versions of the package can be introduced to the repository.

      • restrictions (dict) –

        A PackageOriginRestrictions object that contains information about the upstream and publish package origin configuration for the package.

        • publish (string) –

          The package origin configuration that determines if new versions of the package can be published directly to the repository.

        • upstream (string) –

          The package origin configuration that determines if new versions of the package can be added to the repository from an external connection or upstream source.

Exceptions