Skip to main content

packages

Creates, updates, deletes, gets or lists a packages resource.

Overview

Namepackages
TypeResource
Idaws.codeartifact.packages

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
namestringThe name of the package. (pattern: <code>[^#/\s]+</code>)
format_stringA format that specifies the type of the package. (npm, pypi, maven, nuget, generic, ruby, swift, cargo)
namespacestringThe namespace of the package. 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, NuGet, Ruby, and Cargo package versions do not contain a corresponding component, package versions of those formats do not have a namespace. (pattern: <code>[^#/\s]+</code>)
origin_configurationobjectThe package origin configuration for the package.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
describe_packageselectdomain, repository, format, package, regiondomain-owner, namespaceReturns a PackageDescription object that contains information about the requested package.
list_packagesselectdomain, repository, regiondomain-owner, format, namespace, package-prefix, max-results, next-token, publish, upstreamReturns a list of PackageSummary objects for packages in a repository that match the request parameters.
put_package_origin_configurationreplacedomain, repository, format, package, region, restrictionsdomain-owner, namespaceSets 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.
delete_packagedeletedomain, repository, format, package, regiondomain-owner, namespaceDeletes a package and all associated package versions. A deleted package cannot be restored. To delete one or more package versions, use the DeletePackageVersions API.
publish_package_versionexecdomain, repository, format, package, version, asset, x-amz-content-sha256, region, assetContentdomain-owner, namespace, unfinishedCreates a new package version containing one or more assets (or files). The unfinished flag can be used to keep the package version in the Unfinished state until all of its assets have been uploaded (see Package version status in the CodeArtifact user guide). To set the package version’s status to Published, omit the unfinished flag when uploading the final asset, or set the status using UpdatePackageVersionStatus. Once a package version’s status is set to Published, it cannot change back to Unfinished. Only generic packages can be published using this API. For more information, see Using generic packages in the CodeArtifact User Guide.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
assetstringThe name of the asset to publish. Asset names can include Unicode letters and numbers, and the following special characters: ~ ! @ ^ & ( ) - _ + &#91; &#93; &#123; &#125; ; , .
domainstringThe name of the domain that contains the repository that contains the package version to publish.
formatstringA format that specifies the type of the package version with the requested asset file. The only supported value is generic.
packagestringThe name of the package version to publish.
regionstringAWS region (default: us-east-1)
repositorystringThe name of the repository that the package version will be published to.
versionstringThe package version to publish (for example, 3.5.2).
x-amz-content-sha256stringThe SHA256 hash of the assetContent to publish. This value must be calculated by the caller and provided with the request (see Publishing a generic package in the CodeArtifact User Guide). This value is used as an integrity check to verify that the assetContent has not changed after it was originally sent.
domain-ownerstringThe 12-digit account number of the AWS account that owns the domain. It does not include dashes or spaces.
formatstringThe format used to filter requested packages. Only packages from the provided format will be returned.
max-resultsintegerThe maximum number of results to return per page.
namespacestringThe namespace of the package version to publish.
next-tokenstringThe 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.
package-prefixstringA prefix used to filter requested packages. Only packages with names that start with packagePrefix are returned.
publishstringThe 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.
unfinishedbooleanSpecifies whether the package version should remain in the unfinished state. If omitted, the package version status will be set to Published (see Package version status in the CodeArtifact User Guide). Valid values: unfinished
upstreamstringThe 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.

SELECT examples

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

SELECT
name,
format_,
namespace,
origin_configuration
FROM aws.codeartifact.packages
WHERE domain = '{{ domain }}' -- required
AND repository = '{{ repository }}' -- required
AND format = '{{ format }}' -- required
AND package = '{{ package }}' -- required
AND region = '{{ region }}' -- required
AND `domain-owner` = '{{ domain-owner }}'
AND namespace = '{{ namespace }}'
;

REPLACE examples

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.

REPLACE aws.codeartifact.packages
SET
restrictions = '{{ restrictions }}'
WHERE
domain = '{{ domain }}' --required
AND repository = '{{ repository }}' --required
AND format = '{{ format }}' --required
AND package = '{{ package }}' --required
AND region = '{{ region }}' --required
AND restrictions = '{{ restrictions }}' --required
AND `domain-owner` = '{{ domain-owner}}'
AND namespace = '{{ namespace}}'
RETURNING
origin_configuration;

DELETE examples

Deletes a package and all associated package versions. A deleted package cannot be restored. To delete one or more package versions, use the DeletePackageVersions API.

DELETE FROM aws.codeartifact.packages
WHERE domain = '{{ domain }}' --required
AND repository = '{{ repository }}' --required
AND format = '{{ format }}' --required
AND package = '{{ package }}' --required
AND region = '{{ region }}' --required
AND `domain-owner` = '{{ domain-owner }}'
AND namespace = '{{ namespace }}'
;

Lifecycle Methods

Creates a new package version containing one or more assets (or files). The unfinished flag can be used to keep the package version in the Unfinished state until all of its assets have been uploaded (see Package version status in the CodeArtifact user guide). To set the package version’s status to Published, omit the unfinished flag when uploading the final asset, or set the status using UpdatePackageVersionStatus. Once a package version’s status is set to Published, it cannot change back to Unfinished. Only generic packages can be published using this API. For more information, see Using generic packages in the CodeArtifact User Guide.

EXEC aws.codeartifact.packages.publish_package_version
@domain='{{ domain }}' --required,
@repository='{{ repository }}' --required,
@format='{{ format }}' --required,
@package='{{ package }}' --required,
@version='{{ version }}' --required,
@asset='{{ asset }}' --required,
@x-amz-content-sha256='{{ x-amz-content-sha256 }}' --required,
@region='{{ region }}' --required,
@domain-owner='{{ domain-owner }}',
@namespace='{{ namespace }}',
@unfinished={{ unfinished }}
@@json=
'{
"assetContent": "{{ assetContent }}"
}'
;