createComponent method

Future<CreateComponentResponse> createComponent({
  1. required String name,
  2. required Platform platform,
  3. required String semanticVersion,
  4. String? changeDescription,
  5. String? clientToken,
  6. String? data,
  7. String? description,
  8. String? kmsKeyId,
  9. List<String>? supportedOsVersions,
  10. Map<String, String>? tags,
  11. String? uri,
})

Creates a new component that can be used to build, validate, test, and assess your image.

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. May throw ServiceQuotaExceededException.

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 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 supportedOsVersions : The operating system (OS) version supported by the component. If the OS information is available, a prefix match is performed against the parent image OS version during image recipe creation.

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<CreateComponentResponse> createComponent({
  required String name,
  required Platform platform,
  required String semanticVersion,
  String? changeDescription,
  String? clientToken,
  String? data,
  String? description,
  String? kmsKeyId,
  List<String>? supportedOsVersions,
  Map<String, String>? tags,
  String? uri,
}) async {
  ArgumentError.checkNotNull(name, 'name');
  ArgumentError.checkNotNull(platform, 'platform');
  ArgumentError.checkNotNull(semanticVersion, 'semanticVersion');
  _s.validateStringLength(
    'changeDescription',
    changeDescription,
    1,
    1024,
  );
  _s.validateStringLength(
    'clientToken',
    clientToken,
    1,
    36,
  );
  _s.validateStringLength(
    'data',
    data,
    1,
    16000,
  );
  _s.validateStringLength(
    'description',
    description,
    1,
    1024,
  );
  _s.validateStringLength(
    'kmsKeyId',
    kmsKeyId,
    1,
    1024,
  );
  final $payload = <String, dynamic>{
    'name': name,
    'platform': platform.toValue(),
    'semanticVersion': semanticVersion,
    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 (supportedOsVersions != null)
      'supportedOsVersions': supportedOsVersions,
    if (tags != null) 'tags': tags,
    if (uri != null) 'uri': uri,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'PUT',
    requestUri: '/CreateComponent',
    exceptionFnMap: _exceptionFns,
  );
  return CreateComponentResponse.fromJson(response);
}