adminapi

package
v0.0.0-...-182d01c Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2016 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package adminapi is the implementation of the CPM Administration REST API. There is a single CPM admin server running which serves the CPM user interface and initiates the various CPM actions that a CPM user would cause to happen.

Index

Constants

View Source
const CLUSTERADMIN_DB = "clusteradmin"
View Source
const CONTAINER_NOT_FOUND = "CONTAINER NOT FOUND"
View Source
const (
	STANDBY = "standby"
)

Variables

View Source
var CPMTEST_DB = "cpmtest"
View Source
var CPMTEST_USER = "cpmtest"

Functions

func AddContainerUser

func AddContainerUser(w rest.ResponseWriter, r *rest.Request)

AddContainerUser creates a new database user for a given container

func AddProject

func AddProject(w rest.ResponseWriter, r *rest.Request)

AddProject creates a new project definition

func AddRole

func AddRole(w rest.ResponseWriter, r *rest.Request)

AddRole create a new CPM role

func AddSchedule

func AddSchedule(w rest.ResponseWriter, r *rest.Request)

AddSchedule creates a new task schedule

func AddUser

func AddUser(w rest.ResponseWriter, r *rest.Request)

AddUser create a new CPM user

func AdminFailover

func AdminFailover(w rest.ResponseWriter, r *rest.Request)

AdminFailover causes a cluster failorver to be performed for a given cluster

func AdminStartNode

func AdminStartNode(w rest.ResponseWriter, r *rest.Request)

AdminStartNode starts a container

func AdminStartServerContainers

func AdminStartServerContainers(w rest.ResponseWriter, r *rest.Request)

AdminStartServerContainers starts all containers on a given server

func AdminStartpg

func AdminStartpg(w rest.ResponseWriter, r *rest.Request)

AdminStartpg starts the postgres database on a given container

func AdminStopNode

func AdminStopNode(w rest.ResponseWriter, r *rest.Request)

AdminStopNode stops a container

func AdminStopServerContainers

func AdminStopServerContainers(w rest.ResponseWriter, r *rest.Request)

AdminStopServerContainers stops all containers on a given server

func AdminStoppg

func AdminStoppg(w rest.ResponseWriter, r *rest.Request)

AdminStoppg stops a postgres database on a given container

func AutoCluster

func AutoCluster(w rest.ResponseWriter, r *rest.Request)

AutoCluster creates a new cluster

func BadgerGenerate

func BadgerGenerate(w rest.ResponseWriter, r *rest.Request)

BadgerGenerate runs pgbadger on a given container and generates the report

func ChangePassword

func ChangePassword(w rest.ResponseWriter, r *rest.Request)

ChangePassword change a user password

func ConfigureCluster

func ConfigureCluster(w rest.ResponseWriter, r *rest.Request)

TODO

func ContainerAccessRuleGetAll

func ContainerAccessRuleGetAll(w rest.ResponseWriter, r *rest.Request)

ContainerAccessRuleGetAll returns all the rules selected for a container

func ContainerAccessRuleUpdate

func ContainerAccessRuleUpdate(w rest.ResponseWriter, r *rest.Request)

ContainerAccessRuleUpdate updates the rules assigned to a container

func ContainerInfoBgwriter

func ContainerInfoBgwriter(w rest.ResponseWriter, r *rest.Request)

COntainerInfoBgwriter returns the bgwriter stats for a given container

func ContainerInfoStatdatabase

func ContainerInfoStatdatabase(w rest.ResponseWriter, r *rest.Request)

ContainerInfoStatdatabase returns the pg_stat_database values for a given container

func ContainerInfoStatrepl

func ContainerInfoStatrepl(w rest.ResponseWriter, r *rest.Request)

ContainerInfoStat returns the pg_stat_replication values for a given container

func ContainerLoadTest

func ContainerLoadTest(w rest.ResponseWriter, r *rest.Request)

ContainerLoadTest executes a load test on a given container and returns the results

func DeleteCluster

func DeleteCluster(w rest.ResponseWriter, r *rest.Request)

DeleteCluster deletes an existing cluster definition

func DeleteContainerAccessRule

func DeleteContainerAccessRule(dbConn *sql.DB, ID string) error

DeleteContainerAccessRule deletes an access rule for a container

func DeleteContainerUser

func DeleteContainerUser(w rest.ResponseWriter, r *rest.Request)

