dao

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2015 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllHostDataByName

func AllHostDataByName(store resourcedmaster_storage.Storer, id string, hostname string) (map[string]interface{}, error)

AllHostDataByName returns a slice of all JSON data with application id + hostname as key.

func CommonDeleteById

func CommonDeleteById(store resourcedmaster_storage.Storer, daoType string, id string) error

CommonDeleteById deletes dao data with Id as key.

func CommonSaveById

func CommonSaveById(store resourcedmaster_storage.Storer, daoType string, id string, data []byte) error

CommonSaveById saves dao data in JSON format with Id as key.

func DeleteApplicationByAccessToken

func DeleteApplicationByAccessToken(store resourcedmaster_storage.Storer, accessToken string) error

DeleteApplicationByAccessToken returns error.

func DeleteHostByAppId

func DeleteHostByAppId(store resourcedmaster_storage.Storer, id string, hostname string) error

DeleteHostByAppId delete host data in JSON format with app id and hostname as keys.

func DeleteHostDataByNameJson

func DeleteHostDataByNameJson(store resourcedmaster_storage.Storer, id string, host, path string) error

DeleteHostDataByNameJson deletes reader data in JSON format with application id + host + path as key.

func DeleteUserByName

func DeleteUserByName(store resourcedmaster_storage.Storer, name string) error

DeleteUserByName deletes user with name as key.

func GetHostDataByNameJson

func GetHostDataByNameJson(store resourcedmaster_storage.Storer, id string, host, path string) ([]byte, error)

GetHostDataByNameJson returns reader data in JSON format with application id + host + path as key.

func SaveApplicationByAccessToken

func SaveApplicationByAccessToken(store resourcedmaster_storage.Storer, accessToken string, data []byte) error

SaveApplicationByAccessToken saves application data in JSON format with accessToken as key.

func SaveHostByAppIdJson

func SaveHostByAppIdJson(store resourcedmaster_storage.Storer, id string, hostname string, data []byte) error

SaveHostByAppIdJson saves host data in JSON format with app id and hostname as keys.

func SaveHostDataByNameJson

func SaveHostDataByNameJson(store resourcedmaster_storage.Storer, id string, host, path string, data []byte) error

SaveHostDataByNameJson saves reader data in JSON format with application id + host + path as key.

Types

type Application

type Application struct {
	Id      string
	Name    string
	Enabled bool
	// contains filtered or unexported fields
}

func AllApplications

func AllApplications(store resourcedmaster_storage.Storer) ([]*Application, error)

AllApplications returns a slice of all Application structs.

func GetApplicationByAccessToken

func GetApplicationByAccessToken(store resourcedmaster_storage.Storer, accessToken string) (*Application, error)

GetApplicationByAccessToken returns Application struct with name as key.

func GetApplicationById

func GetApplicationById(store resourcedmaster_storage.Storer, id string) (*Application, error)

GetApplicationById returns Application struct with name as key.

func NewApplication

func NewApplication(store resourcedmaster_storage.Storer, name string) (*Application, error)

NewApplication is constructor for Application struct.

func (*Application) Delete

func (a *Application) Delete() error

func (*Application) Save

func (a *Application) Save() error

Save application in JSON format.

type Host

type Host struct {
	ApplicationId     string
	Name              string
	Tags              []string
	NetworkInterfaces map[string]map[string]interface{}

	// Data is filled in during Get() and not during Save().
	Data map[string]interface{}
	// contains filtered or unexported fields
}

func AllHosts

func AllHosts(store resourcedmaster_storage.Storer, id string) ([]*Host, error)

AllHosts returns a slice of all Host structs.

func GetHostByAppId

func GetHostByAppId(store resourcedmaster_storage.Storer, id string, hostname string) (*Host, error)

GetHostByAppId returns Host struct with app id and hostname as keys.

func NewHost

func NewHost(store resourcedmaster_storage.Storer, name string, appId string) *Host

func (*Host) Delete

func (h *Host) Delete() error

func (*Host) DeleteDataJson

func (h *Host) DeleteDataJson(path string) error

func (*Host) GetDataJson

func (h *Host) GetDataJson(path string) ([]byte, error)

func (*Host) Save

func (h *Host) Save() error

Save host in JSON format.

func (*Host) SaveDataJson

func (h *Host) SaveDataJson(path string, data []byte) error

type User

type User struct {
	Id             string
	ApplicationId  string
	Name           string
	HashedPassword string
	Level          string
	Type           string
	Token          string
	Enabled        bool
	// contains filtered or unexported fields
}

func AllUsers

func AllUsers(store resourcedmaster_storage.Storer) ([]*User, error)

AllUsers returns a slice of all User structs.

func GetUserByName

func GetUserByName(store resourcedmaster_storage.Storer, name string) (*User, error)

GetUserByName returns User struct with name as key.

func Login

func Login(store resourcedmaster_storage.Storer, name, password string) (*User, error)

Login returns User struct after validating password.

func NewAccessTokenUser

func NewAccessTokenUser(store resourcedmaster_storage.Storer, app *Application) (*User, error)

NewAccessTokenUser returns struct User with basic level permission.

func NewUser

func NewUser(store resourcedmaster_storage.Storer, name, password string) (*User, error)

NewUser returns struct User with basic level permission.

func NewUserGivenJson

func NewUserGivenJson(store resourcedmaster_storage.Storer, jsonBody io.ReadCloser) (*User, error)

NewUserGivenJson returns struct User.

func UpdateUserByNameGivenJson

func UpdateUserByNameGivenJson(store resourcedmaster_storage.Storer, name string, allowLevelUpdate bool, jsonBody io.ReadCloser) (*User, error)

UpdateUserByNameGivenJson returns struct User.

func UpdateUserTokenByName

func UpdateUserTokenByName(store resourcedmaster_storage.Storer, name string) (*User, error)

UpdateUserTokenByName returns struct User.

func (*User) Delete

func (u *User) Delete() error

Delete user

func (*User) Save

func (u *User) Save() error

Save user in JSON format.

Jump to

Keyboard shortcuts

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