@cloud-copilot/iam-collect
Version:
Collect IAM information from AWS Accounts
34 lines • 2 kB
TypeScript
import { type AwsService } from '../services.js';
/**
*
* @param operation The operation to run.
* @returns If successful, returns the result of operation. If operation returns a 404, returns undefined.
* @throws If operation returns a non 404 error, rethrows that error.
*/
export declare function runAndCatch404<T>(operation: () => Promise<T | undefined>): Promise<T | undefined>;
/**
*
* @param operation The operation to run.
* @returns If successful, returns the result of operation. If operation returns a 404, returns undefined.
* @throws If operation returns a non 400 error, rethrows that error.
*/
export declare function runAndCatchAccessDenied<T>(operation: () => Promise<T | undefined>, onError?: (error: any) => Promise<T | undefined>): Promise<T | undefined>;
export declare function runAndCatchAccessDeniedWithLog<T>(arn: string, awsService: AwsService, resourceType: string, field: string, operation: () => Promise<T | undefined>): Promise<T | undefined>;
/**
* Run an operation and catch a specific error by name. Return undefined if the error matches, otherwise rethrow the error.
*
* @param errorName the name of the error to catch
* @param operation the operation to run
* @returns If successful, returns the result of operation. If operation throws an error with the specified name, returns undefined.
* @throws If operation throws an error with a different name, rethrows that error.
*/
export declare function runAndCatchError<T>(errorName: string, operation: () => Promise<T | undefined>, onError?: (error: any) => Promise<T | undefined>): Promise<T | undefined>;
/**
* Retry a function that may fail due to DNS resolution issues.
*
* @param fn the function to retry
* @param tries the number of times to retry the function
* @returns the result of the function if successful, otherwise throws the last error encountered
*/
export declare function withDnsRetry<T>(fn: () => Promise<T>, tries?: number): Promise<T>;
//# sourceMappingURL=client-tools.d.ts.map