dynamodbclient

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2019 License: GPL-2.0-or-later Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrObjectNotFound    = errors.New("Object not found")
	ErrUpdateConflict    = errors.New("Unable to update object due to conflict")
	ErrAlreadyExists     = errors.New("Unable to create. Object already exists")
	ErrInvalidObjectType = errors.New("Unsupported object type")
)

Functions

This section is empty.

Types

type DynamoDBStore

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

func NewDynamoDBStore

func NewDynamoDBStore(db *dynamodb.DynamoDB, tableMap DynamoDBTableLookup) *DynamoDBStore

NewDynamoDBStore creates a DynamoDBStore

func (*DynamoDBStore) IPReservation

func (db *DynamoDBStore) IPReservation() *IPReservationStore

func (*DynamoDBStore) InitializeTables

func (db *DynamoDBStore) InitializeTables() error

func (*DynamoDBStore) InventoryNode

func (db *DynamoDBStore) InventoryNode() *InventoryNodeStore

func (*DynamoDBStore) Network

func (db *DynamoDBStore) Network() *NetworkStore

func (*DynamoDBStore) Node

func (db *DynamoDBStore) Node() *NodeStore

func (*DynamoDBStore) System

func (db *DynamoDBStore) System() *SystemStore

type DynamoDBStoreTable

type DynamoDBStoreTable interface {
	GetName() string
	GetCreateTableInput() *dynamodb.CreateTableInput
	GetKeySchema() []*dynamodb.KeySchemaElement
	GetPartitionKeyName() string
	GetKeyAttributeDefinitions() []*dynamodb.AttributeDefinition
	GetKeyFrom(interface{}) (map[string]*dynamodb.AttributeValue, error)
	GetItemQueryInputFrom(interface{}) (*dynamodb.QueryInput, error)
}

DynamoDBStoreTable defines an interface for describing a dynamodb table

type DynamoDBStoreTableMap

type DynamoDBStoreTableMap map[reflect.Type]DynamoDBStoreTable

DynamoDBStoreTableMap maps data types to the appropriate table within DynamoDB

func (DynamoDBStoreTableMap) LookupTable

func (m DynamoDBStoreTableMap) LookupTable(t interface{}) DynamoDBStoreTable

LookupTable finds the table name associated with the type of the interface.

func (DynamoDBStoreTableMap) Tables

type DynamoDBTableLookup

type DynamoDBTableLookup interface {
	LookupTable(interface{}) DynamoDBStoreTable
	Tables() []DynamoDBStoreTable
}

type IPReservationStore

type IPReservationStore struct {
	*DynamoDBStore
}

func (*IPReservationStore) CreateIPReservation

func (db *IPReservationStore) CreateIPReservation(r *types.IPReservation) error

func (*IPReservationStore) CreateOrUpdateIPReservation

func (db *IPReservationStore) CreateOrUpdateIPReservation(r *types.IPReservation) error

func (*IPReservationStore) CreateRandomIPReservation

func (db *IPReservationStore) CreateRandomIPReservation(r *types.IPReservation, subnet *types.Subnet) (*types.IPReservation, error)

func (*IPReservationStore) Delete

func (*IPReservationStore) Exists

func (db *IPReservationStore) Exists(r *types.IPReservation) (bool, error)

func (*IPReservationStore) GetAllIPReservations

func (db *IPReservationStore) GetAllIPReservations() (types.IPReservationList, error)

func (*IPReservationStore) GetExistingIPReservationInSubnet

func (db *IPReservationStore) GetExistingIPReservationInSubnet(subnetCidr *net.IPNet, mac net.HardwareAddr) (*types.IPReservation, error)

func (*IPReservationStore) GetIPReservation

func (db *IPReservationStore) GetIPReservation(ipNet *net.IPNet) (*types.IPReservation, error)

func (*IPReservationStore) GetIPReservations

func (db *IPReservationStore) GetIPReservations(ipNet *net.IPNet) (types.IPReservationList, error)

GetIPReservations returns all current reservations in the specified subnet

func (*IPReservationStore) GetIPReservationsByMac

