createEnvironment method

Future<CreateEnvironmentResponse> createEnvironment({
  1. required String name,
  2. required NetworkFabricType networkFabricType,
  3. String? clientToken,
  4. String? description,
  5. Map<String, String>? tags,
})

Creates an Amazon Web Services Migration Hub Refactor Spaces environment. The caller owns the environment resource, and all Refactor Spaces applications, services, and routes created within the environment. They are referred to as the environment owner. The environment owner has cross-account visibility and control of Refactor Spaces resources that are added to the environment by other accounts that the environment is shared with.

When creating an environment with a CreateEnvironment:NetworkFabricType of TRANSIT_GATEWAY, Refactor Spaces provisions a transit gateway to enable services in VPCs to communicate directly across accounts. If CreateEnvironment:NetworkFabricType is NONE, Refactor Spaces does not create a transit gateway and you must use your network infrastructure to route traffic to services with private URL endpoints.

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

Parameter name : The name of the environment.

Parameter networkFabricType : The network fabric type of the environment.

Parameter clientToken : A unique, case-sensitive identifier that you provide to ensure the idempotency of the request.

Parameter description : The description of the environment.

Parameter tags : The tags to assign to the environment. A tag is a label that you assign to an Amazon Web Services resource. Each tag consists of a key-value pair.

Implementation

Future<CreateEnvironmentResponse> createEnvironment({
  required String name,
  required NetworkFabricType networkFabricType,
  String? clientToken,
  String? description,
  Map<String, String>? tags,
}) async {
  final $payload = <String, dynamic>{
    'Name': name,
    'NetworkFabricType': networkFabricType.value,
    'ClientToken': clientToken ?? _s.generateIdempotencyToken(),
    if (description != null) 'Description': description,
    if (tags != null) 'Tags': tags,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/environments',
    exceptionFnMap: _exceptionFns,
  );
  return CreateEnvironmentResponse.fromJson(response);
}