createFileSystemFromBackup method

Future<CreateFileSystemFromBackupResponse> createFileSystemFromBackup({
  1. required String backupId,
  2. required List<String> subnetIds,
  3. String? clientRequestToken,
  4. CreateFileSystemLustreConfiguration? lustreConfiguration,
  5. List<String>? securityGroupIds,
  6. StorageType? storageType,
  7. List<Tag>? tags,
  8. CreateFileSystemWindowsConfiguration? windowsConfiguration,
})

Creates a new Amazon FSx file system from an existing Amazon FSx backup.

If a file system with the specified client request token exists and the parameters match, this operation returns the description of the file system. If a client request token specified by the file system exists and the parameters don't match, this call returns IncompatibleParameterError. If a file system with the specified client request token doesn't exist, this operation does the following:

  • Creates a new Amazon FSx file system from backup with an assigned ID, and an initial lifecycle state of CREATING.
  • Returns the description of the file system.
Parameters like Active Directory, default share name, automatic backup, and backup settings default to the parameters of the file system that was backed up, unless overridden. You can explicitly supply other settings.

By using the idempotent operation, you can retry a CreateFileSystemFromBackup call without the risk of creating an extra file system. This approach can be useful when an initial call fails in a way that makes it unclear whether a file system was created. Examples are if a transport level timeout occurred, or your connection was reset. If you use the same client request token and the initial call created a file system, the client receives success as long as the parameters are the same.

May throw BadRequest. May throw ActiveDirectoryError. May throw IncompatibleParameterError. May throw InvalidNetworkSettings. May throw InvalidPerUnitStorageThroughput. May throw ServiceLimitExceeded. May throw BackupNotFound. May throw InternalServerError. May throw MissingFileSystemConfiguration.

Parameter subnetIds : Specifies the IDs of the subnets that the file system will be accessible from. For Windows MULTI_AZ_1 file system deployment types, provide exactly two subnet IDs, one for the preferred file server and one for the standby file server. You specify one of these subnets as the preferred subnet using the WindowsConfiguration > PreferredSubnetID property.

For Windows SINGLE_AZ_1 and SINGLE_AZ_2 deployment types and Lustre file systems, provide exactly one subnet ID. The file server is launched in that subnet's Availability Zone.

Parameter clientRequestToken : A string of up to 64 ASCII characters that Amazon FSx uses to ensure idempotent creation. This string is automatically filled on your behalf when you use the AWS Command Line Interface (AWS CLI) or an AWS SDK.

Parameter securityGroupIds : A list of IDs for the security groups that apply to the specified network interfaces created for file system access. These security groups apply to all network interfaces. This value isn't returned in later DescribeFileSystem requests.

Parameter storageType : Sets the storage type for the Windows file system you're creating from a backup. Valid values are SSD and HDD.

  • Set to SSD to use solid state drive storage. Supported on all Windows deployment types.
  • Set to HDD to use hard disk drive storage. Supported on SINGLE_AZ_2 and MULTI_AZ_1 Windows file system deployment types.
Default value is SSD.

Parameter tags : The tags to be applied to the file system at file system creation. The key value of the Name tag appears in the console as the file system name.

Parameter windowsConfiguration : The configuration for this Microsoft Windows file system.

Implementation

Future<CreateFileSystemFromBackupResponse> createFileSystemFromBackup({
  required String backupId,
  required List<String> subnetIds,
  String? clientRequestToken,
  CreateFileSystemLustreConfiguration? lustreConfiguration,
  List<String>? securityGroupIds,
  StorageType? storageType,
  List<Tag>? tags,
  CreateFileSystemWindowsConfiguration? windowsConfiguration,
}) async {
  ArgumentError.checkNotNull(backupId, 'backupId');
  _s.validateStringLength(
    'backupId',
    backupId,
    12,
    128,
    isRequired: true,
  );
  ArgumentError.checkNotNull(subnetIds, 'subnetIds');
  _s.validateStringLength(
    'clientRequestToken',
    clientRequestToken,
    1,
    63,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSSimbaAPIService_v20180301.CreateFileSystemFromBackup'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'BackupId': backupId,
      'SubnetIds': subnetIds,
      'ClientRequestToken':
          clientRequestToken ?? _s.generateIdempotencyToken(),
      if (lustreConfiguration != null)
        'LustreConfiguration': lustreConfiguration,
      if (securityGroupIds != null) 'SecurityGroupIds': securityGroupIds,
      if (storageType != null) 'StorageType': storageType.toValue(),
      if (tags != null) 'Tags': tags,
      if (windowsConfiguration != null)
        'WindowsConfiguration': windowsConfiguration,
    },
  );

  return CreateFileSystemFromBackupResponse.fromJson(jsonResponse.body);
}