createInfrastructureConfiguration method

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

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

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

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

Parameter name : The name of the infrastructure configuration.

Parameter clientToken : The idempotency token used to make this request idempotent.

Parameter description : The description of the infrastructure configuration.

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. This can be used to log on to and debug the instance used to create your image.

Parameter logging : The logging configuration of the infrastructure configuration.

Parameter resourceTags : The tags attached to the resource created by Image Builder.

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

Parameter snsTopicArn : The SNS topic on which to send image build events.

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

Parameter tags : The tags of the infrastructure configuration.

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,
  List<String>? instanceTypes,
  String? keyPair,
  Logging? logging,
  Map<String, String>? resourceTags,
  List<String>? securityGroupIds,
  String? snsTopicArn,
  String? subnetId,
  Map<String, String>? tags,
  bool? terminateInstanceOnFailure,
}) async {
  ArgumentError.checkNotNull(instanceProfileName, 'instanceProfileName');
  _s.validateStringLength(
    'instanceProfileName',
    instanceProfileName,
    1,
    1024,
    isRequired: true,
  );
  ArgumentError.checkNotNull(name, 'name');
  _s.validateStringLength(
    'clientToken',
    clientToken,
    1,
    36,
  );
  _s.validateStringLength(
    'description',
    description,
    1,
    1024,
  );
  _s.validateStringLength(
    'keyPair',
    keyPair,
    1,
    1024,
  );
  _s.validateStringLength(
    'subnetId',
    subnetId,
    1,
    1024,
  );
  final $payload = <String, dynamic>{
    'instanceProfileName': instanceProfileName,
    'name': name,
    'clientToken': clientToken ?? _s.generateIdempotencyToken(),
    if (description != null) 'description': description,
    if (instanceTypes != null) 'instanceTypes': instanceTypes,
    if (keyPair != null) 'keyPair': keyPair,
    if (logging != null) 'logging': logging,
    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);
}