func (db *IPReservationStore) GetIPReservationsByMac(mac net.HardwareAddr) (types.IPReservationList, error)

func (*IPReservationStore) ObjCreate

func (db *IPReservationStore) ObjCreate(obj interface{}) error

func (*IPReservationStore) ObjDelete

func (db *IPReservationStore) ObjDelete(obj interface{}) error

func (*IPReservationStore) ObjExists

func (db *IPReservationStore) ObjExists(obj interface{}) (bool, error)

func (*IPReservationStore) ObjUpdate

func (db *IPReservationStore) ObjUpdate(obj interface{}) error

func (*IPReservationStore) UpdateIPReservation

func (db *IPReservationStore) UpdateIPReservation(r *types.IPReservation) error

type IPReservationTable

type IPReservationTable struct {
	Name string
}

func (*IPReservationTable) Create

func (t *IPReservationTable) Create(db *DynamoDBStore, obj interface{}) error

func (*IPReservationTable) GetCreateTableInput

func (t *IPReservationTable) GetCreateTableInput() *dynamodb.CreateTableInput

func (*IPReservationTable) GetItemQueryInputFrom

func (t *IPReservationTable) GetItemQueryInputFrom(o interface{}) (*dynamodb.QueryInput, error)

func (*IPReservationTable) GetKeyAttributeDefinitions

func (t *IPReservationTable) GetKeyAttributeDefinitions() []*dynamodb.AttributeDefinition

func (*IPReservationTable) GetKeyFrom

func (t *IPReservationTable) GetKeyFrom(o interface{}) (map[string]*dynamodb.AttributeValue, error)

func (*IPReservationTable) GetKeySchema

func (t *IPReservationTable) GetKeySchema() []*dynamodb.KeySchemaElement

func (*IPReservationTable) GetName

func (t *IPReservationTable) GetName() string

func (*IPReservationTable) GetPartitionKeyName

func (t *IPReservationTable) GetPartitionKeyName() string

func (*IPReservationTable) Update

func (t *IPReservationTable) Update(db *DynamoDBStore, obj interface{}) error

type InventoryNodeStore

type InventoryNodeStore struct {
	*DynamoDBStore
}

func (*InventoryNodeStore) GetInventoryNodeByID

func (db *InventoryNodeStore) GetInventoryNodeByID(id string) (*types.InventoryNode, error)

func (*InventoryNodeStore) GetInventoryNodeByMAC

func (db *InventoryNodeStore) GetInventoryNodeByMAC(mac net.HardwareAddr) (*types.InventoryNode, error)

func (*InventoryNodeStore) GetInventoryNodes

func (db *InventoryNodeStore) GetInventoryNodes() (map[string]*types.InventoryNode, error)

type NetworkStore

type NetworkStore struct {
	*DynamoDBStore
}

func (*NetworkStore) Create

func (db *NetworkStore) Create(network *types.Network) error

func (*NetworkStore) Delete

func (db *NetworkStore) Delete(network *types.Network) error

func (*NetworkStore) Exists

func (db *NetworkStore) Exists(network *types.Network) (bool, error)

func (*NetworkStore) GetNetworkByID

func (db *NetworkStore) GetNetworkByID(id string) (*types.Network, error)

func (*NetworkStore) GetNetworks

func (db *NetworkStore) GetNetworks() (map[string]*types.Network, error)

func (*NetworkStore) ObjCreate

func (db *NetworkStore) ObjCreate(obj interface{}) error

func (*NetworkStore) ObjDelete

func (db *NetworkStore) ObjDelete(obj interface{}) error

func (*NetworkStore) ObjExists

func (db *NetworkStore) ObjExists(obj interface{}) (bool, error)

func (*NetworkStore) ObjUpdate

func (db *NetworkStore) ObjUpdate(obj interface{}) error

func (*NetworkStore) Update

func (db *NetworkStore) Update(network *types.Network) error

type NodeMacIndexEntry

type NodeMacIndexEntry struct {
	Mac         net.HardwareAddr
	LastUpdated time.Time
	NodeID      string
}

func (*NodeMacIndexEntry) ID

func (i *NodeMacIndexEntry) ID() string

