CodeArtifact

2022/07/14 - CodeArtifact - 2 new 3 updated api methods

Changes  This release introduces Package Origin Controls, a mechanism used to counteract Dependency Confusion attacks. Adds two new APIs, PutPackageOriginConfiguration and DescribePackage, and updates the ListPackage, DescribePackageVersion and ListPackageVersion APIs in support of the feature.

DescribePackage (new) Link ¶

Returns a PackageDescription object that contains information about the requested package.

See also: AWS API Documentation

Request Syntax

client.describe_package(
    domain='string',
    domainOwner='string',
    repository='string',
    format='npm'|'pypi'|'maven'|'nuget',
    namespace='string',
    package='string'
)
type domain

string

param domain

[REQUIRED]

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

type domainOwner

string

param domainOwner

The 12-digit account number of the Amazon Web Services account that owns the domain. It does not include dashes or spaces.

type repository

string

param repository

[REQUIRED]

The name of the repository that contains the requested package.

type format

string

param format

[REQUIRED]

A format that specifies the type of the requested package.

type namespace

string

param namespace

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

  • The namespace of a Maven package is its groupId . The namespace is required when requesting Maven packages.

  • The namespace of an npm package is its scope .

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

type package

string

param package

[REQUIRED]

The name of the requested package.

rtype

dict

returns

Response Syntax

{
    'package': {
        'format': 'npm'|'pypi'|'maven'|'nuget',
        'namespace': 'string',
        'name': 'string',
        'originConfiguration': {
            'restrictions': {
                'publish': 'ALLOW'|'BLOCK',
                'upstream': 'ALLOW'|'BLOCK'
            }
        }
    }
}

Response Structure

  • (dict) --

    • package (dict) --

      A PackageDescription object that contains information about the requested package.

      • format (string) --

        A format that specifies the type of the package.

      • namespace (string) --

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

        • The namespace of a Maven package is its groupId .

        • The namespace of an npm package is its scope .

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

      • name (string) --

        The name of the package.

      • originConfiguration (dict) --

        The package origin configuration for the package.

        • 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.

PutPackageOriginConfiguration (new) Link ¶

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

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

string

param domain

[REQUIRED]

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

type domainOwner

string

param domainOwner

The 12-digit account number of the Amazon Web Services account that owns the domain. It does not include dashes or spaces.

type repository

string

param repository

[REQUIRED]

The name of the repository that contains the package.

type format

string

param format

[REQUIRED]

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

type namespace

string

param namespace

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 is its groupId .

  • The namespace of an npm package is its scope .

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

type package

string

param package

[REQUIRED]

The name of the package to be updated.

type restrictions

dict

param restrictions

