importComponent method
Imports a component and transforms its data into a component document.
May throw CallRateLimitExceededException.
May throw ClientException.
May throw ForbiddenException.
May throw IdempotentParameterMismatchException.
May throw InvalidParameterCombinationException.
May throw InvalidRequestException.
May throw InvalidVersionNumberException.
May throw ResourceInUseException.
May throw ServiceException.
May throw ServiceUnavailableException.
Parameter format :
The format of the resource that you want to import as a component.
Parameter name :
The name of the component.
Parameter platform :
The platform of the component.
Parameter semanticVersion :
The semantic version of the component. This version follows the semantic
version syntax.
Filtering: With semantic versioning, you have the flexibility to use wildcards (x) to specify the most recent versions or nodes when selecting the base image or components for your recipe. When you use a wildcard in any node, all nodes to the right of the first wildcard must also be wildcards.
Parameter type :
The type of the component denotes whether the component is used to build
the image, or only to test it.
Parameter changeDescription :
The change description of the component. This description indicates the
change that has been made in this version, or what makes this version
different from other versions of the component.
Parameter clientToken :
Unique, case-sensitive identifier you provide to ensure idempotency of the
request. For more information, see Ensuring
idempotency in the Amazon EC2 API Reference.
Parameter data :
The data of the component. Used to specify the data inline. Either
data or uri can be used to specify the data
within the component.
Parameter description :
The description of the component. Describes the contents of the component.
Parameter kmsKeyId :
The Amazon Resource Name (ARN) that uniquely identifies the KMS key used
to encrypt this component. This can be either the Key ARN or the Alias
ARN. For more information, see Key
identifiers (KeyId) in the Key Management Service Developer
Guide.
Parameter tags :
The tags of the component.
Parameter uri :
The uri of the component. Must be an Amazon S3 URL and the requester must
have permission to access the Amazon S3 bucket. If you use Amazon S3, you
can specify component content up to your service quota. Either
data or uri can be used to specify the data
within the component.
Implementation
Future<ImportComponentResponse> importComponent({
required ComponentFormat format,
required String name,
required Platform platform,
required String semanticVersion,
required ComponentType type,
String? changeDescription,
String? clientToken,
String? data,
String? description,
String? kmsKeyId,
Map<String, String>? tags,
String? uri,
}) async {
final $payload = <String, dynamic>{
'format': format.value,
'name': name,
'platform': platform.value,
'semanticVersion': semanticVersion,
'type': type.value,
if (changeDescription != null) 'changeDescription': changeDescription,
'clientToken': clientToken ?? _s.generateIdempotencyToken(),
if (data != null) 'data': data,
if (description != null) 'description': description,
if (kmsKeyId != null) 'kmsKeyId': kmsKeyId,
if (tags != null) 'tags': tags,
if (uri != null) 'uri': uri,
};
final response = await _protocol.send(
payload: $payload,
method: 'PUT',
requestUri: '/ImportComponent',
exceptionFnMap: _exceptionFns,
);
return ImportComponentResponse.fromJson(response);
}