DeleteContainerUser deletes a database user on a given container

func DeleteNode

func DeleteNode(w rest.ResponseWriter, r *rest.Request)

TODO refactor this to share code with DeleteCluster!!!!!

func DeleteProject

func DeleteProject(w rest.ResponseWriter, r *rest.Request)

DeleteProject deletes a given project

func DeleteRole

func DeleteRole(w rest.ResponseWriter, r *rest.Request)

DeleteRole delete a CPM role

func DeleteRule

func DeleteRule(dbConn *sql.DB, ID string) error

DeleteRule deletes a rule in the database

func DeleteSchedule

func DeleteSchedule(w rest.ResponseWriter, r *rest.Request)

DeleteSchedule deletes an existing task schedule

func DeleteTaskStatus

func DeleteTaskStatus(w rest.ResponseWriter, r *rest.Request)

DeleteTaskStatus deletes a task status and any related backup files

func DeleteUser

func DeleteUser(w rest.ResponseWriter, r *rest.Request)

DeleteUser delete a CPM user

func EventJoinCluster

func EventJoinCluster(w rest.ResponseWriter, r *rest.Request)

TODO

func ExecuteNow

func ExecuteNow(w rest.ResponseWriter, r *rest.Request)

ExecuteNow executes a task schedule on demand allowing an immediate task execution

func GetAllClustersForProject

func GetAllClustersForProject(w rest.ResponseWriter, r *rest.Request)

GetAllClustersForProject returns a list of cluster definitions for a given project

func GetAllGeneralSettings

func GetAllGeneralSettings(w rest.ResponseWriter, r *rest.Request)

GetAllGeneralSettings return a list of general settings

func GetAllNodes

func GetAllNodes(w rest.ResponseWriter, r *rest.Request)

TODO

func GetAllNodesForCluster

func GetAllNodesForCluster(w rest.ResponseWriter, r *rest.Request)

GetAllNodesForCluster returns a list of nodes for a given cluster

func GetAllNodesForProject

func GetAllNodesForProject(w rest.ResponseWriter, r *rest.Request)

GetAllNodesForProject returns all node definitions for a given project

func GetAllNodesForServer

func GetAllNodesForServer(w rest.ResponseWriter, r *rest.Request)

GetAllNodesForServer returns a list of all nodes on a given server

func GetAllNodesNotInCluster

func GetAllNodesNotInCluster(w rest.ResponseWriter, r *rest.Request)

TODO

func GetAllProjects

func GetAllProjects(w rest.ResponseWriter, r *rest.Request)

GetAllProjects returns all the project definitions

func GetAllRoles

func GetAllRoles(w rest.ResponseWriter, r *rest.Request)

GetAllRoles return all CPM roles

func GetAllSchedules

func GetAllSchedules(w rest.ResponseWriter, r *rest.Request)

GetAllSchedules returns a list of task schedules for a given container

func GetAllServers

func GetAllServers(w rest.ResponseWriter, r *rest.Request)

GetAllServers return a list of servers

func GetAllSettings

func GetAllSettings(w rest.ResponseWriter, r *rest.Request)

GetAllSettings return all settings

func GetAllStatus

func GetAllStatus(w rest.ResponseWriter, r *rest.Request)

GetAllStatus returns the full set of status results for a given task schedule

func GetAllUsers

func GetAllUsers(w rest.ResponseWriter, r *rest.Request)

GetAllUsers return all CPM users

func GetAllUsersForContainer

func GetAllUsersForContainer(w rest.ResponseWriter, r *rest.Request)

GetAllusersForContainer returns a list of all database users on a given db container

func GetBackupNodes

func GetBackupNodes(w rest.ResponseWriter, r *rest.Request)

TODO

func GetCluster

func GetCluster(w rest.ResponseWriter, r *rest.Request)

GetCluster returns a given cluster definition

func GetContainerUser

func GetContainerUser(w rest.ResponseWriter, r *rest.Request)

GetContainerUser returns a database user for a given container

func GetHealthCheck

func GetHealthCheck(w rest.ResponseWriter, r *rest.Request)

GetHealthCheck returns the latest health check metrics that have been collected

func GetNode

func GetNode(w rest.ResponseWriter, r *rest.Request)

GetNode returns the container node definition

func GetProject

func GetProject(w rest.ResponseWriter, r *rest.Request)

