createLocationEfs method

Future<CreateLocationEfsResponse> createLocationEfs({
  1. required Ec2Config ec2Config,
  2. required String efsFilesystemArn,
  3. String? subdirectory,
  4. List<TagListEntry>? tags,
})

Creates an endpoint for an Amazon EFS file system.

May throw InvalidRequestException. May throw InternalException.

Parameter ec2Config : The subnet and security group that the Amazon EFS file system uses. The security group that you provide needs to be able to communicate with the security group on the mount target in the subnet specified.

The exact relationship between security group M (of the mount target) and security group S (which you provide for DataSync to use at this stage) is as follows:

  • Security group M (which you associate with the mount target) must allow inbound access for the Transmission Control Protocol (TCP) on the NFS port (2049) from security group S. You can enable inbound connections either by IP address (CIDR range) or security group.
  • Security group S (provided to DataSync to access EFS) should have a rule that enables outbound connections to the NFS port on one of the file system’s mount targets. You can enable outbound connections either by IP address (CIDR range) or security group.

    For information about security groups and mount targets, see Security Groups for Amazon EC2 Instances and Mount Targets in the Amazon EFS User Guide.

Parameter efsFilesystemArn : The Amazon Resource Name (ARN) for the Amazon EFS file system.

Parameter subdirectory : A subdirectory in the location’s path. This subdirectory in the EFS file system is used to read data from the EFS source location or write data to the EFS destination. By default, AWS DataSync uses the root directory.

Parameter tags : The key-value pair that represents a tag that you want to add to the resource. The value can be an empty string. This value helps you manage, filter, and search for your resources. We recommend that you create a name tag for your location.

Implementation

Future<CreateLocationEfsResponse> createLocationEfs({
  required Ec2Config ec2Config,
  required String efsFilesystemArn,
  String? subdirectory,
  List<TagListEntry>? tags,
}) async {
  ArgumentError.checkNotNull(ec2Config, 'ec2Config');
  ArgumentError.checkNotNull(efsFilesystemArn, 'efsFilesystemArn');
  _s.validateStringLength(
    'efsFilesystemArn',
    efsFilesystemArn,
    0,
    128,
    isRequired: true,
  );
  _s.validateStringLength(
    'subdirectory',
    subdirectory,
    0,
    4096,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'FmrsService.CreateLocationEfs'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'Ec2Config': ec2Config,
      'EfsFilesystemArn': efsFilesystemArn,
      if (subdirectory != null) 'Subdirectory': subdirectory,
      if (tags != null) 'Tags': tags,
    },
  );

  return CreateLocationEfsResponse.fromJson(jsonResponse.body);
}