package_versions
Creates, updates, deletes, gets or lists a package_versions resource.
Overview
| Name | package_versions |
| Type | Resource |
| Id | aws.codeartifact.package_versions |
Fields
The following fields are returned by SELECT queries:
- describe_package_version
- list_package_versions
| Name | Datatype | Description |
|---|---|---|
display_name | 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. |
format_ | string | The format of the package version. (npm, pypi, maven, nuget, generic, ruby, swift, cargo) |
home_page | string | The homepage associated with the package. |
licenses | array | Information about licenses associated with the package version. |
namespace | string | The namespace of the package version. 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 | object | A PackageVersionOrigin object that contains information about how the package version was added to the repository. |
package_name | string | The name of the requested package. (pattern: <code>[^#/\s]+</code>) |
published_time | string (date-time) | A timestamp that contains the date and time the package version was published. |
revision | string | The revision of the package version. (pattern: <code>\S+</code>) |
source_code_repository | string | The repository for the source code in the package version, or the source code used to build it. |
status | string | A string that contains the status of the package version. (Published, Unfinished, Unlisted, Archived, Disposed, Deleted) |
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. |
version | string | The version of the package. (pattern: <code>[^#/\s]+</code>) |
| Name | Datatype | Description |
|---|---|---|
origin | object | A PackageVersionOrigin object that contains information about how the package version was added to the repository. |
revision | string | The revision associated with a package version. (pattern: <code>\S+</code>) |
status | string | A string that contains the status of the package version. It can be one of the following: (Published, Unfinished, Unlisted, Archived, Disposed, Deleted) |
version | string | Information about a package version. (pattern: <code>[^#/\s]+</code>) |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
describe_package_version | select | domain, repository, format, package, version, region | domain-owner, namespace | Returns a PackageVersionDescription object that contains information about the requested package version. |
list_package_versions | select | domain, repository, format, package, region | domain-owner, namespace, status, sortBy, max-results, next-token, originType | Returns a list of PackageVersionSummary objects for package versions in a repository that match the request parameters. Package versions of all statuses will be returned by default when calling list-package-versions with no --status parameter. |
update_package_versions_status | update | domain, repository, format, package, region, versions, targetStatus | domain-owner, namespace | Updates the status of one or more versions of a package. Using UpdatePackageVersionsStatus, you can update the status of package versions to Archived, Published, or Unlisted. To set the status of a package version to Disposed, use DisposePackageVersions. |
delete_package_versions | delete | domain, repository, format, package, region | domain-owner, namespace | Deletes one or more versions of a package. A deleted package version cannot be restored in your repository. If you want to remove a package version from your repository and be able to restore it later, set its status to Archived. Archived packages cannot be downloaded from a repository and don't show up with list package APIs (for example, ListPackageVersions), but you can restore them using UpdatePackageVersionsStatus. |
copy_package_versions | exec | domain, source-repository, destination-repository, format, package, region | domain-owner, namespace | Copies package versions from one repository to another repository in the same domain. You must specify versions or versionRevisions. You cannot specify both. |
dispose_package_versions | exec | domain, repository, format, package, region, versions | domain-owner, namespace | Deletes the assets in package versions and sets the package versions' status to Disposed. A disposed package version cannot be restored in your repository because its assets are deleted. To view all disposed package versions in a repository, use ListPackageVersions and set the status parameter to Disposed. To view information about a disposed package version, use DescribePackageVersion. |
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 |
|---|---|---|
destination-repository | string | The name of the repository into which package versions are copied. |
domain | string | The name of the domain that contains the repository you want to dispose. |
format | string | A format that specifies the type of package versions you want to dispose. |
package | string | The name of the package with the versions you want to dispose. |
region | string | AWS region (default: us-east-1) |
repository | string | The name of the repository that contains the package versions you want to dispose. |
source-repository | string | The name of the repository that contains the package versions to be copied. |
version | string | A string that contains the package version (for example, 3.5.2). |
domain-owner | string | The 12-digit account number of the Amazon Web Services account that owns the domain. It does not include dashes or spaces. |
max-results | integer | The maximum number of results to return per page. |
namespace | string | The namespace of the package versions to be disposed. The package component that specifies its namespace depends on its type. For example: The namespace is required when disposing package versions of the following formats: Maven Swift generic 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. |
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. |
originType | string | The originType used to filter package versions. Only package versions with the provided originType will be returned. |
sortBy | string | How to sort the requested list of package versions. |
status | string | A string that filters the requested package versions by status. |
SELECT examples
- describe_package_version
- list_package_versions
Returns a PackageVersionDescription object that contains information about the requested package version.
SELECT
display_name,
format_,
home_page,
licenses,
namespace,
origin,
package_name,
published_time,
revision,
source_code_repository,
status,
summary,
version
FROM aws.codeartifact.package_versions
WHERE domain = '{{ domain }}' -- required
AND repository = '{{ repository }}' -- required
AND format = '{{ format }}' -- required
AND package = '{{ package }}' -- required
AND version = '{{ version }}' -- required
AND region = '{{ region }}' -- required
AND `domain-owner` = '{{ domain-owner }}'
AND namespace = '{{ namespace }}'
;
Returns a list of PackageVersionSummary objects for package versions in a repository that match the request parameters. Package versions of all statuses will be returned by default when calling list-package-versions with no --status parameter.
SELECT
origin,
revision,
status,
version
FROM aws.codeartifact.package_versions
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 }}'
AND status = '{{ status }}'
AND sortBy = '{{ sortBy }}'
AND `max-results` = '{{ max-results }}'
AND `next-token` = '{{ next-token }}'
AND originType = '{{ originType }}'
;
UPDATE examples
- update_package_versions_status
Updates the status of one or more versions of a package. Using UpdatePackageVersionsStatus, you can update the status of package versions to Archived, Published, or Unlisted. To set the status of a package version to Disposed, use DisposePackageVersions.
UPDATE aws.codeartifact.package_versions
SET
versions = '{{ versions }}',
versionRevisions = '{{ versionRevisions }}',
expectedStatus = '{{ expectedStatus }}',
targetStatus = '{{ targetStatus }}'
WHERE
domain = '{{ domain }}' --required
AND repository = '{{ repository }}' --required
AND format = '{{ format }}' --required
AND package = '{{ package }}' --required
AND region = '{{ region }}' --required
AND versions = '{{ versions }}' --required
AND targetStatus = '{{ targetStatus }}' --required
AND `domain-owner` = '{{ domain-owner}}'
AND namespace = '{{ namespace}}'
RETURNING
failed_versions,
successful_versions;
DELETE examples
- delete_package_versions
Deletes one or more versions of a package. A deleted package version cannot be restored in your repository. If you want to remove a package version from your repository and be able to restore it later, set its status to Archived. Archived packages cannot be downloaded from a repository and don't show up with list package APIs (for example, ListPackageVersions), but you can restore them using UpdatePackageVersionsStatus.
DELETE FROM aws.codeartifact.package_versions
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
- copy_package_versions
- dispose_package_versions
Copies package versions from one repository to another repository in the same domain. You must specify versions or versionRevisions. You cannot specify both.
EXEC aws.codeartifact.package_versions.copy_package_versions
@domain='{{ domain }}' --required,
@source-repository='{{ source-repository }}' --required,
@destination-repository='{{ destination-repository }}' --required,
@format='{{ format }}' --required,
@package='{{ package }}' --required,
@region='{{ region }}' --required,
@domain-owner='{{ domain-owner }}',
@namespace='{{ namespace }}'
@@json=
'{
"versions": "{{ versions }}",
"versionRevisions": "{{ versionRevisions }}",
"allowOverwrite": {{ allowOverwrite }},
"includeFromUpstream": {{ includeFromUpstream }}
}'
;
Deletes the assets in package versions and sets the package versions' status to Disposed. A disposed package version cannot be restored in your repository because its assets are deleted. To view all disposed package versions in a repository, use ListPackageVersions and set the status parameter to Disposed. To view information about a disposed package version, use DescribePackageVersion.
EXEC aws.codeartifact.package_versions.dispose_package_versions
@domain='{{ domain }}' --required,
@repository='{{ repository }}' --required,
@format='{{ format }}' --required,
@package='{{ package }}' --required,
@region='{{ region }}' --required,
@domain-owner='{{ domain-owner }}',
@namespace='{{ namespace }}'
@@json=
'{
"versions": "{{ versions }}",
"versionRevisions": "{{ versionRevisions }}",
"expectedStatus": "{{ expectedStatus }}"
}'
;