DynamoDB client.
import { createClient } from "https://denopkg.com/chiefbiiko/dynamodb/mod.ts";
// minimal config to create a client
const conf = {
accessKeyId: "abc",
secretAccessKey: "def",
region: "local"
}
// the client has all of DynamoDB's operations as camelCased async methods
const ddbc = createClient(conf);
// imagine a world with top-level await
const result = await ddbc.listTables();
/** Generic document. */
export interface Doc {
[key: string]: any;
}
/** Generic representation of a DynamoDB client. */
export interface DynamoDBClient {
describeEndpoints: (options?: Doc) => Promise<Doc>;
describeLimits: (options?: Doc) => Promise<Doc>;
listTables: (options?: Doc) => Promise<Doc>;
scan: (
params: Doc,
options?: Doc
) => Promise<Doc | AsyncIterableIterator<Doc>>;
query: (
params: Doc,
options?: Doc
) => Promise<Doc | AsyncIterableIterator<Doc>>;
[key: string]: (params: Doc, options?: Doc) => Promise<Doc>;
}
/** Client configuration. */
export interface ClientConfig {
accessKeyId: string; // AKIAIOSFODNN7EXAMPLE
secretAccessKey: string; // wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
region: string; // us-west-2
canonicalUri?: string; // fx /path/to/somewhere
port?: number; // 8000
}
/** Op options. */
export interface OpOptions {
wrapNumbers?: boolean, // wrap numbers to a special number value type? [false]
convertEmptyValues?: boolean, // convert empty strings and binaries? [false]
translateJSON?: boolean, // translate I/O JSON schemas? [true]
iteratePages?: boolean // if a result is paged, async-iterate it? [true]
}
Creates a DynamoDB client.
The client supports all DynamoDB operations. Check the linked aws docs for info about parameters of a specific operation.
aws DescribeContinuousBackups docs
aws DescribeGlobalTableSettings docs
aws RestoreTableFromBackup docs
aws RestoreTableToPointInTime docs
aws UpdateContinuousBackups docs
aws UpdateGlobalTableSettings docs
Don't want to do all development against the real AWS cloud?