Documentation
¶
Index ¶
- func ActiveCMRegistry(id string)
- func CreateCMRegistryDb()
- func DeRegisterCMEntry(id string)
- func DeRegisterConnectionProfile(id string)
- func DeactiveAllCMRegistry()
- func DownloadFile(filepath string, url string) error
- func DownloadViaScp(sshConfig *easyssh.MakeConfig, source string, dest string, skipJump bool) error
- func DropCMRegistryRecords()
- func DropConnectionProfileRecords()
- func EvaluateBoolValueFromString(answer string) bool
- func FormatJson(b []byte) *bytes.Buffer
- func GetCMEntryId(id string) string
- func GetConnectionProfileEntryId(id string) string
- func GetHttpClient() *http.Client
- func GetPassword(flagValue string, text string) string
- func GetStringFlag(flagValue string, defaultValue string, text string) string
- func ProcessAsMap(request *http.Request) map[string]interface{}
- func ProcessAsMapFromBytes(bodyBytes []byte) map[string]interface{}
- func ProcessAsMapFromSSHResponse(sshResponse RemoteResponse) map[string]interface{}
- func ProcessRequest(request *http.Request) []byte
- func RegisterNewCMEntry(id string, hostname string, port int, protocol string, username string, ...)
- func RegisterNewConnectionProfile(id string, keyPath string, port int, username string)
- func RunLocalCommand(command string, arg ...string) (string, string, error)
- func SetProfileIdForCMEntry(cmEntryId string, profileId string)
- func UpdateCMEntry(id string, hostname string, port int, protocol string, username string, ...)
- func WriteCMServerEntries(cmServers []CMServer)
- func WriteConnectionProfileEntries(connectionProfiles []ConnectionProfile)
- type CMItems
- type CMServer
- func (c CMServer) CreateGatewayCurlGetCommand(uri string) string
- func (c CMServer) CreateGatewayCurlPostCommand(uri string) string
- func (c CMServer) CreateGetRequest(urlSuffix string) *http.Request
- func (c CMServer) CreatePostRequest(body bytes.Buffer, urlSuffix string) *http.Request
- func (c CMServer) CreatePutRequest(body bytes.Buffer, urlSuffix string) *http.Request
- func (c CMServer) ExecuteSaltCommand(command string, saltBinaryPathPrefix string, saltBinary string)
- func (c CMServer) ExportClusterTemplate(cluster string) []byte
- func (c CMServer) GetCMUri(uriSuffix string) string
- func (c CMServer) GetDeployment() Deployment
- func (c CMServer) GetFilteredHosts(filter Filter) map[string]bool
- func (c CMServer) GetUsers() []User
- func (c CMServer) ListClusters() []Cluster
- func (c CMServer) ListHosts() []Host
- func (c CMServer) ListServices(cluster string) []Service
- func (c CMServer) RunGatewayCMCommand(command string, printStdOut bool) RemoteResponse
- func (c CMServer) RunRemoteHostCommand(command string, filteredHosts map[string]bool, skipJump bool) map[string]RemoteResponse
- type Cluster
- type ConnectionProfile
- type Deployment
- type Filter
- type Host
- type Item
- type RemoteResponse
- type Role
- type Service
- type ServiceRolesMap
- type User
- type UserAuthRole
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ActiveCMRegistry ¶
func ActiveCMRegistry(id string)
ActiveCMRegistry turn on active status on selected CM registry
func DeRegisterCMEntry ¶
func DeRegisterCMEntry(id string)
DeRegisterCMEntry remove an CM server enrty by id
func DeRegisterConnectionProfile ¶
func DeRegisterConnectionProfile(id string)
DeRegisterConnectionProfile remove a connection profile by id
func DeactiveAllCMRegistry ¶
func DeactiveAllCMRegistry()
DeactiveAllCMRegistry turn off active status on all CM registries
func DownloadFile ¶
DownloadFile download a file from an url to the local filesystem
func DownloadViaScp ¶
DownloadViaScp downloads file from remote to local
func DropCMRegistryRecords ¶
func DropCMRegistryRecords()
DropCMRegistryRecords drop all CM server entries from cmctl database
func DropConnectionProfileRecords ¶
func DropConnectionProfileRecords()
DropConnectionProfileRecords drop all connection profile from cmctl database
func EvaluateBoolValueFromString ¶
EvaluateBoolValueFromString get a string boolean answer and evaluate as a boolean value
func GetCMEntryId ¶
GetCMEntryId get CM server entry id if the id exists
func GetConnectionProfileEntryId ¶
GetConnectionProfileEntryId get connection profile entry id if the id exists
func GetHttpClient ¶
GetHttpClient create HTTP client instance for CM Server
func GetPassword ¶
GetPassword trying to read a password flag value, if it does not exists ask an input from the user
func GetStringFlag ¶
GetStringFlag trying to read a flag value, if it does not exists ask an input from the user
func ProcessAsMap ¶
ProcessAsMap get map format response
func ProcessAsMapFromBytes ¶
ProcessAsMapFromBytes get JSON map from bytes
func ProcessAsMapFromSSHResponse ¶
func ProcessAsMapFromSSHResponse(sshResponse RemoteResponse) map[string]interface{}
ProcessAsMapFromSSHResponse get JSON map from CM gateway SSH response
func ProcessRequest ¶
ProcessRequest get a simple response from a REST call
func RegisterNewCMEntry ¶
func RegisterNewCMEntry(id string, hostname string, port int, protocol string, username string, password string, useGateway bool, apiVersion int)
RegisterNewCMEntry create new CM server registry entry in cmctl database
func RegisterNewConnectionProfile ¶
RegisterNewConnectionProfile create new connection profile entry in cmctl database
func RunLocalCommand ¶
RunLocalCommand run local system command
func SetProfileIdForCMEntry ¶
SetProfileIdForCMEntry attach a connection profile to a specific CM server entry
func UpdateCMEntry ¶
func UpdateCMEntry(id string, hostname string, port int, protocol string, username string, password string, useGateway bool, apiVersion int, connectionProfile string)
UpdateCMEntry update CM server registry entry in cmctl database
func WriteCMServerEntries ¶
func WriteCMServerEntries(cmServers []CMServer)
WriteCMServerEntries write CM server entries to the CM server registry json file
func WriteConnectionProfileEntries ¶
func WriteConnectionProfileEntries(connectionProfiles []ConnectionProfile)
WriteConnectionProfileEntries write connection profile entries to the connection profile registry json file
Types ¶
type CMItems ¶
CMItems global items from CM Server rest API response
func ProcessCMItems ¶
ProcessCMItems get "items" from CM server response
func ProcessCMItemsFromBytes ¶
ProcessCMItemsFromBytes get "items" from bytes
func ProcessCMItemsFromSSHResponse ¶
func ProcessCMItemsFromSSHResponse(sshResponse RemoteResponse) CMItems
ProcessCMItemsFromSSHResponse get "items" from CM gateway SSH response
func (CMItems) ConvertClustersResponse ¶
ConvertClustersResponse convert items response to Clusters response
func (CMItems) ConvertHostsResponse ¶
ConvertHostsResponse convert items response to Hosts response
func (CMItems) ConvertRolesResponse ¶
ConvertRolesResponse convert items response to Roles response
func (CMItems) ConvertServicesResponse ¶
ConvertServicesResponse convert items response to Services response
func (CMItems) ConvertUsersResponse ¶
ConvertUsersResponse convert items response to Users response
type CMServer ¶
type CMServer struct { Name string `json:"name"` Hostname string `json:"hostname"` Port int `json:"port"` Username string `json:"username"` Password string `json:"password"` Protocol string `json:"protocol"` Active bool `json:"active"` ConnectionProfile string `json:"profile"` UseGateway bool `json:"gateway"` ApiVersion int `json:"version"` }
CMServer represents registered CM server entry details
func GetActiveCM ¶
func GetActiveCM() CMServer
GetActiveCM get the active CM server registry from cmctl database (should be only one)
func ListCMRegistryEntries ¶
func ListCMRegistryEntries() []CMServer
ListCMRegistryEntries get all CM server registries from cmctl database
func (CMServer) CreateGatewayCurlGetCommand ¶
func (CMServer) CreateGatewayCurlPostCommand ¶
func (CMServer) CreateGetRequest ¶
CreateGetRequest creates an CM Server GET request
func (CMServer) CreatePostRequest ¶
CreatePostRequest creates an CM Server POST request with body
func (CMServer) CreatePutRequest ¶
CreatePutRequest creates an CM Server PUT request with body
func (CMServer) ExecuteSaltCommand ¶
func (c CMServer) ExecuteSaltCommand(command string, saltBinaryPathPrefix string, saltBinary string)
ExecuteSaltCommand execute a command on all minions
func (CMServer) ExportClusterTemplate ¶
ExportClusterTemplate exporting template for a specific cluster
func (CMServer) GetCMUri ¶
GetCMUri creates the CM uri with /api/vx/ suffix (+ /api/vx/clusters/<cluster> suffix is useCluster is enabled)
func (CMServer) GetDeployment ¶
func (c CMServer) GetDeployment() Deployment
GetDeployment get full deployement data for CM server
func (CMServer) GetFilteredHosts ¶
GetFilteredHosts obtain specific hosts based on different filters
func (CMServer) ListClusters ¶
ListClusters get all the registered clusters
func (CMServer) ListServices ¶
ListServices get all the registered services per cluster
func (CMServer) RunGatewayCMCommand ¶
func (c CMServer) RunGatewayCMCommand(command string, printStdOut bool) RemoteResponse
func (CMServer) RunRemoteHostCommand ¶
func (c CMServer) RunRemoteHostCommand(command string, filteredHosts map[string]bool, skipJump bool) map[string]RemoteResponse
RunRemoteHostCommand executes bash commands on CM hosts
type Cluster ¶
type Cluster struct { UUID string `json:"uuid,omitempty"` Name string `json:"name,omitempty"` DisplayName string `json:"displayName,omitempty"` Version string `json:"fullVersion,omitempty"` Type string `json:"clusterType,omitempty"` }
Cluster holds installed CM cluster details
type ConnectionProfile ¶
type ConnectionProfile struct { Name string `json:"name"` KeyPath string `json:"key_path"` Port int `json:"port"` Username string `json:"username"` }
ConnectionProfile represents ssh/connection descriptions which is used to communicate with CM server and agents
func GetConnectionProfileById ¶
func GetConnectionProfileById(searchId string) ConnectionProfile
GetConnectionProfileById get the connection profile from cmctl database by id
func ListConnectionProfileEntries ¶
func ListConnectionProfileEntries() []ConnectionProfile
ListConnectionProfileEntries get all CM server registries from cmctl database
type Deployment ¶
type Deployment struct { Clusters []Cluster Services []Service Hosts []Host ClusterServiceRoleMap map[string]ServiceRolesMap }
Deployment hold full CM server deployment data
func ConvertDeploymentResponse ¶
func ConvertDeploymentResponse(responseMap map[string]interface{}) Deployment
ConvertDeploymentResponse convert map to Deployment response
type Host ¶
type Host struct { HostID string `json:"hostId,omitempty"` IPAddress string `json:"ipAddress,omitempty"` HostName string `json:"hostName,omitempty"` CommissionState string `json:"commissionState,omitempty"` RackID string `json:"rackId,omitempty"` ClusterName string `json:"clusterName,omitempty"` ClusterDisplayName string `json:"clusterDisplayName,omitempty"` }
Host holds host details
type RemoteResponse ¶
RemoteResponse represents an ssh command output
type Role ¶
type Role struct { Name string `json:"name,omitempty"` Type string `json:"type,omitempty"` HostName string `json:"hostName,omitempty"` ConfigGroup string `json:"configGroup,omitempty"` State string `json:"roleState,omitempty"` StaleConfig string `json:"configStalenessStatus,omitempty"` ComissionState string `json:"commissionState,omitempty"` ClusterName string `json:"clusterName,omitempty"` ServiceName string `json:"serviceName,omitempty"` }
Role holds role details
type Service ¶
type Service struct { Name string `json:"name,omitempty"` DisplayName string `json:"displayName,omitempty"` Type string `json:"type,omitempty"` State string `json:"serviceState,omitempty"` ClusterName string `json:"clusterName,omitempty"` StaleConfig string `json:"configStalenessStatus,omitempty"` }
Service holds service details
type ServiceRolesMap ¶
ServiceRolesMap holds service - roles map
type User ¶
type User struct { Name string `json:"name,omitempty"` AuthRoles []UserAuthRole `json:"authRoles,omitempty"` }
User holds user details
type UserAuthRole ¶
type UserAuthRole struct {
Name string `json:"name,omitempty"`
}
UserAuthRole holds user auth role details