importComponent method

Future<ImportComponentResponse> importComponent({
  1. required ComponentFormat format,
  2. required String name,
  3. required Platform platform,
  4. required String semanticVersion,
  5. required ComponentType type,
  6. String? changeDescription,
  7. String? clientToken,
  8. String? data,
  9. String? description,
  10. String? kmsKeyId,
  11. Map<String, String>? tags,
  12. String? uri,
})

Imports a component and transforms its data into a component document.

May throw ServiceException. May throw ClientException. May throw ServiceUnavailableException. May throw InvalidRequestException. May throw IdempotentParameterMismatchException. May throw ForbiddenException. May throw CallRateLimitExceededException. May throw InvalidVersionNumberException. May throw ResourceInUseException. May throw InvalidParameterCombinationException.

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. For example, major.minor.patch. This could be versioned like software (2.0.1) or like a date (2019.12.01).

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. Describes what change has been made in this version, or what makes this version different from other versions of this component.

Parameter clientToken : The idempotency token of the component.

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 ID of the KMS key that should be used to encrypt this component.

Parameter tags : The tags of the component.

Parameter uri : The uri of the component. Must be an S3 URL and the requester must have permission to access the S3 bucket. If you use 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 {
  ArgumentError.checkNotNull(format, 'format');
  ArgumentError.checkNotNull(name, 'name');
  ArgumentError.checkNotNull(platform, 'platform');
  ArgumentError.checkNotNull(semanticVersion, 'semanticVersion');
  ArgumentError.checkNotNull(type, 'type');
  _s.validateStringLength(
    'changeDescription',
    changeDescription,
    1,
    1024,
  );
  _s.validateStringLength(
    'clientToken',
    clientToken,
    1,
    36,
  );
  _s.validateStringLength(
    'data',
    data,
    1,
    1024,
  );
  _s.validateStringLength(
    'description',
    description,
    1,
    1024,
  );
  _s.validateStringLength(
    'kmsKeyId',
    kmsKeyId,
    1,
    1024,
  );
  final $payload = <String, dynamic>{
    'format': format.toValue(),
    'name': name,
    'platform': platform.toValue(),
    'semanticVersion': semanticVersion,
    'type': type.toValue(),
    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);
}