func (*NodeMacIndexEntry) SetTimestamp

func (i *NodeMacIndexEntry) SetTimestamp(timestamp time.Time)

func (*NodeMacIndexEntry) Timestamp

func (i *NodeMacIndexEntry) Timestamp() int64

type NodeStore

type NodeStore struct {
	*DynamoDBStore
}

func (*NodeStore) Create

func (db *NodeStore) Create(newNode *types.Node) error

func (*NodeStore) Delete

func (db *NodeStore) Delete(node *types.Node) error

func (*NodeStore) Exists

func (db *NodeStore) Exists(node *types.Node) (bool, error)

func (*NodeStore) GetNodeByID

func (db *NodeStore) GetNodeByID(id string) (*types.Node, error)

func (*NodeStore) GetNodeByMAC

func (db *NodeStore) GetNodeByMAC(mac net.HardwareAddr) (*types.Node, error)

func (*NodeStore) GetNodes

func (db *NodeStore) GetNodes() (map[string]*types.Node, error)

func (*NodeStore) ObjCreate

func (db *NodeStore) ObjCreate(obj interface{}) error

func (*NodeStore) ObjDelete

func (db *NodeStore) ObjDelete(obj interface{}) error

func (*NodeStore) ObjExists

func (db *NodeStore) ObjExists(obj interface{}) (bool, error)

func (*NodeStore) ObjUpdate

func (db *NodeStore) ObjUpdate(obj interface{}) error

func (*NodeStore) Update

func (db *NodeStore) Update(updatedNode *types.Node) error

type SimpleDynamoDBInventoryTable

type SimpleDynamoDBInventoryTable struct {
	Name string
}

func (*SimpleDynamoDBInventoryTable) GetCreateTableInput

func (t *SimpleDynamoDBInventoryTable) GetCreateTableInput() *dynamodb.CreateTableInput

func (*SimpleDynamoDBInventoryTable) GetItemQueryInputFrom

func (t *SimpleDynamoDBInventoryTable) GetItemQueryInputFrom(o interface{}) (*dynamodb.QueryInput, error)

func (*SimpleDynamoDBInventoryTable) GetKeyAttributeDefinitions

func (t *SimpleDynamoDBInventoryTable) GetKeyAttributeDefinitions() []*dynamodb.AttributeDefinition

func (*SimpleDynamoDBInventoryTable) GetKeyFrom

func (t *SimpleDynamoDBInventoryTable) GetKeyFrom(o interface{}) (map[string]*dynamodb.AttributeValue, error)

func (*SimpleDynamoDBInventoryTable) GetKeySchema

func (*SimpleDynamoDBInventoryTable) GetName

func (t *SimpleDynamoDBInventoryTable) GetName() string

func (*SimpleDynamoDBInventoryTable) GetPartitionKeyName

func (t *SimpleDynamoDBInventoryTable) GetPartitionKeyName() string

type SimpleTableItem

type SimpleTableItem interface {
	ID() string
}

type SystemStore

type SystemStore struct {
	*DynamoDBStore
}

func (*SystemStore) Create

func (db *SystemStore) Create(system *types.System) error

func (*SystemStore) Delete

func (db *SystemStore) Delete(system *types.System) error

func (*SystemStore) Exists

func (db *SystemStore) Exists(system *types.System) (bool, error)

func (*SystemStore) GetSystemByID

func (db *SystemStore) GetSystemByID(id string) (*types.System, error)

func (*SystemStore) GetSystems

func (db *SystemStore) GetSystems() (map[string]*types.System, error)

func (*SystemStore) ObjCreate

func (db *SystemStore) ObjCreate(obj interface{}) error

func (*SystemStore) ObjDelete

func (db *SystemStore) ObjDelete(obj interface{}) error

func (*SystemStore) ObjExists

func (db *SystemStore) ObjExists(obj interface{}) (bool, error)

func (*SystemStore) ObjUpdate

func (db *SystemStore) ObjUpdate(obj interface{}) error

func (*SystemStore) Update

func (db *SystemStore) Update(system *types.System) error

Jump to

Keyboard shortcuts

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