UNPKG

@cumulus/aws-client

Version:
93 lines 3.98 kB
/** * @module DynamoDb */ import pRetry from 'p-retry'; import { CreateTableInput, DeleteTableInput, ScanInput, Select } from '@aws-sdk/client-dynamodb'; import { DynamoDBDocument, GetCommandInput, ScanCommandInput, ScanCommandOutput } from '@aws-sdk/lib-dynamodb'; /** * Call DynamoDb client get * * See [DocumentClient.get()](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/modules/_aws_sdk_lib_dynamodb.html) * for descriptions of `params` and the return data. * * @param {Object} params * @param {string} params.tableName - Table name to read * @param {GetCommandInput.Key} params.item - Key identifying object to get * @param {DynamoDBDocument} params.client - Instance of a DynamoDb DocumentClient * @param {Object} params.getParams - Additional parameters for DocumentClient.get() * @returns {Promise<Object>} * @throws {RecordDoesNotExist} if a record cannot be found */ export declare const get: (params: { tableName: string; item: GetCommandInput['Key']; client: DynamoDBDocument; getParams?: object; }) => Promise<Record<string, any>>; /** * Call DynamoDb client scan * * See [DocumentClient.scan()](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/modules/_aws_sdk_lib_dynamodb.html) * for descriptions of `params` and the return data. * * @param {Object} params * @returns {Promise<Object>} */ export declare const scan: (params: { tableName: string; client: DynamoDBDocument; query?: { filter?: string | undefined; names?: ScanInput['ExpressionAttributeNames']; values?: ScanCommandInput['ExpressionAttributeValues']; } | undefined; fields?: string | undefined; limit?: number | undefined; select: Select; startKey?: ScanInput['ExclusiveStartKey']; }) => Promise<ScanCommandOutput>; /** * Do a parallel scan of DynamoDB table using a document client. * * See https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Scan.html#Scan.ParallelScan. * See [DocumentClient.scan()](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/modules/_aws_sdk_lib_dynamodb.html). * * @param {Object} params * @param {number} params.totalSegments * Total number of segments to divide table into for parallel scanning * @param {ScanInput} params.scanParams * Params for the DynamoDB client scan operation * See https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Scan.html * @param {function} params.processItemsFunc - Function used to process returned items by scan * @param {DynamoDBDocument} [params.dynamoDbClient] - Instance of Dynamo DB document client * @param {pRetry.Options} [params.retryOptions] - Retry options for scan operations * @returns {Promise} */ export declare const parallelScan: (params: { totalSegments: number; scanParams: ScanCommandInput; processItemsFunc: (items: ScanCommandOutput['Items']) => Promise<void>; dynamoDbClient: DynamoDBDocument; retryOptions?: pRetry.Options | undefined; }) => Promise<void[]>; /** * Create a DynamoDB table and then wait for the table to exist * * @param {Object} params - the same params that you would pass to AWS.createTable * See https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-dynamodb/classes/dynamodb.html#createtable * @returns {Promise<Object>} the output of the createTable call * * @static */ export declare function createAndWaitForDynamoDbTable(params: CreateTableInput): Promise<import("@aws-sdk/client-dynamodb").CreateTableCommandOutput>; /** * Delete a DynamoDB table and then wait for the table to not exist * * @param {Object} params - the same params that you would pass to AWS.deleteTable * See https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-dynamodb/classes/dynamodb.html#deletetable * @returns {Promise} * * @static */ export declare function deleteAndWaitForDynamoDbTableNotExists(params: DeleteTableInput): Promise<void>; //# sourceMappingURL=DynamoDb.d.ts.map