cognito

package
v1.16.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 10, 2021 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API interface {
	CreateUser(*models.InviteUserInput) (*models.User, error)
	DeleteUser(*string) error
	GetUser(*string) (*models.User, error)
	ListUsers(*models.ListUsersInput) ([]models.User, error)
	ResetUserPassword(*string) error
	UpdateUser(*models.UpdateUserInput) error
}

API defines the interface for the user gateway which can be used for mocking.

type MockUserGateway

type MockUserGateway struct {
	API
	mock.Mock
}

MockUserGateway is a mocked object that implements the API interface It describes an object that the apis rely on.

func (*MockUserGateway) CreateUser

func (m *MockUserGateway) CreateUser(input *models.InviteUserInput) (*models.User, error)

CreateUser mocks CreateUser for testing

func (*MockUserGateway) DeleteUser

func (m *MockUserGateway) DeleteUser(id *string) error

DeleteUser mocks DeleteUser for testing

func (*MockUserGateway) GetUser

func (m *MockUserGateway) GetUser(id *string) (*models.User, error)

GetUser mocks GetUser for testing

func (*MockUserGateway) ListUsers

func (m *MockUserGateway) ListUsers(input *models.ListUsersInput) ([]models.User, error)

ListUsers mocks ListUsers for testing

func (*MockUserGateway) ResetUserPassword

func (m *MockUserGateway) ResetUserPassword(id *string) error

ResetUserPassword mocks ResetUserPassword for testing

func (*MockUserGateway) UpdateUser

func (m *MockUserGateway) UpdateUser(input *models.UpdateUserInput) error

UpdateUser mocks UpdateUser for testing

type UsersGateway

type UsersGateway struct {
	// contains filtered or unexported fields
}

UsersGateway encapsulates a service to Cognito Client.

func New

func New(sess *session.Session, userPoolID string) *UsersGateway

New creates a new CognitoIdentityProvider client which talks to the given user pool.

func (*UsersGateway) CreateUser

func (g *UsersGateway) CreateUser(input *models.InviteUserInput) (*models.User, error)

CreateUser creates a new user with specified attributes and sends out an email invitation.

func (*UsersGateway) DeleteUser

func (g *UsersGateway) DeleteUser(id *string) error

func (*UsersGateway) GetUser

func (g *UsersGateway) GetUser(id *string) (*models.User, error)

func (*UsersGateway) ListUsers

func (g *UsersGateway) ListUsers(input *models.ListUsersInput) ([]models.User, error)

ListUsers calls cognito api to list users that belongs to a user pool

func (*UsersGateway) ResetUserPassword

func (g *UsersGateway) ResetUserPassword(id *string) error

ResetUserPassword calls cognito api to reset user password

func (*UsersGateway) UpdateUser

func (g *UsersGateway) UpdateUser(input *models.UpdateUserInput) error

UpdateUser calls cognito to update a user with the specified attributes.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL