createSnapshot method

Future<CreateSnapshotResult> createSnapshot({
  1. required String directoryId,
  2. String? name,
})

Creates a snapshot of a Simple AD or Microsoft AD directory in the AWS cloud.

May throw EntityDoesNotExistException. May throw InvalidParameterException. May throw SnapshotLimitExceededException. May throw ClientException. May throw ServiceException.

Parameter directoryId : The identifier of the directory of which to take a snapshot.

Parameter name : The descriptive name to apply to the snapshot.

Implementation

Future<CreateSnapshotResult> createSnapshot({
  required String directoryId,
  String? name,
}) async {
  ArgumentError.checkNotNull(directoryId, 'directoryId');
  _s.validateStringLength(
    'name',
    name,
    0,
    128,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'DirectoryService_20150416.CreateSnapshot'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'DirectoryId': directoryId,
      if (name != null) 'Name': name,
    },
  );

  return CreateSnapshotResult.fromJson(jsonResponse.body);
}