1.6.0 • Published 4 years ago

dm-driver-cognito v1.6.0

Weekly downloads
31
License
MIT
Repository
github
Last release
4 years ago

Welcome to dm-driver-cognito 👋

Build Status NPM Package Maintainability Documentation Downloads/week lerna

A Data Migration driver to query/modify a cognito user pool.

Configuration

Parameters

The DynamoDB driver accepts the following parameters as part of its configuration:

NameTypeRequiredDescription
regionstringYesThe AWS Region where this user pool exists
userPoolstringYesID of the user pool to connect to
profilestringNoName of the AWS profile to use

Example

The following configuration creates a Cognito driver that connects to a user pool in the us-east-1 stack some-stack-name.

module.exports = {
  defaultStage: "prod",
  migrationDirectory: "migrations",
  stages: {
    prod: {
      defaultParams: {
        region: "us-east-1",
      },
      drivers: {
        users: {
          driver: require("dm-driver-cognito"),
          params: {
            userPoolDriver: {
              // Use this processor to get values from CloudFormation
              processor: require("dm-processor-cf"),
              params: {
                stack: "some-stack-name",
                output: "SomeOutputName",
              },
            },
          },
        },
      },
    },
  },
};

Methods

addUser

Creates a new user in the user pool

Arguments

NameDescription
usernameUsername to be added.
passwordA temporary password
attributesAny other parameters that would normally be provided in AdminCreateUserRequest

Example

This example creates a new user for "Bill Lumbergh"

async up(context: ScriptContext, log: Logger) {
  const userPool = await context.getDriver<UserPoolDriver>("userPoolDriver");
  await userPool.addUser("blumbergh", "password", { UserAttributes: [
    Name: "email",
    Value: "blumbergh@initech.com"
  ]});
}

getUser

Queries for a user based on their username

Arguments

NameDescription
usernameThe username to look for

Example

Look for the previously created user blumberg

async up(context: ScriptContext, log: Logger) {
  const userPool = await context.getDriver<UserPoolDriver>("userPoolDriver");
  const user = await userPool.getUser("blumbergh");
}

deleteUser

Removes the given username from the user pool

Arguments

NameDescription
usernameThe username to delete

Example

Delete the previously created user blumberg

async up(context: ScriptContext, log: Logger) {
  const userPool = await context.getDriver<UserPoolDriver>("userPoolDriver");
  const user = await userPool.deleteUser("blumbergh");
}
1.6.0

4 years ago

1.5.12

4 years ago

1.5.13

4 years ago

1.5.11

4 years ago

1.5.10

4 years ago

1.5.9

4 years ago

1.5.8

4 years ago

1.5.7

4 years ago

1.5.6

4 years ago

1.5.5

4 years ago

1.5.4

4 years ago

1.5.3

4 years ago

1.5.2

4 years ago

1.5.1

4 years ago

1.5.0

4 years ago

1.4.3

4 years ago

1.4.2

4 years ago

1.4.1

4 years ago

1.3.15

4 years ago

1.3.14

4 years ago

1.3.13

4 years ago

1.3.12

4 years ago

1.3.11

4 years ago

1.3.10

4 years ago

1.3.9

4 years ago

1.3.7

4 years ago

1.3.6

4 years ago

1.3.8

4 years ago

1.3.5

4 years ago

1.3.4

4 years ago

1.3.3

4 years ago

1.3.2

4 years ago

1.3.1

4 years ago

1.2.8

4 years ago

1.2.7

4 years ago

1.2.6

4 years ago

1.2.5

4 years ago

1.2.4

4 years ago

1.2.3

4 years ago

1.2.2

4 years ago

1.2.1

4 years ago

1.2.0

4 years ago

1.1.1

4 years ago

1.1.7

4 years ago

1.1.6

4 years ago

1.1.5

4 years ago

1.1.4

4 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.1.0

4 years ago

1.0.18

4 years ago