GetProject returns a project definition

func GetProxyByContainerID

func GetProxyByContainerID(w rest.ResponseWriter, r *rest.Request)

GetProxyByContainerID returns a proxy node defintion for a given container

func GetRole

func GetRole(w rest.ResponseWriter, r *rest.Request)

GetRole return a role

func GetSchedule

func GetSchedule(w rest.ResponseWriter, r *rest.Request)

GetSchedule returns a task schedule

func GetServer

func GetServer(w rest.ResponseWriter, r *rest.Request)

GetServer return a server definition

func GetStatus

func GetStatus(w rest.ResponseWriter, r *rest.Request)

GetStatus returns the status of a given task schedule

func GetUser

func GetUser(w rest.ResponseWriter, r *rest.Request)

GetUser return a CPM user

func InsertContainerAccessRule

func InsertContainerAccessRule(dbConn *sql.DB, car ContainerAccessRule) error

InsertContainerAccessRule inserts a rule for a container

func InsertRule

func InsertRule(dbConn *sql.DB, rule Rule) error

InsertRule inserts a rule definition in the database

func Login

func Login(w rest.ResponseWriter, r *rest.Request)

Login perform a login using passed credentials and return a token if successful

func Logout

func Logout(w rest.ResponseWriter, r *rest.Request)

Logout perform a logout based on a given token

func MonitorContainerControldata

func MonitorContainerControldata(w rest.ResponseWriter, r *rest.Request)

MonitorContainerControldata returns the pg_control settings for a given container

func MonitorContainerSettings

func MonitorContainerSettings(w rest.ResponseWriter, r *rest.Request)

MonitorContainerSettings returns the pg_settings values for a given container

func MonitorServerGetInfo

func MonitorServerGetInfo(w rest.ResponseWriter, r *rest.Request)

MonitorServerGetInfo return server information for a given server

func MonitorStatements

func MonitorStatements(w rest.ResponseWriter, r *rest.Request)

MonitorStatements returns the pg_stat_statements values for a given container

func PostCluster

func PostCluster(w rest.ResponseWriter, r *rest.Request)

PostCluster updates or inserts a new cluster definition

func Provision

func Provision(w rest.ResponseWriter, r *rest.Request)

Provision creates a Docker container image

func ProvisionProxy

func ProvisionProxy(w rest.ResponseWriter, r *rest.Request)

ProvisionProxy creates a Docker image for a proxy node definition

func ProxyUpdate

func ProxyUpdate(w rest.ResponseWriter, r *rest.Request)

ProxyUpdate updates a proxy node definition

func RulesDelete

func RulesDelete(w rest.ResponseWriter, r *rest.Request)

RulesDelete deletes a given rule

func RulesGet

func RulesGet(w rest.ResponseWriter, r *rest.Request)

RulesGet returns a given access rule definition

func RulesGetAll

func RulesGetAll(w rest.ResponseWriter, r *rest.Request)

RulesGetAll returns all the access rule definitions

func RulesInsert

func RulesInsert(w rest.ResponseWriter, r *rest.Request)

RulesInsert creates a new rule

func RulesUpdate

func RulesUpdate(w rest.ResponseWriter, r *rest.Request)

RulesUpdate updates a given rule

func SaveSetting

func SaveSetting(w rest.ResponseWriter, r *rest.Request)

SaveSetting update an existing setting value

func ScaleUpCluster

func ScaleUpCluster(w rest.ResponseWriter, r *rest.Request)

ScaleUpCluster increases the count of standby containers in a cluster

func StartCluster

func StartCluster(w rest.ResponseWriter, r *rest.Request)

StartCluster starts all nodes in a cluster

func StopCluster

func StopCluster(w rest.ResponseWriter, r *rest.Request)

StopCluster stops all nodes in a cluster

func UpdateContainerUser

func UpdateContainerUser(w rest.ResponseWriter, r *rest.Request)

UpdateContainerUser updates a database users preferences on a given container db

func UpdateProject

func UpdateProject(w rest.ResponseWriter, r *rest.Request)

UpdateProject updates a project definition

func UpdateRole

func UpdateRole(w rest.ResponseWriter, r *rest.Request)

UpdateRole update a CPM role

func UpdateRule

func UpdateRule(dbConn *sql.DB, rule Rule) error

UpdateRule updates a rule definition in the database

