@cloud-copilot/iam-collect
Version:
Collect IAM information from AWS Accounts
48 lines • 2.47 kB
TypeScript
import { PathBasedPersistenceAdapter } from '../PathBasedPersistenceAdapter.js';
export declare class FileSystemAdapter implements PathBasedPersistenceAdapter {
writeFile(filePath: string, data: string | Buffer): Promise<void>;
/**
* Write the contents of a file. If the file already exists, it will be overwritten if the
* lock ID matches the current hash of the file.
*
* @param filePath The path to the file to write
* @param data The data to write to the file
*/
writeWithOptimisticLock(filePath: string, data: string | Buffer, lockId: string): Promise<boolean>;
/**
* Read the contents of a file. If the file does not exist, return undefined.
*
* @param filePath The path to the file to read
* @returns The contents of the file as a string, or undefined if the file does not exist.
*/
readFile(filePath: string): Promise<string | undefined>;
/**
* Read the contents of a file and compute its SHA-256 hash. If the file does not exist, return undefined.
*
* @param filePath The path to the file to read
* @returns An object containing the contents of the file as a string and its SHA-256 hash as a hex string, or undefined if the file does not exist.
*/
readFileWithHash(filePath: string): Promise<{
data: string;
hash: string;
} | undefined>;
deleteFile(filePath: string): Promise<void>;
deleteDirectory(dirPath: string): Promise<void>;
/**
* List the contents of a directory. Will return the names of the subdirectories and files without the full path.
*
* @param dirPath The path to the directory to list
* @returns An array of strings representing the names of the subdirectories or files in the specified directory.
*/
listDirectory(dirPath: string): Promise<string[]>;
/**
* Find files based on a pattern of directories and a filename. The pattern can include wildcards (*) to match any directory.
*
* @param baseDir the base directory to start searching from
* @param pathParts the parts of the path to search for, where '*' can be used as a wildcard
* @param filename the name of the file to search for
* @returns an array of strings representing the paths to the files that match the pattern and filename
*/
findWithPattern(baseDir: string, pathParts: string[], filename: string): Promise<string[]>;
}
//# sourceMappingURL=FileSystemAdapter.d.ts.map