dynamodb-dashboard
Version:
GUI Dashboard for local or remote DynamoDB
57 lines (53 loc) • 2.54 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.updateTimeToLive = exports.update = exports.create = void 0;
var _joi = _interopRequireDefault(require("joi"));
var _tableCommon = require("./common/table.common.joi");
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
// https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/SQLtoNoSQL.CreateTable.html
// https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBMapper.DataTypes.html
var create = exports.create = _joi["default"].object({
TableName: _joi["default"].string().required(),
KeySchema: _tableCommon.KeySchemaSchema,
AttributeDefinitions: _tableCommon.AttributeDefinitionsSchema,
ProvisionedThroughput: _tableCommon.ProvisionedThroughputSchema,
GlobalSecondaryIndexes: _joi["default"].array().items(_joi["default"].object({
IndexName: _joi["default"].string().required(),
KeySchema: _tableCommon.KeySchemaSchema,
Projection: _tableCommon.ProjectionSchema,
ProvisionedThroughput: _tableCommon.ProvisionedThroughputSchema
})),
LocalSecondaryIndexes: _joi["default"].array().items(_joi["default"].object({
IndexName: _joi["default"].string().required(),
KeySchema: _tableCommon.KeySchemaSchema,
Projection: _tableCommon.ProjectionSchema
}))
});
// https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_UpdateTable.html#DDB-UpdateTable-request-AttributeDefinitions
var update = exports.update = _joi["default"].object({
AttributeDefinitions: _tableCommon.AttributeDefinitionsSchema.optional(),
GlobalSecondaryIndexUpdates: _joi["default"].array().items(_joi["default"].object({
Create: _joi["default"].object({
IndexName: _joi["default"].string().required(),
Projection: _tableCommon.ProjectionSchema,
KeySchema: _tableCommon.KeySchemaSchema,
ProvisionedThroughput: _tableCommon.ProvisionedThroughputSchema
}),
Delete: _joi["default"].object({
IndexName: _joi["default"].string().required()
})
}))
});
// https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_UpdateTimeToLive.html
var updateTimeToLive = exports.updateTimeToLive = _joi["default"].object({
TimeToLiveSpecification: _joi["default"].object({
Enabled: _joi["default"]["boolean"]().required(),
AttributeName: _joi["default"].when("Enabled", {
is: true,
then: _joi["default"].required(),
otherwise: _joi["default"].required().allow("")
})
}).required()
});