storage

package module
v0.0.0-...-8df540d Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2023 License: MIT Imports: 19 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	//Constants for DDB table
	DDBRecordPK                         = "pk"
	DDBRecordSK                         = "sk"
	DDBRecordNameKey                    = "name"
	DDBRecordEmailKey                   = "email"
	DDBRecordUUIDKey                    = "uuid"
	DDBRecordCreatedKey                 = "created"
	DDBRecordTypeKey                    = "type"
	DDBRecordPosixIdKey                 = "posix_id"
	DDBRecordUserPrimaryGroupKey        = "user_primary_group"
	DDBRecordPublicKeyKey               = "public_key"
	DDBRecordValidKey                   = "valid"
	DDBRecordSecondaryGroupKey          = "secondary_group"
	DDBRecordUserPrimaryGroupPosixIdKey = "user_primary_group_posix_id"
	DDBRecordUserPasswordHashKey        = "passwd_hash"
	DDBRecordUserSudoClaimsKey          = "sudo_claims"
	DDBRecordCertificateKey             = "certificate"

	DDBUserRecordPKPrefix               = "user#"
	DDBUserRecordSKPrefix               = "user#"
	DDBUserCertificateRecordPKPrefix    = "user#"
	DDBUserCertificateRecordSKPrefix    = "cert#expiry#"
	DDBUserSecondaryGroupRecordPKPrefix = "user#"
	DDBUserSecondaryGroupRecordSKPrefix = "sg#"
	DDBGroupRecordPKPrefix              = "group#posix#"
	DDBGroupRecordSKPrefix              = "group#posix#"

	// GSI Indexes constants
	DDBGsiUUIDPK           = DDBRecordUUIDKey
	DDBGsiPosixIDPK        = DDBRecordPosixIdKey
	DDBGsiPosixIDSK        = DDBRecordTypeKey
	DDBGsiSecondaryGroupPK = DDBRecordSecondaryGroupKey
	DDBGsiSecondaryGroupSK = DDBRecordPK
	DDBGsiNamePK           = DDBRecordNameKey
	DDBGsiNameSK           = DDBRecordTypeKey
	DDBGsiEmailPK          = DDBRecordEmailKey
	DDBGsiTypePK           = DDBRecordTypeKey
	DDBGsiTypeSK           = DDBRecordPK

	DDBRecordTypeUserEnum     = "user"
	DDBRecordTypeGroupEnum    = "group"
	DDBRecordTypeUserCertEnum = "user_cert"

	DDBUserRecordValidFalseEnum = "False"

	DDBISO8601DateTimeFormat = "2006-01-02T15:04:05.000Z"
)

Functions

func DefaultDynamoDBStoreCreateGroup

func DefaultDynamoDBStoreCreateGroup(group group.Group, store *DefaultDynamoDBStore) error

func DefaultDynamoDBStoreCreateUser

func DefaultDynamoDBStoreCreateUser(usr user.User, store *DefaultDynamoDBStore) error

func DefaultDynamoDBStoreDeleteGroup

func DefaultDynamoDBStoreDeleteGroup(group group.Group, store *DefaultDynamoDBStore) error

func DefaultDynamoDBStoreDeleteUser

func DefaultDynamoDBStoreDeleteUser(user user.User, store *DefaultDynamoDBStore) error

func DefaultDynamoDBStoreGetGroup

func DefaultDynamoDBStoreGetGroup(filter GroupFilter, store *DefaultDynamoDBStore) (group.Group, error)

func DefaultDynamoDBStoreGetUser

func DefaultDynamoDBStoreGetUser(filter UserFilter, store *DefaultDynamoDBStore) (user.User, error)

func DefaultDynamoDBStorePutSSHCertForUser

func DefaultDynamoDBStorePutSSHCertForUser(cert *ssh.Certificate, user user.User, store *DefaultDynamoDBStore) error

func DefaultDynamoDBStoreUpdateGroup

func DefaultDynamoDBStoreUpdateGroup(group group.Group, store *DefaultDynamoDBStore) error

func DefaultDynamoDBStoreUpdateUser

func DefaultDynamoDBStoreUpdateUser(usr user.User, store *DefaultDynamoDBStore) error

Types

type DDBQueryOrder

type DDBQueryOrder int
const (
	DDBQueryOrderForward DDBQueryOrder = iota + 1
	DDBQueryOrderReverse
)

func (DDBQueryOrder) EnumIndex

func (d DDBQueryOrder) EnumIndex() int

func (DDBQueryOrder) String

func (w DDBQueryOrder) String() string

type DefaultDynamoDBStore

type DefaultDynamoDBStore struct {
	DDBClient                  dynamodbiface.DynamoDBAPI
	TableName                  *string
	GSIPosixIDIndexName        *string
	GSIUUIDIndexName           *string
	GSISecondaryGroupIndexName *string
	GSINameIndexName           *string
	GSIEmailIndexName          *string
	GSITypeIndexName           *string
}

