stores

package
v0.1.8-1 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var QAuthMethodsTypes = map[string]QAuthMethodInit{
	"api-key": NewQApiKeyAuthMethod,
	"headers": NewQHeadersAuthMethod,
}

Functions

This section is empty.

Types

type Mockstore

type Mockstore struct {
	Session      bool
	Server       string
	Database     string
	ServiceTypes []QServiceType
	Bindings     []QBinding
	AuthMethods  []QAuthMethod
}

func (*Mockstore) Clone

func (mock *Mockstore) Clone() Store

func (*Mockstore) Close

func (mock *Mockstore) Close()

func (*Mockstore) DeleteAuthMethod

func (mock *Mockstore) DeleteAuthMethod(am QAuthMethod) error

func (*Mockstore) DeleteAuthMethodByServiceUUID

func (mock *Mockstore) DeleteAuthMethodByServiceUUID(serviceUUID string) error

func (*Mockstore) DeleteBinding

func (mock *Mockstore) DeleteBinding(qBinding QBinding) error

DeleteBinding removes the given qBinding from the slice of bindings

func (*Mockstore) DeleteBindingByServiceUUID

func (mock *Mockstore) DeleteBindingByServiceUUID(serviceUUID string) error

func (*Mockstore) DeleteServiceTypeByUUID

func (mock *Mockstore) DeleteServiceTypeByUUID(uuid string) error

func (*Mockstore) InsertAuthMethod

func (mock *Mockstore) InsertAuthMethod(am QAuthMethod) error

func (*Mockstore) InsertBinding

func (mock *Mockstore) InsertBinding(name string, serviceUUID string, host string, uuid string, authID string, uniqueKey string, authType string) (QBinding, error)

func (*Mockstore) InsertServiceType

func (mock *Mockstore) InsertServiceType(name string, hosts []string, authTypes []string, authMethod string, uuid string, createdOn string, sType string) (QServiceType, error)

func (*Mockstore) QueryApiKeyAuthMethods

func (mock *Mockstore) QueryApiKeyAuthMethods(serviceUUID string, host string) ([]QApiKeyAuthMethod, error)

func (*Mockstore) QueryBindings

func (mock *Mockstore) QueryBindings(serviceUUID string, host string) ([]QBinding, error)

func (*Mockstore) QueryBindingsByAuthID

func (mock *Mockstore) QueryBindingsByAuthID(authID string, serviceUUID string, host string, authType string) ([]QBinding, error)

func (*Mockstore) QueryBindingsByUUIDAndName

func (mock *Mockstore) QueryBindingsByUUIDAndName(uuid, name string) ([]QBinding, error)

func (*Mockstore) QueryHeadersAuthMethods

func (mock *Mockstore) QueryHeadersAuthMethods(serviceUUID string, host string) ([]QHeadersAuthMethod, error)

func (*Mockstore) QueryServiceTypes

func (mock *Mockstore) QueryServiceTypes(name string) ([]QServiceType, error)

func (*Mockstore) QueryServiceTypesByUUID

func (mock *Mockstore) QueryServiceTypesByUUID(uuid string) ([]QServiceType, error)

func (*Mockstore) SetUp

func (mock *Mockstore) SetUp()

SetUp is used to initialize the mock store

func (*Mockstore) UpdateAuthMethod

func (mock *Mockstore) UpdateAuthMethod(original QAuthMethod, updated QAuthMethod) (QAuthMethod, error)

func (*Mockstore) UpdateBinding

func (mock *Mockstore) UpdateBinding(original QBinding, updated QBinding) (QBinding, error)

func (*Mockstore) UpdateServiceType

func (mock *Mockstore) UpdateServiceType(original QServiceType, updated QServiceType) (QServiceType, error)

type MongoStore

type MongoStore struct {
	Server   string
	Database string
	Session  *mgo.Session
}

func (*MongoStore) Clone

func (mongo *MongoStore) Clone() Store

func (*MongoStore) Close

func (mongo *MongoStore) Close()

func (*MongoStore) DeleteAuthMethod

func (mongo *MongoStore) DeleteAuthMethod(am QAuthMethod) error

func (*MongoStore) DeleteAuthMethodByServiceUUID

func (mongo *MongoStore) DeleteAuthMethodByServiceUUID(serviceUUID string) error

func (*MongoStore) DeleteBinding

func (mongo *MongoStore) DeleteBinding(qBinding QBinding) error

Delete binding deletes a binding from the store

func (*MongoStore) DeleteBindingByServiceUUID

func (mongo *MongoStore) DeleteBindingByServiceUUID(serviceUUID string) error

func (*MongoStore) DeleteServiceTypeByUUID

func (mongo *MongoStore) DeleteServiceTypeByUUID(uuid string) error

func (*MongoStore) InsertAuthMethod

func (mongo *MongoStore) InsertAuthMethod(am QAuthMethod) error

func (*MongoStore) InsertBinding

func (mongo *MongoStore) InsertBinding(name string, serviceUUID string, host string, uuid string, authID string, uniqueKey string, authType string) (QBinding, error)

InsertBinding inserts a new binding into the datastore

func (*MongoStore) InsertServiceType

func (mongo *MongoStore) InsertServiceType(name string, hosts []string, authTypes []string, authMethod string, uuid string, createdOn string, sType string) (QServiceType, error)

InsertServiceType inserts a new service into the datastore

func (*MongoStore) QueryApiKeyAuthMethods

func (mongo *MongoStore) QueryApiKeyAuthMethods(serviceUUID string, host string) ([]QApiKeyAuthMethod, error)

func (*MongoStore) QueryBindings

func (mongo *MongoStore) QueryBindings(serviceUUID string, host string) ([]QBinding, error)

func (*MongoStore) QueryBindingsByAuthID

