createInfrastructureConfiguration method

Future<CreateInfrastructureConfigurationResponse> createInfrastructureConfiguration({
  1. required String instanceProfileName,
  2. required String name,
  3. String? clientToken,
  4. String? description,
  5. InstanceMetadataOptions? instanceMetadataOptions,
  6. List<String>? instanceTypes,
  7. String? keyPair,
  8. Logging? logging,
  9. Placement? placement,
  10. Map<String, String>? resourceTags,
  11. List<String>? securityGroupIds,
  12. String? snsTopicArn,
  13. String? subnetId,
  14. Map<String, String>? tags,
  15. bool? terminateInstanceOnFailure,
})

Creates a new infrastructure configuration. An infrastructure configuration defines the environment in which your image will be built and tested.

May throw CallRateLimitExceededException. May throw ClientException. May throw ForbiddenException. May throw IdempotentParameterMismatchException. May throw InvalidRequestException. May throw ResourceAlreadyExistsException. May throw ResourceInUseException. May throw ServiceException. May throw ServiceQuotaExceededException. May throw ServiceUnavailableException.

Parameter instanceProfileName : The instance profile to associate with the instance used to customize your Amazon EC2 AMI.

Parameter name : The name of the infrastructure configuration.

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 description : The description of the infrastructure configuration.

Parameter instanceMetadataOptions : The instance metadata options that you can set for the HTTP requests that pipeline builds use to launch EC2 build and test instances.

Parameter instanceTypes : The instance types of the infrastructure configuration. You can specify one or more instance types to use for this build. The service will pick one of these instance types based on availability.

Parameter keyPair : The key pair of the infrastructure configuration. You can use this to log on to and debug the instance used to create your image.

Parameter logging : The logging configuration of the infrastructure configuration.

Parameter placement : The instance placement settings that define where the instances that are launched from your image will run.

Parameter resourceTags : The metadata tags to assign to the Amazon EC2 instance that Image Builder launches during the build process. Tags are formatted as key value pairs.

Parameter securityGroupIds : The security group IDs to associate with the instance used to customize your Amazon EC2 AMI.

Parameter snsTopicArn : The Amazon Resource Name (ARN) for the SNS topic to which we send image build event notifications.

Parameter subnetId : The subnet ID in which to place the instance used to customize your Amazon EC2 AMI.

Parameter tags : The metadata tags to assign to the infrastructure configuration resource that Image Builder creates as output. Tags are formatted as key value pairs.

Parameter terminateInstanceOnFailure : The terminate instance on failure setting of the infrastructure configuration. Set to false if you want Image Builder to retain the instance used to configure your AMI if the build or test phase of your workflow fails.

Implementation

Future<CreateInfrastructureConfigurationResponse>
    createInfrastructureConfiguration({
  required String instanceProfileName,
  required String name,
  String? clientToken,
  String? description,
  InstanceMetadataOptions? instanceMetadataOptions,
  List<String>? instanceTypes,
  String? keyPair,
  Logging? logging,
  Placement? placement,
  Map<String, String>? resourceTags,
  List<String>? securityGroupIds,
  String? snsTopicArn,
  String? subnetId,
  Map<String, String>? tags,
  bool? terminateInstanceOnFailure,
}) async {
  final $payload = <String, dynamic>{
    'instanceProfileName': instanceProfileName,
    'name': name,
    'clientToken': clientToken ?? _s.generateIdempotencyToken(),
    if (description != null) 'description': description,
    if (instanceMetadataOptions != null)
      'instanceMetadataOptions': instanceMetadataOptions,
    if (instanceTypes != null) 'instanceTypes': instanceTypes,
    if (keyPair != null) 'keyPair': keyPair,
    if (logging != null) 'logging': logging,
    if (placement != null) 'placement': placement,
    if (resourceTags != null) 'resourceTags': resourceTags,
    if (securityGroupIds != null) 'securityGroupIds': securityGroupIds,
    if (snsTopicArn != null) 'snsTopicArn': snsTopicArn,
    if (subnetId != null) 'subnetId': subnetId,
    if (tags != null) 'tags': tags,
    if (terminateInstanceOnFailure != null)
      'terminateInstanceOnFailure': terminateInstanceOnFailure,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'PUT',
    requestUri: '/CreateInfrastructureConfiguration',
    exceptionFnMap: _exceptionFns,
  );
  return CreateInfrastructureConfigurationResponse.fromJson(response);
}