storage

package
v0.0.0-...-77d1d51 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2017 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MongoSession *mgo.Session

Functions

func DBConnection

func DBConnection() *mgo.Database

func DocExists

func DocExists(id string, collName string) bool

Checks if the document exists with the given ID

func EnsureHostIndex

func EnsureHostIndex() error

Ensure index exits

func GetDnsByFqdn

func GetDnsByFqdn(fqdn string) (*[]DNSDoc, error)

Get the DNS by host fqdn

func GetHosts

func GetHosts(query string) (*[]NodeDoc, error)

Get the host document by id

func GetLbsByHostId

func GetLbsByHostId(id string) (*[]LBDoc, error)

Get the loadbalancer by host id

func InsertMany

func InsertMany(Docs []interface{}, collName string, wg *sync.WaitGroup)

Write many docs in to mongodb

Types

type DNSDoc

type DNSDoc struct {
	ID            string   `bson:"_id"`
	Name          string   `bson:"name"`
	Type          string   `bson:"type"`
	Records       []string `bson:"records"`
	CloudProvider string   `bson:"cloud_provider"`
}

Describes an DNS record

type LBDoc

type LBDoc struct {
	ID            string    `bson:"_id"`
	Name          string    `bson:"name"`
	LaunchTime    time.Time `bson:"launch_time"`
	DataCenter    []string  `bson:"data_center"`
	CloudProvider string    `bson:"cloud_provider"`
	Backends      []string  `bson:"backends"`
	PublicDns     string    `bson:"public_dns"`
}

Describes an load balancer

type NodeDoc

type NodeDoc struct {
	ID             string    `bson:"_id"`
	State          string    `bson:"state"`
	Virtualization string    `bson:"virtualization"`
	Architecture   string    `bson:"arch"`
	RootDevice     string    `bson:"root_device"`
	Type           string    `bson:"type"`
	DataCenter     string    `bson:"data_center"`
	SecurityGroup  []string  `bson:"security_group"`
	CloudProvider  string    `bson:"cloud_provider"`
	SshKeyName     string    `bson:"ssh_key_name"`
	Tags           []Tags    `bson:"tags"`
	IamProfile     string    `bson:"iam_profile,omitempty"`
	LaunchTime     time.Time `bson:"launch_time"`
	PublicDns      string    `bson:"public_dns"`
	PrivateDns     string    `bson:"private_dns"`
	PublicIp       string    `bson:"public_ip"`
	PrivateIp      string    `bson:"private_ip"`
}

Describes an machine

func GetHostByFqdn

func GetHostByFqdn(fqdn string) (*NodeDoc, error)

Get the host document by FQDN

func GetHostById

func GetHostById(id string) (*NodeDoc, error)

Get the host document by id

type Tags

type Tags struct {
	Key   string
	Value string
}

Describes an Tags

Jump to

Keyboard shortcuts

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