func (*DefaultDynamoDBStore) CreateGroup

func (c *DefaultDynamoDBStore) CreateGroup(group group.Group) error

func (*DefaultDynamoDBStore) CreateUser

func (c *DefaultDynamoDBStore) CreateUser(user user.User) error

func (*DefaultDynamoDBStore) DeleteGroup

func (c *DefaultDynamoDBStore) DeleteGroup(group group.Group) error

func (*DefaultDynamoDBStore) DeleteUser

func (c *DefaultDynamoDBStore) DeleteUser(user user.User) error

func (*DefaultDynamoDBStore) GetGroup

func (c *DefaultDynamoDBStore) GetGroup(filter GroupFilter) (group.Group, error)

func (*DefaultDynamoDBStore) GetSSHCertsForUser

func (c *DefaultDynamoDBStore) GetSSHCertsForUser(filter SSHCertSearchFilter) (SSHCertSearchResp, error)

func (*DefaultDynamoDBStore) GetUser

func (c *DefaultDynamoDBStore) GetUser(filter UserFilter) (user.User, error)

func (*DefaultDynamoDBStore) PutSSHCertForUser

func (c *DefaultDynamoDBStore) PutSSHCertForUser(cert *ssh.Certificate, usr user.User) error

func (*DefaultDynamoDBStore) SearchGroups

func (c *DefaultDynamoDBStore) SearchGroups(filter GroupFilter) (GroupSearchResp, error)

func (*DefaultDynamoDBStore) SearchUsers

func (c *DefaultDynamoDBStore) SearchUsers(filter UserFilter) (UserSearchResp, error)

func (*DefaultDynamoDBStore) UpdateGroup

func (c *DefaultDynamoDBStore) UpdateGroup(group group.Group) error

func (*DefaultDynamoDBStore) UpdateUser

func (c *DefaultDynamoDBStore) UpdateUser(user user.User) error

type DefaultDynamoDBStoreCert

type DefaultDynamoDBStoreCert struct {
	CertUniqueIdentifier *string
	*ssh.Certificate
}

func (*DefaultDynamoDBStoreCert) GetSSHCert

func (c *DefaultDynamoDBStoreCert) GetSSHCert() *ssh.Certificate

type DefaultDynamoDBStoreGroup

type DefaultDynamoDBStoreGroup struct {
	GroupUniqueIdentifier *string `json:"uuid,omitempty"`
	*group.DefaultPosixGroup
}

func (*DefaultDynamoDBStoreGroup) GetGroup

func (c *DefaultDynamoDBStoreGroup) GetGroup() group.Group

func (DefaultDynamoDBStoreGroup) MarshalJSON

func (a DefaultDynamoDBStoreGroup) MarshalJSON() ([]byte, error)

func (*DefaultDynamoDBStoreGroup) UnmarshalJSON

func (c *DefaultDynamoDBStoreGroup) UnmarshalJSON(b []byte) error

type DefaultDynamoDBStoreUser

type DefaultDynamoDBStoreUser struct {
	UserUniqueIdentifier *string `json:"uuid,omitempty"`
	EmailAddress         *string `json:"email,omitempty"`
	*user.DefaultPosixUser
}

func (*DefaultDynamoDBStoreUser) GetUser

func (c *DefaultDynamoDBStoreUser) GetUser() user.User

func (DefaultDynamoDBStoreUser) MarshalJSON

func (a DefaultDynamoDBStoreUser) MarshalJSON() ([]byte, error)

func (*DefaultDynamoDBStoreUser) UnmarshalJSON

func (c *DefaultDynamoDBStoreUser) UnmarshalJSON(b []byte) error

type DefaultStoreGroupFilter

type DefaultStoreGroupFilter struct {
	GroupNameProjection             *string
	GroupIDProjection               *string
	GroupUniqueIdentifierProjection *string
}

type DefaultStoreGroupSearchFilter

type DefaultStoreGroupSearchFilter struct {
	GroupNameSearchProjection *string
	PageToken                 *string
	PageSize                  *int
	Order                     *DDBQueryOrder
}

type DefaultStoreGroupSearchResponse

type DefaultStoreGroupSearchResponse struct {
	Result            []*DefaultDynamoDBStoreGroup
	NextPageToken     *string
	PreviousPageToken *string
}

func (*DefaultStoreGroupSearchResponse) GetGroupSearchResults

func (c *DefaultStoreGroupSearchResponse) GetGroupSearchResults() []GroupSearchResult

type DefaultStoreSSHCertSearchFilter

type DefaultStoreSSHCertSearchFilter struct {
	UserFilter *DefaultStoreUserFilter
	PageToken  *string
	PageSize   *int
	Order      *DDBQueryOrder
}

type DefaultStoreSSHCertSearchResponse

type DefaultStoreSSHCertSearchResponse struct {
	Result            []*DefaultDynamoDBStoreCert
	NextPageToken     *string
	PreviousPageToken *string
}

