Fugue.AWS.DynamoDB.Table

This is the preferred interface for making DynamoDB resources with Fugue. The Table and Projection modules comprise the bulk of the interface.

If you want to manage a DynamoDB table with Fugue, the new function is the right place to start.

Module Members

new

(Function)

new DynamoDB Table (Constructor)

Call this constructor to create a new Fugue.Core.AWS.DynamoDB.Table value.

Example:

import Fugue.AWS.DynamoDB as DynamoDB
import Fugue.AWS as AWS

table: DynamoDB.Table.new {
  name: "another-table",
  region: AWS.Us-west-2,
  attributes: {
    "PropertyName": DynamoDB.S
  },
  schema: {
    "PropertyName": DynamoDB.HASH
  },
  provisionedThroughput: {
    read: 10,
    write: 10,
  },
  localSecondaryIndexes: {
    "lastUpdate": {
      schema: {
        "lastUpdate": DynamoDB.RANGE,
      },
      projection: DynamoDB.Projection.all,
    }
  },
  globalSecondaryIndexes: None,
  streamViewType: DynamoDB.NewImageView,
  timeToLiveAttributeName: "PropertyName",
}

Type Signature

 fun { attributes: Dictionary<ScalarAttributeType>,
       name: String,
       schema: Schema,
       provisionedThroughput: Throughput,
       localSecondaryIndexes: Optional<Dictionary<LocalSecondaryIndex>>,
       globalSecondaryIndexes: Optional<Dictionary<GlobalSecondaryIndex>>,
       streamViewType: Optional<StreamViewType>,
       timeToLiveAttributeName: Optional<String>,
       region: Region,
       resourceId: Optional<String> } -> Table
Argument: attributes

Dictionary mapping attribute name to ScalarAttributeType.

Type: Dictionary<ScalarAttributeType>

Argument: name

The name of the table.

Type: String

Argument: schema

Dictionary mapping key name to KeyType.

Type: Schema

Argument: provisionedThroughput

A record specifying the read and write capacity to provision. Mutable.

Type: Throughput

Argument: localSecondaryIndexes

An optional dictionary of index names to LocalSecondaryIndex specifications.

Type: Optional<Dictionary<LocalSecondaryIndex>>

Argument: globalSecondaryIndexes

An optional dictionary of index names to GlobalSecondaryIndex specifications. Mutable.

Type: Optional<Dictionary<GlobalSecondaryIndex>>

Argument: streamViewType

If specified a stream of the given type is configured. Mutable.

Type: Optional<StreamViewType>

Argument: timeToLiveAttributeName

If specified, sets the Time To Live attribute for the table. Mutable.

Type: Optional<String>

Argument: region

The AWS region in which to create the table.

Type: Region

Argument: resourceId

Resource ID of the resource to import with Fugue Import. This field is only honored on fugue run. The resource ID is the ARN. Mutable. Example: arn:aws:dynamodb:us-east-1:123456789012:table/books_table

Type: Optional<String>

Returns:

A Fugue.Core.AWS.DynamoDB.Table value.

Type: Table

GlobalSecondaryIndex

(Type)

type GlobalSecondaryIndex:
  Index<{provisionedThroughput: Throughput}>

DynamoDB Global Secondary Index

This type of value defines a global secondary index for a DynamoDB table. It is given as a dictionary, with the index name as a key and an Index value. Additionally, the Index value will also require the following field:

provisionedThroughput : Throughput The read and write throughput to provision for the index.

Example:

globalSecondaryIndexes: {
  "lastUpdate": {
    schema: {
      "lastUpdate": DynamoDB.RANGE,
    },
    projection: DynamoDB.Projection.all,
    provisionedThroughput: { read: 10, write: 10 }
  }
}

Index<{provisionedThroughput: Throughput}>

Index

(Type)

type Index<a>:
  {
    schema: Schema,
    projection: Projection,
    a
  }

DynamoDB Index Type

This type of value defines both Local and Global secondary indices.

Example (showing LocalSecondaryIndex):

"lastUpdate": {
  schema: {
    "lastUpdate": DynamoDB.RANGE,
  },
  projection: DynamoDB.Projection.all,
}

Record {

Field: schema

The key schema of the index.

Type: Schema

Field: projection

The type of data projection to use for the index.

Type: Projection

}

LocalSecondaryIndex

(Type)

type LocalSecondaryIndex:
  Index<{}>

DynamoDB Local Secondary Index

This type of value defines a local secondary index for a DynamoDB table. It is given as a dictionary, with the index name as a key and an Index value.

Example:

localSecondaryIndexes: {
  "lastUpdate": {
    schema: {
      "lastUpdate": DynamoDB.RANGE,
    },
    projection: DynamoDB.Projection.all,
  }
}

Index<{}>

Schema

(Type)

type Schema:
  Dictionary<KeyType>

DynamoDB Key Schema (Resource Component)

This type of value defines the table’s key schema. Schemas include a hash key, hash and range keys, etc.

Example:

schema: {
  "PropertyName": DynamoDB.HASH
}

This value is given as a dictionary of property name keys to KeyType values. Ludwig.Dictionary<KeyType>

Throughput

(Type)

type Throughput:
  read: Int
  write: Int

DynamoDB Throughput (Resource Component)

This type of value specifies the throughput to be provisioned for a DynamoDB table.

Example:

provisionedThroughput: {
  read: 10,
  write: 10,
}

Record {

Field: read

The read throughput of the table.

Type: Int

Field: write

The write throughput of the table.

Type: Int

}

default

(Value)

default:

DynamoDB Table Specification (Default Values)

DEPRECATED: Use of Fugue.AWS.DynamoDB.Table.default is no longer required. It will be removed in a future release.