@webda/aws
Version:
Webda AWS Services implementation
113 lines (112 loc) • 2.8 kB
TypeScript
import { SQS } from "@aws-sdk/client-sqs";
import { MessageReceipt, Queue, QueueParameters } from "@webda/core";
import CloudFormationDeployer from "../deployers/cloudformation.js";
import { CloudFormationContributor } from "./index.js";
declare const SQSQueueParameters_base: {
new (...args: any[]): {
endpoint?: string;
credentials?: {
accessKeyId: string;
secretAccessKey: string;
sessionToken?: string;
};
region?: string;
type: string;
url?: string;
openapi?: import("@webda/core/lib/router").OpenAPIWebdaDefinition;
};
} & typeof QueueParameters;
export declare class SQSQueueParameters extends SQSQueueParameters_base {
/**
* Time to wait pending for an item
* @default 20
*/
WaitTimeSeconds?: number;
/**
* Endpoint to pass to the AWS client
* Useful for localstack
*/
endpoint?: string;
/**
* Queue URL
* @default ""
*/
queue: string;
/**
* MessageGroupId to pass to send and receive
*/
MessageGroupId?: string;
/**
* Skip CloudFormation on deploy
* @default false
*/
CloudFormationSkip?: boolean;
/**
* Any additional CloudFormation parameters
*/
CloudFormation?: any;
constructor(params: any);
}
/**
* Implement SQS as queue for Webda
*
* @WebdaModda
*/
export default class SQSQueue<T = any, K extends SQSQueueParameters = SQSQueueParameters> extends Queue<T, K> implements CloudFormationContributor {
/**
* AWS SQS Client
*/
sqs: SQS;
/**
* @inheritdoc
*/
loadParameters(params: any): SQSQueueParameters;
/**
* @inheritdoc
*/
init(): Promise<this>;
/**
* @inheritdoc
*/
size(): Promise<number>;
/**
* @inheritdoc
*/
sendMessage(params: T): Promise<void>;
/**
* @inheritdoc
*/
receiveMessage<L>(proto?: {
new (): L;
}): Promise<MessageReceipt<L>[]>;
/**
* We will retrieve more than one message on receiveMessage if maxConsumers is higher
* therefore we need to divide by 10 (the max number of group messaged) to get the number
* of consumers
*
* @returns
*/
getMaxConsumers(): number;
/**
* @inheritdoc
*/
deleteMessage(receipt: string): Promise<void>;
/**
* @inheritdoc
*/
__clean(): Promise<void>;
private __cleanWithRetry;
_getQueueInfosFromUrl(): {
accountId: string;
region: string;
name: string;
};
getARNPolicy(): {
Sid: string;
Effect: string;
Action: string[];
Resource: string[];
};
getCloudFormation(deployer: CloudFormationDeployer): {};
}
export { SQSQueue };