createLocationNfs method

Future<CreateLocationNfsResponse> createLocationNfs({
  1. required OnPremConfig onPremConfig,
  2. required String serverHostname,
  3. required String subdirectory,
  4. NfsMountOptions? mountOptions,
  5. List<TagListEntry>? tags,
})

Creates a transfer location for a Network File System (NFS) file server. DataSync can use this location as a source or destination for transferring data.

Before you begin, make sure that you understand how DataSync accesses NFS file servers.

May throw InternalException. May throw InvalidRequestException.

Parameter onPremConfig : Specifies the Amazon Resource Name (ARN) of the DataSync agent that can connect to your NFS file server.

You can specify more than one agent. For more information, see Using multiple DataSync agents.

Parameter serverHostname : Specifies the DNS name or IP address (IPv4 or IPv6) of the NFS file server that your DataSync agent connects to.

Parameter subdirectory : Specifies the export path in your NFS file server that you want DataSync to mount.

This path (or a subdirectory of the path) is where DataSync transfers data to or from. For information on configuring an export for DataSync, see Accessing NFS file servers.

Parameter mountOptions : Specifies the options that DataSync can use to mount your NFS file server.

Parameter tags : Specifies labels that help you categorize, filter, and search for your Amazon Web Services resources. We recommend creating at least a name tag for your location.

Implementation

Future<CreateLocationNfsResponse> createLocationNfs({
  required OnPremConfig onPremConfig,
  required String serverHostname,
  required String subdirectory,
  NfsMountOptions? mountOptions,
  List<TagListEntry>? tags,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'FmrsService.CreateLocationNfs'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'OnPremConfig': onPremConfig,
      'ServerHostname': serverHostname,
      'Subdirectory': subdirectory,
      if (mountOptions != null) 'MountOptions': mountOptions,
      if (tags != null) 'Tags': tags,
    },
  );

  return CreateLocationNfsResponse.fromJson(jsonResponse.body);
}