createStudio method

Future<CreateStudioOutput> createStudio({
  1. required AuthMode authMode,
  2. required String engineSecurityGroupId,
  3. required String name,
  4. required String serviceRole,
  5. required List<String> subnetIds,
  6. required String userRole,
  7. required String vpcId,
  8. required String workspaceSecurityGroupId,
  9. String? defaultS3Location,
  10. String? description,
  11. List<Tag>? tags,
})
Creates a new Amazon EMR Studio.

May throw InternalServerException. May throw InvalidRequestException.

Parameter authMode : Specifies whether the Studio authenticates users using single sign-on (SSO) or IAM. Amazon EMR Studio currently only supports SSO authentication.

Parameter engineSecurityGroupId : The ID of the Amazon EMR Studio Engine security group. The Engine security group allows inbound network traffic from the Workspace security group, and it must be in the same VPC specified by VpcId.

Parameter name : A descriptive name for the Amazon EMR Studio.

Parameter serviceRole : The IAM role that will be assumed by the Amazon EMR Studio. The service role provides a way for Amazon EMR Studio to interoperate with other AWS services.

Parameter subnetIds : A list of subnet IDs to associate with the Studio. The subnets must belong to the VPC specified by VpcId. Studio users can create a Workspace in any of the specified subnets.

Parameter userRole : The IAM user role that will be assumed by users and groups logged in to a Studio. The permissions attached to this IAM role can be scoped down for each user or group using session policies.

Parameter vpcId : The ID of the Amazon Virtual Private Cloud (Amazon VPC) to associate with the Studio.

Parameter workspaceSecurityGroupId : The ID of the Amazon EMR Studio Workspace security group. The Workspace security group allows outbound network traffic to resources in the Engine security group, and it must be in the same VPC specified by VpcId.

Parameter defaultS3Location : The default Amazon S3 location to back up EMR Studio Workspaces and notebook files. A Studio user can select an alternative Amazon S3 location when creating a Workspace.

Parameter description : A detailed description of the Studio.

Parameter tags : A list of tags to associate with the Studio. Tags are user-defined key-value pairs that consist of a required key string with a maximum of 128 characters, and an optional value string with a maximum of 256 characters.

Implementation

Future<CreateStudioOutput> createStudio({
  required AuthMode authMode,
  required String engineSecurityGroupId,
  required String name,
  required String serviceRole,
  required List<String> subnetIds,
  required String userRole,
  required String vpcId,
  required String workspaceSecurityGroupId,
  String? defaultS3Location,
  String? description,
  List<Tag>? tags,
}) async {
  ArgumentError.checkNotNull(authMode, 'authMode');
  ArgumentError.checkNotNull(engineSecurityGroupId, 'engineSecurityGroupId');
  _s.validateStringLength(
    'engineSecurityGroupId',
    engineSecurityGroupId,
    0,
    256,
    isRequired: true,
  );
  ArgumentError.checkNotNull(name, 'name');
  _s.validateStringLength(
    'name',
    name,
    0,
    256,
    isRequired: true,
  );
  ArgumentError.checkNotNull(serviceRole, 'serviceRole');
  _s.validateStringLength(
    'serviceRole',
    serviceRole,
    0,
    10280,
    isRequired: true,
  );
  ArgumentError.checkNotNull(subnetIds, 'subnetIds');
  ArgumentError.checkNotNull(userRole, 'userRole');
  _s.validateStringLength(
    'userRole',
    userRole,
    0,
    10280,
    isRequired: true,
  );
  ArgumentError.checkNotNull(vpcId, 'vpcId');
  _s.validateStringLength(
    'vpcId',
    vpcId,
    0,
    256,
    isRequired: true,
  );
  ArgumentError.checkNotNull(
      workspaceSecurityGroupId, 'workspaceSecurityGroupId');
  _s.validateStringLength(
    'workspaceSecurityGroupId',
    workspaceSecurityGroupId,
    0,
    256,
    isRequired: true,
  );
  _s.validateStringLength(
    'defaultS3Location',
    defaultS3Location,
    0,
    10280,
  );
  _s.validateStringLength(
    'description',
    description,
    0,
    256,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'ElasticMapReduce.CreateStudio'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'AuthMode': authMode.toValue(),
      'EngineSecurityGroupId': engineSecurityGroupId,
      'Name': name,
      'ServiceRole': serviceRole,
      'SubnetIds': subnetIds,
      'UserRole': userRole,
      'VpcId': vpcId,
      'WorkspaceSecurityGroupId': workspaceSecurityGroupId,
      if (defaultS3Location != null) 'DefaultS3Location': defaultS3Location,
      if (description != null) 'Description': description,
      if (tags != null) 'Tags': tags,
    },
  );

  return CreateStudioOutput.fromJson(jsonResponse.body);
}