packages
Creates, updates, deletes, gets or lists a packages resource.
Overview
| Name | packages |
| Type | Resource |
| Id | aws.codeartifact.packages |
Fields
The following fields are returned by SELECT queries:
- describe_package
- list_packages
| Name | Datatype | Description |
|---|---|---|
name | string | The name of the package. (pattern: <code>[^#/\s]+</code>) |
format_ | string | A format that specifies the type of the package. (npm, pypi, maven, nuget, generic, ruby, swift, cargo) |
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 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_configuration | object | The package origin configuration for the package. |
| Name | Datatype | Description |
|---|---|---|
format_ | string | The format of the package. (npm, pypi, maven, nuget, generic, ruby, swift, cargo) |
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 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_configuration | object | A PackageOriginConfiguration object that contains a PackageOriginRestrictions object that contains information about the upstream and publish package origin restrictions. |
package | string | The name of the package. (pattern: <code>[^#/\s]+</code>) |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
describe_package | select | domain, repository, format, package, region | domain-owner, namespace | Returns a PackageDescription object that contains information about the requested package. |
list_packages | select | domain, repository, region | domain-owner, format, namespace, package-prefix, max-results, next-token, publish, upstream | Returns a list of PackageSummary objects for packages in a repository that match the request parameters. |
put_package_origin_configuration | replace | domain, repository, format, package, region, restrictions | domain-owner, namespace | 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. |
delete_package | delete | domain, repository, format, package, region | domain-owner, namespace | 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. |
publish_package_version | exec | domain, repository, format, package, version, asset, x-amz-content-sha256, region, assetContent | domain-owner, namespace, unfinished | 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. |
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.
| Name | Datatype | Description |
|---|---|---|
asset | string | The name of the asset to publish. Asset names can include Unicode letters and numbers, and the following special characters: ~ ! @ ^ & ( ) - _ + [ ] { } ; , . |
domain | string | The name of the domain that contains the repository that contains the package version to publish. |
format | string | A format that specifies the type of the package version with the requested asset file. The only supported value is generic. |
package | string | The name of the package version to publish. |
region | string | AWS region (default: us-east-1) |
repository | string | The name of the repository that the package version will be published to. |
version | string | The package version to publish (for example, 3.5.2). |
x-amz-content-sha256 | string | The 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-owner | string | The 12-digit account number of the AWS account that owns the domain. It does not include dashes or spaces. |
format | string | The format used to filter requested packages. Only packages from the provided format will be returned. |
max-results | integer | The maximum number of results to return per page. |
namespace | string | The namespace of the package version to publish. |
next-token | string | 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. |
package-prefix | string | A prefix used to filter requested packages. Only packages with names that start with packagePrefix are returned. |
publish | string | 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. |
unfinished | boolean | Specifies 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 |
upstream | string | 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. |
SELECT examples
- describe_package
- list_packages
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 }}'
;
Returns a list of PackageSummary objects for packages in a repository that match the request parameters.
SELECT
format_,
namespace,
origin_configuration,
package
FROM aws.codeartifact.packages
WHERE domain = '{{ domain }}' -- required
AND repository = '{{ repository }}' -- required
AND region = '{{ region }}' -- required
AND `domain-owner` = '{{ domain-owner }}'
AND format = '{{ format }}'
AND namespace = '{{ namespace }}'
AND `package-prefix` = '{{ package-prefix }}'
AND `max-results` = '{{ max-results }}'
AND `next-token` = '{{ next-token }}'
AND publish = '{{ publish }}'
AND upstream = '{{ upstream }}'
;
REPLACE examples
- put_package_origin_configuration
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
- delete_package
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
- publish_package_version
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 }}"
}'
;