createAppBlockBuilder method

Future<CreateAppBlockBuilderResult> createAppBlockBuilder({
  1. required String instanceType,
  2. required String name,
  3. required AppBlockBuilderPlatformType platform,
  4. required VpcConfig vpcConfig,
  5. List<AccessEndpoint>? accessEndpoints,
  6. String? description,
  7. bool? disableIMDSV1,
  8. String? displayName,
  9. bool? enableDefaultInternetAccess,
  10. String? iamRoleArn,
  11. Map<String, String>? tags,
})

Creates an app block builder.

May throw ConcurrentModificationException. May throw InvalidAccountStatusException. May throw InvalidParameterCombinationException. May throw InvalidRoleException. May throw LimitExceededException. May throw OperationNotPermittedException. May throw RequestLimitExceededException. May throw ResourceAlreadyExistsException. May throw ResourceNotAvailableException. May throw ResourceNotFoundException.

Parameter instanceType : The instance type to use when launching the app block builder. The following instance types are available:

  • stream.standard.small
  • stream.standard.medium
  • stream.standard.large
  • stream.standard.xlarge
  • stream.standard.2xlarge

Parameter name : The unique name for the app block builder.

Parameter platform : The platform of the app block builder.

WINDOWS_SERVER_2019 is the only valid value.

Parameter vpcConfig : The VPC configuration for the app block builder.

App block builders require that you specify at least two subnets in different availability zones.

Parameter accessEndpoints : The list of interface VPC endpoint (interface endpoint) objects. Administrators can connect to the app block builder only through the specified endpoints.

Parameter description : The description of the app block builder.

Parameter disableIMDSV1 : Set to true to disable Instance Metadata Service Version 1 (IMDSv1) and enforce IMDSv2. Set to false to enable both IMDSv1 and IMDSv2.

Parameter displayName : The display name of the app block builder.

Parameter enableDefaultInternetAccess : Enables or disables default internet access for the app block builder.

Parameter iamRoleArn : The Amazon Resource Name (ARN) of the IAM role to apply to the app block builder. To assume a role, the app block builder calls the AWS Security Token Service (STS) AssumeRole API operation and passes the ARN of the role to use. The operation creates a new session with temporary credentials. WorkSpaces Applications retrieves the temporary credentials and creates the appstream_machine_role credential profile on the instance.

For more information, see Using an IAM Role to Grant Permissions to Applications and Scripts Running on WorkSpaces Applications Streaming Instances in the Amazon WorkSpaces Applications Administration Guide.

Parameter tags : The tags to associate with the app block builder. A tag is a key-value pair, and the value is optional. For example, Environment=Test. If you do not specify a value, Environment=.

If you do not specify a value, the value is set to an empty string.

Generally allowed characters are: letters, numbers, and spaces representable in UTF-8, and the following special characters:

_ . : / = + \ - @

For more information, see Tagging Your Resources in the Amazon WorkSpaces Applications Administration Guide.

Implementation

Future<CreateAppBlockBuilderResult> createAppBlockBuilder({
  required String instanceType,
  required String name,
  required AppBlockBuilderPlatformType platform,
  required VpcConfig vpcConfig,
  List<AccessEndpoint>? accessEndpoints,
  String? description,
  bool? disableIMDSV1,
  String? displayName,
  bool? enableDefaultInternetAccess,
  String? iamRoleArn,
  Map<String, String>? tags,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'PhotonAdminProxyService.CreateAppBlockBuilder'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'InstanceType': instanceType,
      'Name': name,
      'Platform': platform.value,
      'VpcConfig': vpcConfig,
      if (accessEndpoints != null) 'AccessEndpoints': accessEndpoints,
      if (description != null) 'Description': description,
      if (disableIMDSV1 != null) 'DisableIMDSV1': disableIMDSV1,
      if (displayName != null) 'DisplayName': displayName,
      if (enableDefaultInternetAccess != null)
        'EnableDefaultInternetAccess': enableDefaultInternetAccess,
      if (iamRoleArn != null) 'IamRoleArn': iamRoleArn,
      if (tags != null) 'Tags': tags,
    },
  );

  return CreateAppBlockBuilderResult.fromJson(jsonResponse.body);
}