func (mongo *MongoStore) QueryBindingsByAuthID(authID string, serviceUUID string, host string, authType string) ([]QBinding, error)

func (*MongoStore) QueryBindingsByUUIDAndName

func (mongo *MongoStore) QueryBindingsByUUIDAndName(uuid, name string) ([]QBinding, error)

func (*MongoStore) QueryHeadersAuthMethods

func (mongo *MongoStore) QueryHeadersAuthMethods(serviceUUID string, host string) ([]QHeadersAuthMethod, error)

func (*MongoStore) QueryServiceTypes

func (mongo *MongoStore) QueryServiceTypes(name string) ([]QServiceType, error)

func (*MongoStore) QueryServiceTypesByUUID

func (mongo *MongoStore) QueryServiceTypesByUUID(uuid string) ([]QServiceType, error)

func (*MongoStore) SetUp

func (mongo *MongoStore) SetUp()

Initialize initializes the mongo stores struct

func (*MongoStore) UpdateAuthMethod

func (mongo *MongoStore) UpdateAuthMethod(original QAuthMethod, updated QAuthMethod) (QAuthMethod, error)

UpdateAuthMethod updates the given auth method

func (*MongoStore) UpdateBinding

func (mongo *MongoStore) UpdateBinding(original QBinding, updated QBinding) (QBinding, error)

UpdateBinding updates the given binding

func (*MongoStore) UpdateServiceType

func (mongo *MongoStore) UpdateServiceType(original QServiceType, updated QServiceType) (QServiceType, error)

UpdateServiceType updates the given binding

type QApiKeyAuthMethod

type QApiKeyAuthMethod struct {
	QBasicAuthMethod `bson:",inline"`
	AccessKey        string `json:"access_key" bson:"access_key"`
}

type QAuthMethod

type QAuthMethod interface{}

func NewQApiKeyAuthMethod

func NewQApiKeyAuthMethod() QAuthMethod

func NewQHeadersAuthMethod

func NewQHeadersAuthMethod() QAuthMethod

type QAuthMethodFactory

type QAuthMethodFactory struct{}

func (*QAuthMethodFactory) Create

func (f *QAuthMethodFactory) Create(amType string) (QAuthMethod, error)

type QAuthMethodInit

type QAuthMethodInit func() QAuthMethod

type QBasicAuthMethod

type QBasicAuthMethod struct {
	ServiceUUID string `json:"service_uuid" bson:"service_uuid"`
	Port        int    `json:"port" bson:"port"`
	Host        string `json:"host" bson:"host"`
	Type        string `json:"type" bson:"type"`
	UUID        string `json:"uuid" bson:"uuid"`
	CreatedOn   string `json:"created_on" bson:"created_on"`
}

type QBinding

type QBinding struct {
	Name           string `json:"name" bson:"name"`
	ServiceUUID    string `json:"service_uuid" bson:"service_uuid"`
	Host           string `json:"host" bson:"host"`
	AuthIdentifier string `json:"auth_identifier" bson:"auth_identifier"`
	UUID           string `json:"uuid" bson:"uuid"`
	AuthType       string `json:"auth_type" bson:"auth_type"`
	UniqueKey      string `json:"unique_key,omitempty"`
	CreatedOn      string `json:"created_on,omitempty" bson:"created_on,omitempty"`
	LastAuth       string `json:"last_auth,omitempty" bson:"last_auth,omitempty"`
}

type QHeadersAuthMethod

type QHeadersAuthMethod struct {
	QBasicAuthMethod `bson:",inline"`
	Headers          map[string]string `json:"headers" bson:"headers"`
}

type QServiceType

type QServiceType struct {
	Name       string   `json:"name" bson:"name"`
	Hosts      []string `json:"hosts" bson:"hosts"`
	AuthTypes  []string `json:"auth_types" bson:"auth_types"`
	AuthMethod string   `json:"auth_method" bson:"auth_method"`
	UUID       string   `json:"uuid" bson:"uuid"`
	CreatedOn  string   `json:"created_on,omitempty" bson:"created_on,omitempty"`
	Type       string   `json:"type" bson:"type"`
}

type Store

type Store interface {
	SetUp()
	Close()
	Clone() Store
	QueryServiceTypes(name string) ([]QServiceType, error)
	QueryServiceTypesByUUID(uuid string) ([]QServiceType, error)
	QueryApiKeyAuthMethods(serviceUUID string, host string) ([]QApiKeyAuthMethod, error)
	QueryHeadersAuthMethods(serviceUUID string, host string) ([]QHeadersAuthMethod, error)
	QueryBindingsByAuthID(authID string, serviceUUID string, host string, authType string) ([]QBinding, error)
	QueryBindingsByUUIDAndName(uuid, name string) ([]QBinding, error)
	QueryBindings(serviceUUID string, host string) ([]QBinding, error)
	InsertServiceType(name string, hosts []string, authTypes []string, authMethod string, uuid string, createdOn string, sType string) (QServiceType, error)
	DeleteServiceTypeByUUID(uuid string) error
	InsertAuthMethod(am QAuthMethod) error
	DeleteAuthMethod(am QAuthMethod) error
	DeleteAuthMethodByServiceUUID(serviceUUID string) error
	InsertBinding(name string, serviceUUID string, host string, uuid string, authID string, uniqueKey string, authType string) (QBinding, error)
	UpdateBinding(original QBinding, updated QBinding) (QBinding, error)
	UpdateServiceType(original QServiceType, updated QServiceType) (QServiceType, error)
	UpdateAuthMethod(original QAuthMethod, updated QAuthMethod) (QAuthMethod, error)
	DeleteBinding(qBinding QBinding) error
	DeleteBindingByServiceUUID(serviceUUID string) error
}

Jump to

Keyboard shortcuts

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