createMountTarget method

Future<CreateMountTargetResponse> createMountTarget({
  1. required String fileSystemId,
  2. required String subnetId,
  3. IpAddressType? ipAddressType,
  4. String? ipv4Address,
  5. String? ipv6Address,
  6. List<String>? securityGroups,
})

Creates a mount target resource as an endpoint for mounting the S3 File System from compute resources in a specific Availability Zone and VPC. Mount targets provide network access to the file system.

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

Parameter fileSystemId : The ID or Amazon Resource Name (ARN) of the S3 File System to create the mount target for.

Parameter subnetId : The ID of the subnet where the mount target will be created. The subnet must be in the same Amazon Web Services Region as the file system. For file systems with regional availability, you can create mount targets in any subnet within the Region. The subnet determines the Availability Zone where the mount target will be located.

Parameter ipAddressType : The IP address type for the mount target. If not specified, IPV4_ONLY is used. The IP address type must match the IP configuration of the specified subnet.

Parameter ipv4Address : A specific IPv4 address to assign to the mount target. If not specified and the IP address type supports IPv4, an address is automatically assigned from the subnet's available IPv4 address range. The address must be within the subnet's CIDR block and not already in use.

Parameter ipv6Address : A specific IPv6 address to assign to the mount target. If not specified and the IP address type supports IPv6, an address is automatically assigned from the subnet's available IPv6 address range. The address must be within the subnet's IPv6 CIDR block and not already in use.

Parameter securityGroups : An array of VPC security group IDs to associate with the mount target's network interface. These security groups control network access to the mount target. If not specified, the default security group for the subnet's VPC is used. All security groups must belong to the same VPC as the subnet.

Implementation

Future<CreateMountTargetResponse> createMountTarget({
  required String fileSystemId,
  required String subnetId,
  IpAddressType? ipAddressType,
  String? ipv4Address,
  String? ipv6Address,
  List<String>? securityGroups,
}) async {
  final $payload = <String, dynamic>{
    'fileSystemId': fileSystemId,
    'subnetId': subnetId,
    if (ipAddressType != null) 'ipAddressType': ipAddressType.value,
    if (ipv4Address != null) 'ipv4Address': ipv4Address,
    if (ipv6Address != null) 'ipv6Address': ipv6Address,
    if (securityGroups != null) 'securityGroups': securityGroups,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'PUT',
    requestUri: '/mount-targets',
    exceptionFnMap: _exceptionFns,
  );
  return CreateMountTargetResponse.fromJson(response);
}