createEnvironment method

Future<CreateEnvironmentResponse> createEnvironment({
  1. required String desktopArn,
  2. String? clientToken,
  3. String? desiredSoftwareSetId,
  4. String? desktopEndpoint,
  5. Map<String, String>? deviceCreationTags,
  6. String? kmsKeyArn,
  7. MaintenanceWindow? maintenanceWindow,
  8. String? name,
  9. SoftwareSetUpdateMode? softwareSetUpdateMode,
  10. SoftwareSetUpdateSchedule? softwareSetUpdateSchedule,
  11. Map<String, String>? tags,
})

Creates an environment for your thin client devices.

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

Parameter desktopArn : The Amazon Resource Name (ARN) of the desktop to stream from Amazon WorkSpaces, WorkSpaces Secure Browser, or AppStream 2.0.

Parameter clientToken : Specifies a unique, case-sensitive identifier that you provide to ensure the idempotency of the request. This lets you safely retry the request without accidentally performing the same operation a second time. Passing the same value to a later call to an operation requires that you also pass the same value for all other parameters. We recommend that you use a UUID type of value.

If you don't provide this value, then Amazon Web Services generates a random one for you.

If you retry the operation with the same ClientToken, but with different parameters, the retry fails with an IdempotentParameterMismatch error.

Parameter desiredSoftwareSetId : The ID of the software set to apply.

Parameter desktopEndpoint : The URL for the identity provider login (only for environments that use AppStream 2.0).

Parameter deviceCreationTags : A map of the key-value pairs of the tag or tags to assign to the newly created devices for this environment.

Parameter kmsKeyArn : The Amazon Resource Name (ARN) of the Key Management Service key to use to encrypt the environment.

Parameter maintenanceWindow : A specification for a time window to apply software updates.

Parameter name : The name for the environment.

Parameter softwareSetUpdateMode : An option to define which software updates to apply.

Parameter softwareSetUpdateSchedule : An option to define if software updates should be applied within a maintenance window.

Parameter tags : A map of the key-value pairs of the tag or tags to assign to the resource.

Implementation

Future<CreateEnvironmentResponse> createEnvironment({
  required String desktopArn,
  String? clientToken,
  String? desiredSoftwareSetId,
  String? desktopEndpoint,
  Map<String, String>? deviceCreationTags,
  String? kmsKeyArn,
  MaintenanceWindow? maintenanceWindow,
  String? name,
  SoftwareSetUpdateMode? softwareSetUpdateMode,
  SoftwareSetUpdateSchedule? softwareSetUpdateSchedule,
  Map<String, String>? tags,
}) async {
  final $payload = <String, dynamic>{
    'desktopArn': desktopArn,
    'clientToken': clientToken ?? _s.generateIdempotencyToken(),
    if (desiredSoftwareSetId != null)
      'desiredSoftwareSetId': desiredSoftwareSetId,
    if (desktopEndpoint != null) 'desktopEndpoint': desktopEndpoint,
    if (deviceCreationTags != null) 'deviceCreationTags': deviceCreationTags,
    if (kmsKeyArn != null) 'kmsKeyArn': kmsKeyArn,
    if (maintenanceWindow != null) 'maintenanceWindow': maintenanceWindow,
    if (name != null) 'name': name,
    if (softwareSetUpdateMode != null)
      'softwareSetUpdateMode': softwareSetUpdateMode.value,
    if (softwareSetUpdateSchedule != null)
      'softwareSetUpdateSchedule': softwareSetUpdateSchedule.value,
    if (tags != null) 'tags': tags,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/environments',
    exceptionFnMap: _exceptionFns,
  );
  return CreateEnvironmentResponse.fromJson(response);
}