UNPKG

@openzeppelin/defender-as-code

Version:
136 lines 6.17 kB
import Serverless from 'serverless'; import { Network } from '@openzeppelin/defender-sdk-base-client'; import { ActionClient } from '@openzeppelin/defender-sdk-action-client'; import { MonitorClient } from '@openzeppelin/defender-sdk-monitor-client'; import { RelayClient } from '@openzeppelin/defender-sdk-relay-client'; import { RelayGroupClient } from '@openzeppelin/defender-sdk-relay-group-client'; import { ProposalClient } from '@openzeppelin/defender-sdk-proposal-client'; import { DeployClient } from '@openzeppelin/defender-sdk-deploy-client'; import { NetworkClient } from '@openzeppelin/defender-sdk-network-client'; import { YSecret, DefenderAction, DefenderNotification, TeamKey, DefenderContract, ResourceType, DefenderBlockWatcher, DefenderFortaMonitor, DefenderBlockMonitor, Resources } from '../types'; import { Contract, DefenderID, Monitor, Notification } from '../types/types/resources.schema'; /** * @dev this function retrieves the Defender equivalent object of the provided template resource * This will not work for resources that do not have the stackResourceId property, ie. secrets and contracts */ export declare const getEquivalentResource: <Y, D>(context: Serverless, resource: Y, resources: { [k: string]: Y; } | undefined, currentResources: D[], type: ResourceType) => D | undefined; export declare const validateTypesAndSanitise: (o: object) => object; export declare const getEquivalentResourceByKey: <D>(resourceKey: string, currentResources: D[]) => D | undefined; /** * @dev returns both a list of consolidated secrets for both global and stack, where the latter will be preceded with the stack name. * */ export declare const getConsolidatedSecrets: (context: Serverless, resources: Resources) => YSecret[]; export declare const isTemplateResource: <Y, D>(context: Serverless, resource: D, resourceType: ResourceType, resources: { [k: string]: Y; } | Y[]) => boolean; export declare const getResourceID: (stackName: string, resourceName: string) => string; export declare const getStackName: (context: Serverless) => string; export declare const isSSOT: (context: Serverless) => boolean; export declare const getTeamAPIkeysOrThrow: (context: Serverless) => TeamKey; export declare const getMonitorClient: (key: TeamKey) => MonitorClient; export declare const getActionClient: (key: TeamKey) => ActionClient; export declare const getRelayClient: (key: TeamKey) => RelayClient; export declare const getRelayGroupClient: (key: TeamKey) => RelayGroupClient; export declare const getProposalClient: (key: TeamKey) => ProposalClient; export declare const getDeployClient: (key: TeamKey) => DeployClient; export declare const getNetworkClient: (key: TeamKey) => NetworkClient; export declare const constructNotification: (notification: Notification, stackResourceId: string) => { config: { apiKey: string; metricPrefix: string; url?: undefined; emails?: undefined; botToken?: undefined; chatId?: undefined; secret?: undefined; }; type: import("../types/types/resources.schema").NotificationType; name: string; paused: boolean; stackResourceId: string; } | { config: { url: string; apiKey?: undefined; metricPrefix?: undefined; emails?: undefined; botToken?: undefined; chatId?: undefined; secret?: undefined; }; type: import("../types/types/resources.schema").NotificationType; name: string; paused: boolean; stackResourceId: string; } | { config: { emails: string[]; apiKey?: undefined; metricPrefix?: undefined; url?: undefined; botToken?: undefined; chatId?: undefined; secret?: undefined; }; type: import("../types/types/resources.schema").NotificationType; name: string; paused: boolean; stackResourceId: string; } | { config: { botToken: string; chatId: string; apiKey?: undefined; metricPrefix?: undefined; url?: undefined; emails?: undefined; secret?: undefined; }; type: import("../types/types/resources.schema").NotificationType; name: string; paused: boolean; stackResourceId: string; } | { config: import("@openzeppelin/defender-sdk-monitor-client/lib/models/opsgenie").OpsgenieConfig; type: import("../types/types/resources.schema").NotificationType; name: string; paused: boolean; stackResourceId: string; } | { config: import("@openzeppelin/defender-sdk-monitor-client/lib/models/pager-duty").PagerDutyConfig; type: import("../types/types/resources.schema").NotificationType; name: string; paused: boolean; stackResourceId: string; } | { config: { url: string; secret: string | undefined; apiKey?: undefined; metricPrefix?: undefined; emails?: undefined; botToken?: undefined; chatId?: undefined; }; type: import("../types/types/resources.schema").NotificationType; name: string; paused: boolean; stackResourceId: string; }; export declare const isResource: <T>(item: T | undefined) => item is T; export declare const constructMonitor: (context: Serverless, resources: Resources, stackResourceId: string, monitor: Monitor, notifications: DefenderNotification[], actions: DefenderAction[], blockwatchers: DefenderBlockWatcher[], contracts: DefenderContract[]) => DefenderBlockMonitor | DefenderFortaMonitor; export declare const validateAdditionalPermissionsOrThrow: <T>(context: Serverless, resources: { [k: string]: T; } | T[] | undefined, resourceType: ResourceType) => Promise<void>; export declare const isUnauthorisedError: (e: any) => boolean; export declare const formatABI: (abi: Contract['abi']) => string | undefined; export declare const isDefenderId: (resource: any) => resource is string; export declare const removeDefenderIdReferences: <Y>(resources: { [k: string]: string | Y; } | undefined) => { [k: string]: Y; } | undefined; export declare const isTenantNetwork: (network?: Network) => network is string; //# sourceMappingURL=index.d.ts.map