func (*DefaultStoreSSHCertSearchResponse) GetCertSearchResults

func (c *DefaultStoreSSHCertSearchResponse) GetCertSearchResults() []SSHCertSearchResult

type DefaultStoreUserFilter

type DefaultStoreUserFilter struct {
	PricipalNameProjection         *string
	UserIDProjection               *string
	UserUniqueIdentifierProjection *string
	EmailAddrProjection            *string
}

type DefaultStoreUserSearchFilter

type DefaultStoreUserSearchFilter struct {
	UserNameSearchProjection *string
	PageToken                *string
	PageSize                 *int
	Order                    *DDBQueryOrder
}

type DefaultStoreUserSearchResponse

type DefaultStoreUserSearchResponse struct {
	Result            []*DefaultDynamoDBStoreUser
	NextPageToken     *string
	PreviousPageToken *string
}

func (*DefaultStoreUserSearchResponse) GetUserSearchResults

func (c *DefaultStoreUserSearchResponse) GetUserSearchResults() []UserSearchResult

type GetSSHCertsForUser

type GetSSHCertsForUser interface {
	GetSSHCertsForUser(filter SSHCertSearchFilter) (SSHCertSearchResp, error)
}

type GroupFilter

type GroupFilter interface {
}

type GroupSearchResp

type GroupSearchResp interface {
	GetGroupSearchResults() []GroupSearchResult
}

func DefaultDynamoDBStoreSearchGroups

func DefaultDynamoDBStoreSearchGroups(filter GroupFilter, store *DefaultDynamoDBStore) (GroupSearchResp, error)

type GroupSearchResult

type GroupSearchResult interface {
	GetGroup() group.Group
}

type Item

type Item struct {
	PK                      string   `dynamodbav:"pk"`
	SK                      string   `dynamodbav:"sk"`
	Name                    string   `dynamodbav:"name,omitempty"`
	Email                   string   `dynamodbav:"email,omitempty"`
	UUID                    string   `dynamodbav:"uuid,omitempty"`
	Created                 string   `dynamodbav:"created,omitempty"`
	Type                    string   `dynamodbav:"type,omitempty"`
	PosixId                 string   `dynamodbav:"posix_id,omitempty"`
	UserPrimaryGroup        string   `dynamodbav:"user_primary_group,omitempty"`
	PublicKey               string   `dynamodbav:"public_key,omitempty"`
	Valid                   string   `dynamodbav:"valid,omitempty"`
	SecondaryGroup          string   `dynamodbav:"secondary_group,omitempty"`
	UserPrimaryGroupPosixId string   `dynamodbav:"user_primary_group_posix_id,omitempty"`
	PasswordHash            string   `dynamodbav:"passwd_hash,omitempty"`
	SudoClaims              []string `dynamodbav:"sudo_claims,omitempty"`
	Certificate             string   `dynamodbav:"certificate,omitempty"`
}

type PutSSHCert

type PutSSHCert interface {
	PutSSHCertForUser(*ssh.Certificate, user.User) error
}

type SSHCertSearchFilter

type SSHCertSearchFilter interface {
}

type SSHCertSearchResp

type SSHCertSearchResp interface {
	GetCertSearchResults() []SSHCertSearchResult
}

func DefaultDynamoDBStoreGetSSHCertsForUser

func DefaultDynamoDBStoreGetSSHCertsForUser(filter SSHCertSearchFilter, store *DefaultDynamoDBStore) (SSHCertSearchResp, error)

type SSHCertSearchResult

type SSHCertSearchResult interface {
	GetSSHCert() *ssh.Certificate
}

type SSHCertStore

type SSHCertStore interface {
}

type SSHGroupStore

type SSHGroupStore interface {
	CreateGroup(group.Group) error
	GetGroup(GroupFilter) (group.Group, error)
	UpdateGroup(group.Group) error
	DeleteGroup(group.Group) error
}

type SSHUserStore

type SSHUserStore interface {
	CreateUser(user.User) error
	GetUser(UserFilter) (user.User, error)
	UpdateUser(user.User) error
	DeleteUser(user.User) error
}

type SearchGroups

type SearchGroups interface {
	SearchGroups(GroupFilter) (GroupSearchResp, error)
}

type SearchUsers

type SearchUsers interface {
	SearchUsers(UserFilter) (UserSearchResp, error)
}

type Store

type Store interface {
	SSHCertStore
	SSHUserStore
	SSHGroupStore
}

type UserFilter

type UserFilter interface {
}

type UserSearchResp

type UserSearchResp interface {
	GetUserSearchResults() []UserSearchResult
}

func DefaultDynamoDBStoreSearchUsers

func DefaultDynamoDBStoreSearchUsers(filter UserFilter, store *DefaultDynamoDBStore) (UserSearchResp, error)

type UserSearchResult

type UserSearchResult interface {
	GetUser() user.User
}

Jump to

Keyboard shortcuts

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