copyPackageVersions method
- required String destinationRepository,
- required String domain,
- required PackageFormat format,
- required String package,
- required String sourceRepository,
- bool? allowOverwrite,
- String? domainOwner,
- bool? includeFromUpstream,
- String? namespace,
- Map<
String, String> ? versionRevisions, - List<
String> ? versions,
Copies package versions from one repository to another repository in the same domain.
May throw AccessDeniedException.
May throw ConflictException.
May throw InternalServerException.
May throw ResourceNotFoundException.
May throw ServiceQuotaExceededException.
May throw ThrottlingException.
May throw ValidationException.
Parameter destinationRepository :
The name of the repository into which package versions are copied.
Parameter domain :
The name of the domain that contains the source and destination
repositories.
Parameter format :
The format of the package versions to be copied.
Parameter package :
The name of the package that contains the versions to be copied.
Parameter sourceRepository :
The name of the repository that contains the package versions to be
copied.
Parameter allowOverwrite :
Set to true to overwrite a package version that already exists in the
destination repository. If set to false and the package version already
exists in the destination repository, the package version is returned in
the failedVersions field of the response with an
ALREADY_EXISTS error code.
Parameter domainOwner :
The 12-digit account number of the Amazon Web Services account that owns
the domain. It does not include dashes or spaces.
Parameter includeFromUpstream :
Set to true to copy packages from repositories that are upstream from the
source repository to the destination repository. The default setting is
false. For more information, see Working
with upstream repositories.
Parameter namespace :
The namespace of the package versions to be copied. The package component
that specifies its namespace depends on its type. For example:
- 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.
Parameter versionRevisions :
A list of key-value pairs. The keys are package versions and the values
are package version revisions. A CopyPackageVersion operation
succeeds if the specified versions in the source repository match the
specified package version revision.
Parameter versions :
The versions of the package to be copied.
Implementation
Future<CopyPackageVersionsResult> copyPackageVersions({
required String destinationRepository,
required String domain,
required PackageFormat format,
required String package,
required String sourceRepository,
bool? allowOverwrite,
String? domainOwner,
bool? includeFromUpstream,
String? namespace,
Map<String, String>? versionRevisions,
List<String>? versions,
}) async {
final $query = <String, List<String>>{
'destination-repository': [destinationRepository],
'domain': [domain],
'format': [format.value],
'package': [package],
'source-repository': [sourceRepository],
if (domainOwner != null) 'domain-owner': [domainOwner],
if (namespace != null) 'namespace': [namespace],
};
final $payload = <String, dynamic>{
if (allowOverwrite != null) 'allowOverwrite': allowOverwrite,
if (includeFromUpstream != null)
'includeFromUpstream': includeFromUpstream,
if (versionRevisions != null) 'versionRevisions': versionRevisions,
if (versions != null) 'versions': versions,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri: '/v1/package/versions/copy',
queryParams: $query,
exceptionFnMap: _exceptionFns,
);
return CopyPackageVersionsResult.fromJson(response);
}