func UpdateSchedule

func UpdateSchedule(w rest.ResponseWriter, r *rest.Request)

UpdateSchedule updates a given task schedule

func UpdateUser

func UpdateUser(w rest.ResponseWriter, r *rest.Request)

UpdateUser update a CPM user security settings

Types

type AddSchedulePost

type AddSchedulePost struct {
	ID                string
	Token             string
	Serverip          string
	ProfileName       string
	Name              string
	Enabled           string
	ContainerName     string
	Minutes           string
	Hours             string
	DayOfMonth        string
	Month             string
	DayOfWeek         string
	RestoreSet        string
	RestoreRemotePath string
	RestoreRemoteHost string
	RestoreRemoteUser string
	RestoreDbUser     string
	RestoreDbPass     string
}

type AutoClusterInfo

type AutoClusterInfo struct {
	Name           string
	ProjectID      string
	ClusterType    string
	ClusterProfile string
	Token          string
}

type BackupNowPost

type BackupNowPost struct {
	Token         string
	ServerID      string
	ProjectID     string
	ContainerName string
	ProfileName   string
	ScheduleID    string
	StatusID      string
}

type Bgwriter

type Bgwriter struct {
	Now            string
	AllocMbps      string
	CheckpointMbps string
	CleanMbps      string
	BackendMbps    string
	WriteMbps      string
}

type ChgPassword

type ChgPassword struct {
	Username string
	Password string
	Token    string
}

type Child

type Child struct {
	Name      string  `json:"name"`
	Type      string  `json:"type"`
	ID        string  `json:"id"`
	ProjectID string  `json:"projectid"`
	Children  []Child `json:"children"`
}

type Child2

type Child2 struct {
	Name      string `json:"name"`
	Type      string `json:"type"`
	ID        string `json:"id"`
	ProjectID string `json:"projectid"`
}

type ContainerAccessRule

type ContainerAccessRule struct {
	ID             string
	Token          string
	ContainerID    string
	AccessRuleID   string
	AccessRuleName string
	Selected       string
	CreateDate     string
}

func GetAllContainerAccessRule

func GetAllContainerAccessRule(dbConn *sql.DB, containerID string) ([]ContainerAccessRule, error)

GetAllContainerAccessRule returns all rules assigned to a container

func GetContainerAccessRule

func GetContainerAccessRule(dbConn *sql.DB, ID string) (ContainerAccessRule, error)

GetContainerAccessRule returns a rule assigned to a container

type DeleteStatusPost

type DeleteStatusPost struct {
	Token    string
	StatusID string
}

type Loadtestresults

type Loadtestresults struct {
	Operation string
	Count     int
	Results   string
}

type LoginToken

type LoginToken struct {
	Contents string
}

type Project2

type Project2 struct {
	Name     string  `json:"name"`
	Type     string  `json:"type"`
	ID       string  `json:"id"`
	Children []Child `json:"children"`
}

type ProxyRequest

type ProxyRequest struct {
	Token         string
	ID            string
	Profile       string
	Image         string
	ServerID      string
	ProjectID     string
	ContainerName string
	Standalone    string
	Host          string
	Usename       string
	Passwd        string
	Port          string
	Database      string
}

type Rule

type Rule struct {
	ID          string
	Token       string
	Name        string
	Type        string
	Database    string
	User        string
	Address     string
	Method      string
	Description string
	CreateDate  string
	UpdateDate  string
}

func GetAccessRule

func GetAccessRule(dbConn *sql.DB, ID string) (Rule, error)

GetAccessRule returns a rule from the database

func GetAllRules

func GetAllRules(dbConn *sql.DB) ([]Rule, error)

GetAllRules returns all rules from the database

type Statdatabase

type Statdatabase struct {
	Datname     string
	BlksRead    string
	TupReturned string
	TupFetched  string
	TupInserted string
	TupUpdated  string
	TupDeleted  string
	StatsReset  string
}

type Statrepl

type Statrepl struct {
	Pid            string
	Usesysid       string
	Usename        string
	AppName        string
	ClientAddr     string
	ClientHostname string
	ClientPort     string
	BackendStart   string
	State          string
	SentLocation   string
	WriteLocation  string
	FlushLocation  string
	ReplayLocation string
	SyncPriority   string
	SyncState      string
}

Jump to

Keyboard shortcuts

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