lemon-core
Version:
Lemon Serverless Micro-Service Platform
57 lines (56 loc) • 1.81 kB
TypeScript
import { CoreSnsService } from '../core-services';
/** ****************************************************************************************************************
* Public Instance Exported.
** ****************************************************************************************************************/
export declare class AWSSNSService implements CoreSnsService {
/**
* environ name of SNS KEY
* - for self messaging.
*/
static ENV_SNS_ENDPOINT: string;
static DEF_SNS_ENDPOINT: string;
private _arn;
constructor(arn?: string);
/**
* get name of this
*/
name: () => string;
/**
* hello
*/
hello: () => string;
/**
* get target endpoint by name.
*/
endpoint: (target?: string) => Promise<string>;
/**
* get current aws account-id.
*
* refer: `https://stackoverflow.com/questions/35563270/finding-my-aws-account-id-using-javascript`
*/
accountID: () => Promise<string>;
/**
* publish message
*
* @return {string | object} message-id
*/
publish: (target: string, subject: string, payload: any) => Promise<string>;
/**
* report error via SNS with subject 'error'
* - default to `lemon-hello-sns` or using `env[REPORT_ERROR_ARN]`
*
* @param e Error instance
* @param data simple text message or object to override.
* @param target (optional) target SNS arn (default is `REPORT_ERROR_ARN`)
*/
reportError: (e: Error, data: any, target?: string) => Promise<string>;
/**
* convert Error to payload.
*/
asPayload: (e: any, data: string | object) => {
'stack-trace'?: any;
message: string;
error: string;
errorss?: any[];
};
}