createEnvironment method

Future<CreateEnvironmentResponse> createEnvironment({
  1. required EngineType engineType,
  2. required String instanceType,
  3. required String name,
  4. String? clientToken,
  5. String? description,
  6. String? engineVersion,
  7. HighAvailabilityConfig? highAvailabilityConfig,
  8. String? kmsKeyId,
  9. NetworkType? networkType,
  10. String? preferredMaintenanceWindow,
  11. bool? publiclyAccessible,
  12. List<String>? securityGroupIds,
  13. List<StorageConfiguration>? storageConfigurations,
  14. List<String>? subnetIds,
  15. Map<String, String>? tags,
})

Creates a runtime environment for a given runtime engine.

May throw AccessDeniedException. May throw ConflictException. May throw InternalServerException. May throw ServiceQuotaExceededException. May throw ThrottlingException. May throw ValidationException.

Parameter engineType : The engine type for the runtime environment.

Parameter instanceType : The type of instance for the runtime environment.

Parameter name : The name of the runtime environment. Must be unique within the account.

Parameter clientToken : Unique, case-sensitive identifier you provide to ensure the idempotency of the request to create an environment. The service generates the clientToken when the API call is triggered. The token expires after one hour, so if you retry the API within this timeframe with the same clientToken, you will get the same response. The service also handles deleting the clientToken after it expires.

Parameter description : The description of the runtime environment.

Parameter engineVersion : The version of the engine type for the runtime environment.

Parameter highAvailabilityConfig : The details of a high availability configuration for this runtime environment.

Parameter kmsKeyId : The identifier of a customer managed key.

Parameter networkType : The network type required for the runtime environment.

Parameter preferredMaintenanceWindow : Configures the maintenance window that you want for the runtime environment. The maintenance window must have the format ddd:hh24:mi-ddd:hh24:mi and must be less than 24 hours. The following two examples are valid maintenance windows: sun:23:45-mon:00:15 or sat:01:00-sat:03:00.

If you do not provide a value, a random system-generated value will be assigned.

Parameter publiclyAccessible : Specifies whether the runtime environment is publicly accessible.

Parameter securityGroupIds : The list of security groups for the VPC associated with this runtime environment.

Parameter storageConfigurations : Optional. The storage configurations for this runtime environment.

Parameter subnetIds : The list of subnets associated with the VPC for this runtime environment.

Parameter tags : The tags for the runtime environment.

Implementation

Future<CreateEnvironmentResponse> createEnvironment({
  required EngineType engineType,
  required String instanceType,
  required String name,
  String? clientToken,
  String? description,
  String? engineVersion,
  HighAvailabilityConfig? highAvailabilityConfig,
  String? kmsKeyId,
  NetworkType? networkType,
  String? preferredMaintenanceWindow,
  bool? publiclyAccessible,
  List<String>? securityGroupIds,
  List<StorageConfiguration>? storageConfigurations,
  List<String>? subnetIds,
  Map<String, String>? tags,
}) async {
  final $payload = <String, dynamic>{
    'engineType': engineType.value,
    'instanceType': instanceType,
    'name': name,
    'clientToken': clientToken ?? _s.generateIdempotencyToken(),
    if (description != null) 'description': description,
    if (engineVersion != null) 'engineVersion': engineVersion,
    if (highAvailabilityConfig != null)
      'highAvailabilityConfig': highAvailabilityConfig,
    if (kmsKeyId != null) 'kmsKeyId': kmsKeyId,
    if (networkType != null) 'networkType': networkType.value,
    if (preferredMaintenanceWindow != null)
      'preferredMaintenanceWindow': preferredMaintenanceWindow,
    if (publiclyAccessible != null) 'publiclyAccessible': publiclyAccessible,
    if (securityGroupIds != null) 'securityGroupIds': securityGroupIds,
    if (storageConfigurations != null)
      'storageConfigurations': storageConfigurations,
    if (subnetIds != null) 'subnetIds': subnetIds,
    if (tags != null) 'tags': tags,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/environments',
    exceptionFnMap: _exceptionFns,
  );
  return CreateEnvironmentResponse.fromJson(response);
}