[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.

rtype

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.

DescribePackageVersion (updated) Link ¶
Changes (response)
{'packageVersion': {'origin': {'domainEntryPoint': {'externalConnectionName': 'string',
                                                    'repositoryName': 'string'},
                               'originType': 'INTERNAL | EXTERNAL | UNKNOWN'}}}

Returns a PackageVersionDescription object that contains information about the requested package version.

See also: AWS API Documentation

Request Syntax

client.describe_package_version(
    domain='string',
    domainOwner='string',
    repository='string',
    format='npm'|'pypi'|'maven'|'nuget',
    namespace='string',
    package='string',
    packageVersion='string'
)
type domain

string

param domain

[REQUIRED]

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

type domainOwner

string

param domainOwner

The 12-digit account number of the Amazon Web Services account that owns the domain. It does not include dashes or spaces.

type repository

string

param repository

[REQUIRED]

The name of the repository that contains the package version.

type format

string

param format

[REQUIRED]

A format that specifies the type of the requested package version.

type namespace

string

param namespace

The namespace of the requested package version. The package version 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 package version is its scope .

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

type package

string

param package

[REQUIRED]

The name of the requested package version.

type packageVersion

string

param packageVersion

[REQUIRED]

A string that contains the package version (for example, 3.5.2 ).

rtype

dict

returns

Response Syntax

{
    'packageVersion': {
        'format': 'npm'|'pypi'|'maven'|'nuget',
        'namespace': 'string',
        'packageName': 'string',
        'displayName': 'string',
        'version': 'string',
        'summary': 'string',
        'homePage': 'string',
        'sourceCodeRepository': 'string',
        'publishedTime': datetime(2015, 1, 1),
        'licenses': [
            {
                'name': 'string',
                'url': 'string'
            },
        ],
        'revision': 'string',
        'status': 'Published'|'Unfinished'|'Unlisted'|'Archived'|'Disposed'|'Deleted',
        'origin': {
            'domainEntryPoint': {
                'repositoryName': 'string',
                'externalConnectionName': 'string'
            },
            'originType': 'INTERNAL'|'EXTERNAL'|'UNKNOWN'
        }
    }
}

Response Structure

  • (dict) --

    • packageVersion (dict) --

      A PackageVersionDescription object that contains information about the requested package version.

      • format (string) --

        The format of the package version.

      • namespace (string) --

        The namespace of the package version. The package version 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 package version is its scope .

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

      • packageName (string) --

        The name of the requested package.

      • displayName (string) --

        The name of the package that is displayed. The displayName varies depending on the package version's format. For example, if an npm package is named ui , is in the namespace vue , and has the format npm , then the displayName is @vue/ui .

      • version (string) --

        The version of the package.

      • summary (string) --

        A summary of the package version. The summary is extracted from the package. The information in and detail level of the summary depends on the package version's format.

      • homePage (string) --

        The homepage associated with the package.

      • sourceCodeRepository (string) --

        The repository for the source code in the package version, or the source code used to build it.

      • publishedTime (datetime) --

        A timestamp that contains the date and time the package version was published.

      • licenses (list) --

        Information about licenses associated with the package version.

        • (dict) --

          Details of the license data.

          • name (string) --

            Name of the license.

          • url (string) --

            The URL for license data.

      • revision (string) --

        The revision of the package version.

      • status (string) --

        A string that contains the status of the package version.

      • origin (dict) --

        A PackageVersionOrigin object that contains information about how the package version was added to the repository.

        • domainEntryPoint (dict) --

          A DomainEntryPoint object that contains information about from which repository or external connection the package version was added to the domain.

          • repositoryName (string) --

            The name of the repository that a package was originally published to.

          • externalConnectionName (string) --

            The name of the external connection that a package was ingested from.

        • originType (string) --

          Describes how the package version was originally added to the domain. An INTERNAL origin type means the package version was published directly to a repository in the domain. An EXTERNAL origin type means the package version was ingested from an external connection.

ListPackageVersions (updated) Link ¶
Changes (request, response)
Request
{'originType': 'INTERNAL | EXTERNAL | UNKNOWN'}
Response
{'versions': {'origin': {'domainEntryPoint': {'externalConnectionName': 'string',
                                              'repositoryName': 'string'},
                         'originType': 'INTERNAL | EXTERNAL | UNKNOWN'}}}

Returns a list of PackageVersionSummary objects for package versions in a repository that match the request parameters.

See also: AWS API Documentation

Request Syntax

client.list_package_versions(
    domain='string',
    domainOwner='string',
    repository='string',
    format='npm'|'pypi'|'maven'|'nuget',
    namespace='string',
    package='string',
    status='Published'|'Unfinished'|'Unlisted'|'Archived'|'Disposed'|'Deleted',
    sortBy='PUBLISHED_TIME',
    maxResults=123,
    nextToken='string',
    originType='INTERNAL'|'EXTERNAL'|'UNKNOWN'
)
type domain

string

param domain

[REQUIRED]

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

type domainOwner

string

param domainOwner

The 12-digit account number of the Amazon Web Services account that owns the domain. It does not include dashes or spaces.

type repository

string

param repository

[REQUIRED]

The name of the repository that contains the requested package versions.

type format

string

param format

[REQUIRED]

The format of the returned package versions.

type namespace

string

param namespace

The namespace of the package that contains the requested package versions. The package component that specifies its namespace depends on its type. For example:

  • The namespace of a Maven package is its groupId .

  • The namespace of an npm package is its scope .

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

type package

string

param package

[REQUIRED]

The name of the package for which you want to request package versions.

type status

string

param status

A string that filters the requested package versions by status.

type sortBy

string

param sortBy

How to sort the requested list of package versions.

type maxResults

integer

param maxResults

The maximum number of results to return per page.

type nextToken

string

param nextToken

The token for the next set of results. Use the value returned in the previous response in the next request to retrieve the next set of results.

type originType

string

param originType

The originType used to filter package versions. Only package versions with the provided originType will be returned.

rtype

dict

returns

Response Syntax

{
    'defaultDisplayVersion': 'string',
    'format': 'npm'|'pypi'|'maven'|'nuget',
    'namespace': 'string',
    'package': 'string',
    'versions': [
        {
            'version': 'string',
            'revision': 'string',
            'status': 'Published'|'Unfinished'|'Unlisted'|'Archived'|'Disposed'|'Deleted',
            'origin': {
                'domainEntryPoint': {
                    'repositoryName': 'string',
                    'externalConnectionName': 'string'
                },
                'originType': 'INTERNAL'|'EXTERNAL'|'UNKNOWN'
            }
        },
    ],
    'nextToken': 'string'
}

Response Structure

  • (dict) --

    • defaultDisplayVersion (string) --

      The default package version to display. This depends on the package format:

      • For Maven and PyPI packages, it's the most recently published package version.

      • For npm packages, it's the version referenced by the latest tag. If the latest tag is not set, it's the most recently published package version.

    • format (string) --

      A format of the package.

    • namespace (string) --

      The namespace of the package that contains the requested package versions. The package component that specifies its namespace depends on its type. For example:

      • The namespace of a Maven package is its groupId .

      • The namespace of an npm package is its scope .

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

    • package (string) --

      The name of the package.

    • versions (list) --

      The returned list of PackageVersionSummary objects.

      • (dict) --

        Details about a package version, including its status, version, and revision. The ListPackageVersions operation returns a list of PackageVersionSummary objects.

        • version (string) --

          Information about a package version.

        • revision (string) --

          The revision associated with a package version.

        • status (string) --

          A string that contains the status of the package version. It can be one of the following:

        • origin (dict) --

          A PackageVersionOrigin object that contains information about how the package version was added to the repository.

          • domainEntryPoint (dict) --

            A DomainEntryPoint object that contains information about from which repository or external connection the package version was added to the domain.

            • repositoryName (string) --

              The name of the repository that a package was originally published to.

            • externalConnectionName (string) --

              The name of the external connection that a package was ingested from.

          • originType (string) --

            Describes how the package version was originally added to the domain. An INTERNAL origin type means the package version was published directly to a repository in the domain. An EXTERNAL origin type means the package version was ingested from an external connection.

    • nextToken (string) --

      If there are additional results, this is the token for the next set of results.

ListPackages (updated) Link ¶
Changes (request, response)
Request
{'publish': 'ALLOW | BLOCK', 'upstream': 'ALLOW | BLOCK'}
Response
{'packages': {'originConfiguration': {'restrictions': {'publish': 'ALLOW | '
                                                                  'BLOCK',
                                                       'upstream': 'ALLOW | '
                                                                   'BLOCK'}}}}

Returns a list of PackageSummary objects for packages in a repository that match the request parameters.

See also: AWS API Documentation

Request Syntax

client.list_packages(
    domain='string',
    domainOwner='string',
    repository='string',
    format='npm'|'pypi'|'maven'|'nuget',
    namespace='string',
    packagePrefix='string',
    maxResults=123,
    nextToken='string',
    publish='ALLOW'|'BLOCK',
    upstream='ALLOW'|'BLOCK'
)
type domain

string

param domain

[REQUIRED]

The name of the domain that contains the repository that contains the requested packages.

type domainOwner

string

param domainOwner

The 12-digit account number of the Amazon Web Services account that owns the domain. It does not include dashes or spaces.

type repository

string

param repository

[REQUIRED]

The name of the repository that contains the requested packages.

type format

string

param format

The format used to filter requested packages. Only packages from the provided format will be returned.

type namespace

string

param namespace

The namespace used to filter requested packages. Only packages with the provided namespace will be returned. The package component that specifies its namespace depends on its type. For example:

  • The namespace of a Maven package is its groupId .

  • The namespace of an npm package is its scope .

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

type packagePrefix

string

param packagePrefix

A prefix used to filter requested packages. Only packages with names that start with packagePrefix are returned.

type maxResults

integer

param maxResults

The maximum number of results to return per page.

type nextToken

string

param nextToken

The token for the next set of results. Use the value returned in the previous response in the next request to retrieve the next set of results.

type publish

string

param publish

The value of the Publish package origin control restriction used to filter requested packages. Only packages with the provided restriction are returned. For more information, see PackageOriginRestrictions.

type upstream

string

param upstream

The value of the Upstream package origin control restriction used to filter requested packages. Only packages with the provided restriction are returned. For more information, see PackageOriginRestrictions.

rtype

dict

returns

Response Syntax

{
    'packages': [
        {
            'format': 'npm'|'pypi'|'maven'|'nuget',
            'namespace': 'string',
            'package': 'string',
            'originConfiguration': {
                'restrictions': {
                    'publish': 'ALLOW'|'BLOCK',
                    'upstream': 'ALLOW'|'BLOCK'
                }
            }
        },
    ],
    'nextToken': 'string'
}

Response Structure

  • (dict) --

    • packages (list) --

      The list of returned PackageSummary objects.

      • (dict) --

        Details about a package, including its format, namespace, and name. The ListPackages operation returns a list of PackageSummary objects.

        • format (string) --

          The format of the package.

        • namespace (string) --

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

          • The namespace of a Maven package is its groupId .

          • The namespace of an npm package is its scope .

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

        • package (string) --

          The name of the package.

        • originConfiguration (dict) --

          A PackageOriginConfiguration object that contains a PackageOriginRestrictions object that contains information about the upstream and publish package origin restrictions.

          • 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.

    • nextToken (string) --

      If there are additional results, this is the token for the next set of results.