Documentation ¶
Index ¶
- Constants
- func ActiveAmbariRegistry(id string)
- func ConvertStingsToMap(keyValueStrings []string) map[string]string
- func CreateAmbariRegistryDb()
- func DeRegisterAmbariEntry(id string)
- func DeRegisterConnectionProfile(id string)
- func DeactiveAllAmbariRegistry()
- func DownloadFile(filepath string, url string) error
- func DownloadViaScp(sshConfig *easyssh.MakeConfig, source string, dest string, skipJump bool) error
- func DropAmbariRegistryRecords()
- func DropConnectionProfileRecords()
- func EvaluateBoolValueFromString(answer string) bool
- func ExecuteDownloadFileTask(task Task)
- func ExecuteLocalCommandTask(task Task)
- func FormatJson(b []byte) *bytes.Buffer
- func GetAmbariEntryId(id string) string
- func GetConfigValue(blueprint map[string]interface{}, configType string, configProperty 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 ProcessRequest(request *http.Request) []byte
- func RegisterNewAmbariEntry(id string, hostname string, port int, protocol string, username string, ...)
- func RegisterNewConnectionProfile(id string, keyPath string, port int, username string, hostJump bool, ...)
- func RunLocalCommand(command string, arg ...string) (string, string, error)
- func SetProfileIdForAmbariEntry(ambariEntryId string, profileId string)
- func WriteAmbariServerEntries(ambariServers []AmbariRegistry)
- func WriteConnectionProfileEntries(connectionProfiles []ConnectionProfile)
- type AmbariItems
- type AmbariRegistry
- func (a AmbariRegistry) CheckService(service string) []byte
- func (a AmbariRegistry) CopyFolderFromRemote(component string, source string, dest string, filteredHosts map[string]bool, ...)
- func (a AmbariRegistry) CopyFromRemote(source string, dest string, host string, skipJump bool)
- func (a AmbariRegistry) CopyFromRemoteHosts(source string, dest string, filteredHosts map[string]bool, skipJump bool)
- func (a AmbariRegistry) CopyToRemote(source string, dest string, filteredHosts map[string]bool, skipJump bool)
- func (a AmbariRegistry) CreateGetRequest(urlSuffix string, useCluster bool) *http.Request
- func (a AmbariRegistry) CreatePostRequest(body bytes.Buffer, urlSuffix string, useCluster bool) *http.Request
- func (a AmbariRegistry) CreatePutRequest(body bytes.Buffer, urlSuffix string, useCluster bool) *http.Request
- func (a AmbariRegistry) DownloadLogs(dest string, filter Filter)
- func (a AmbariRegistry) ExecuteAmbariCommand(task Task)
- func (a AmbariRegistry) ExecuteConfigCommand(task Task)
- func (a AmbariRegistry) ExecutePlaybook(playbook Playbook)
- func (a AmbariRegistry) ExecuteRemoteCommandTask(task Task, filteredHosts map[string]bool)
- func (a AmbariRegistry) ExecuteUploadFileTask(task Task, filteredHosts map[string]bool)
- func (a AmbariRegistry) ExportBlueprint() []byte
- func (a AmbariRegistry) ExportBlueprintAsMap() map[string]interface{}
- func (a AmbariRegistry) GetAmbariUri(uriSuffix string, useCluster bool) string
- func (a AmbariRegistry) GetClusterInfo() Cluster
- func (a AmbariRegistry) GetFilteredHosts(filter Filter) map[string]bool
- func (a AmbariRegistry) GetMinimalBlueprint(blueprint map[string]interface{}, stackDefaults map[string]StackConfig) []byte
- func (a AmbariRegistry) GetStackDefaultConfigs(stack string, version string) map[string]StackConfig
- func (a AmbariRegistry) ListAgents() []Host
- func (a AmbariRegistry) ListComponents() []Component
- func (a AmbariRegistry) ListHostComponents(param string, useHost bool) []HostComponent
- func (a AmbariRegistry) ListHostComponentsByService(service string) []HostComponent
- func (a AmbariRegistry) ListServiceConfigVersions() []ServiceConfig
- func (a AmbariRegistry) ListServices() []Service
- func (a AmbariRegistry) RestartComponent(component string) []byte
- func (a AmbariRegistry) RestartService(service string)
- func (a AmbariRegistry) RunAmbariServiceCommand(command string, filter Filter, useServiceFilter bool, useComponentFilter bool)
- func (a AmbariRegistry) RunRemoteHostCommand(command string, filteredHosts map[string]bool, skipJump bool) map[string]RemoteResponse
- func (a AmbariRegistry) SetConfig(configType string, configKey string, configValue string)
- func (a AmbariRegistry) StartComponent(component string) []byte
- func (a AmbariRegistry) StartService(service string) []byte
- func (a AmbariRegistry) StopComponent(component string) []byte
- func (a AmbariRegistry) StopService(service string) []byte
- type Cluster
- type Component
- type ConnectionProfile
- type Filter
- type Host
- type HostComponent
- type Input
- type Item
- type Playbook
- type Properties
- type RemoteResponse
- type Response
- type Service
- type ServiceConfig
- type StackConfig
- type StackProperty
- type Task
Constants ¶
const ( // RemoteCommand remote command type for running commands on the agent hosts RemoteCommand = "RemoteCommand" // LocalCommand local command type for running commands on localhost LocalCommand = "LocalCommand" // Download command type for downloading a file from an url Download = "Download" // Upload command type for uploading files to the agent hosts Upload = "Upload" // Config command type is for managing (update) configuration Config = "Config" // AmbariCommand runs an ambari command (like START or STOP) against components or services AmbariCommand = "AmbariCommand" )
Variables ¶
This section is empty.
Functions ¶
func ActiveAmbariRegistry ¶
func ActiveAmbariRegistry(id string)
ActiveAmbariRegistry turn on active status on selected ambari registry
func ConvertStingsToMap ¶
ConvertStingsToMap generate a map from strings (like key=value)
func CreateAmbariRegistryDb ¶
func CreateAmbariRegistryDb()
CreateAmbariRegistryDb initialize ambarictl database
func DeRegisterAmbariEntry ¶
func DeRegisterAmbariEntry(id string)
DeRegisterAmbariEntry remove an ambari server enrty by id
func DeRegisterConnectionProfile ¶
func DeRegisterConnectionProfile(id string)
DeRegisterConnectionProfile remove a connection profile by id
func DeactiveAllAmbariRegistry ¶
func DeactiveAllAmbariRegistry()
DeactiveAllAmbariRegistry turn off active status on all ambari registries
func DownloadFile ¶ added in v0.2.0
DownloadFile download a file from an url to the local filesystem
func DownloadViaScp ¶
DownloadViaScp downloads file from remote to local
func DropAmbariRegistryRecords ¶
func DropAmbariRegistryRecords()
DropAmbariRegistryRecords drop all ambari server entries from ambarictl database
func DropConnectionProfileRecords ¶
func DropConnectionProfileRecords()
DropConnectionProfileRecords drop all connection profile from ambarictl database
func EvaluateBoolValueFromString ¶ added in v0.3.0
EvaluateBoolValueFromString get a string boolean answer and evaluate as a boolean value
func ExecuteDownloadFileTask ¶ added in v0.2.0
func ExecuteDownloadFileTask(task Task)
ExecuteDownloadFileTask download a file from an url to the local filesystem
func ExecuteLocalCommandTask ¶ added in v0.2.0
func ExecuteLocalCommandTask(task Task)
ExecuteLocalCommandTask executes a local shell command
func FormatJson ¶ added in v0.3.0
FormatJson format json file
func GetAmbariEntryId ¶
GetAmbariEntryId get ambari entry id if the id exists
func GetConfigValue ¶
func GetConfigValue(blueprint map[string]interface{}, configType string, configProperty string) string
GetConfigValue get a value from the blueprint for a speficfic config property with a config type
func GetConnectionProfileEntryId ¶
GetConnectionProfileEntryId get connection profile entry id if the id exists
func GetHttpClient ¶
GetHttpClient create HTTP client instance for Ambari
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 ProcessRequest ¶
ProcessRequest get a simple response from a REST call
func RegisterNewAmbariEntry ¶
func RegisterNewAmbariEntry(id string, hostname string, port int, protocol string, username string, password string, cluster string)
RegisterNewAmbariEntry create new ambari registry entry in ambarictl database
func RegisterNewConnectionProfile ¶
func RegisterNewConnectionProfile(id string, keyPath string, port int, username string, hostJump bool, proxyAddress string)
RegisterNewConnectionProfile create new connection profile entry in ambarictl database
func RunLocalCommand ¶
RunLocalCommand run local system command
func SetProfileIdForAmbariEntry ¶
SetProfileIdForAmbariEntry attach a connection profile to a specific ambari server entry
func WriteAmbariServerEntries ¶ added in v0.3.0
func WriteAmbariServerEntries(ambariServers []AmbariRegistry)
WriteAmbariServerEntries write ambari server entries to the ambari server registry json file
func WriteConnectionProfileEntries ¶ added in v0.3.0
func WriteConnectionProfileEntries(connectionProfiles []ConnectionProfile)
WriteConnectionProfileEntries write connection profile entries to the connection profile registry json file
Types ¶
type AmbariItems ¶
type AmbariItems struct { Href string `json:"href"` Items []Item `json:"items"` Cluster Cluster `json:"Clusters,omitempty"` }
AmbariItems global items from Ambari rest API response
func ProcessAmbariItems ¶
func ProcessAmbariItems(request *http.Request) AmbariItems
ProcessAmbariItems get "items" from Ambari response
func (AmbariItems) ConvertResponse ¶
func (a AmbariItems) ConvertResponse() Response
ConvertResponse converts the response items to specific types
type AmbariRegistry ¶
type AmbariRegistry 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"` Cluster string `json:"cluster"` Active bool `json:"active"` ConnectionProfile string `json:"profile"` }
AmbariRegistry represents registered ambari server entry details
func GetActiveAmbari ¶
func GetActiveAmbari() AmbariRegistry
GetActiveAmbari get the active ambari registry from ambarictl database (should be only one)
func GetAmbariById ¶
func GetAmbariById(searchId string) AmbariRegistry
GetAmbariById get the ambari registry from ambarictl database by id
func ListAmbariRegistryEntries ¶
func ListAmbariRegistryEntries() []AmbariRegistry
ListAmbariRegistryEntries get all ambari registries from ambarictl database
func (AmbariRegistry) CheckService ¶ added in v0.4.4
func (a AmbariRegistry) CheckService(service string) []byte
CheckService performs service check on an ambari service
func (AmbariRegistry) CopyFolderFromRemote ¶
func (a AmbariRegistry) CopyFolderFromRemote(component string, source string, dest string, filteredHosts map[string]bool, skipJump bool)
CopyFolderFromRemote copy folder (zipping it first) to local filesystem from remote location
func (AmbariRegistry) CopyFromRemote ¶
func (a AmbariRegistry) CopyFromRemote(source string, dest string, host string, skipJump bool)
CopyFromRemote copy 1 file from 1 remote host to locally
func (AmbariRegistry) CopyFromRemoteHosts ¶
func (a AmbariRegistry) CopyFromRemoteHosts(source string, dest string, filteredHosts map[string]bool, skipJump bool)
CopyFromRemoteHosts copy remote file to remote host(s)
func (AmbariRegistry) CopyToRemote ¶
func (a AmbariRegistry) CopyToRemote(source string, dest string, filteredHosts map[string]bool, skipJump bool)
CopyToRemote copy local file to remote host(s)
func (AmbariRegistry) CreateGetRequest ¶
func (a AmbariRegistry) CreateGetRequest(urlSuffix string, useCluster bool) *http.Request
CreateGetRequest creates an Ambari GET request
func (AmbariRegistry) CreatePostRequest ¶
func (a AmbariRegistry) CreatePostRequest(body bytes.Buffer, urlSuffix string, useCluster bool) *http.Request
CreatePostRequest creates an Ambari POST request with body
func (AmbariRegistry) CreatePutRequest ¶ added in v0.2.0
func (a AmbariRegistry) CreatePutRequest(body bytes.Buffer, urlSuffix string, useCluster bool) *http.Request
CreatePutRequest creates an Ambari PUT request with body
func (AmbariRegistry) DownloadLogs ¶
func (a AmbariRegistry) DownloadLogs(dest string, filter Filter)
DownloadLogs download specific logs that can be filtered by hosts, components or service (by default, it downloads agent logs)
func (AmbariRegistry) ExecuteAmbariCommand ¶ added in v0.2.0
func (a AmbariRegistry) ExecuteAmbariCommand(task Task)
ExecuteAmbariCommand executes an ambari command against services or components
func (AmbariRegistry) ExecuteConfigCommand ¶ added in v0.2.0
func (a AmbariRegistry) ExecuteConfigCommand(task Task)
ExecuteConfigCommand executes a configuration upgrade
func (AmbariRegistry) ExecutePlaybook ¶
func (a AmbariRegistry) ExecutePlaybook(playbook Playbook)
ExecutePlaybook runs tasks on ambari hosts based on a playbook object
func (AmbariRegistry) ExecuteRemoteCommandTask ¶ added in v0.2.0
func (a AmbariRegistry) ExecuteRemoteCommandTask(task Task, filteredHosts map[string]bool)
ExecuteRemoteCommandTask executes a remote command on filtered hosts
func (AmbariRegistry) ExecuteUploadFileTask ¶ added in v0.2.0
func (a AmbariRegistry) ExecuteUploadFileTask(task Task, filteredHosts map[string]bool)
ExecuteUploadFileTask upload a file to specific (filtered) hosts
func (AmbariRegistry) ExportBlueprint ¶
func (a AmbariRegistry) ExportBlueprint() []byte
ExportBlueprint generate re-usable JSON from the cluster
func (AmbariRegistry) ExportBlueprintAsMap ¶
func (a AmbariRegistry) ExportBlueprintAsMap() map[string]interface{}
ExportBlueprintAsMap generate re-usable JSON map from the cluster
func (AmbariRegistry) GetAmbariUri ¶
func (a AmbariRegistry) GetAmbariUri(uriSuffix string, useCluster bool) string
GetAmbariUri creates the Ambari uri with /api/v1/ suffix (+ /api/v1/clusters/<cluster> suffix is useCluster is enabled)
func (AmbariRegistry) GetClusterInfo ¶
func (a AmbariRegistry) GetClusterInfo() Cluster
GetClusterInfo obtain cluster detauls for ambari managed cluster
func (AmbariRegistry) GetFilteredHosts ¶
func (a AmbariRegistry) GetFilteredHosts(filter Filter) map[string]bool
GetFilteredHosts obtain specific hosts based on different filters
func (AmbariRegistry) GetMinimalBlueprint ¶
func (a AmbariRegistry) GetMinimalBlueprint(blueprint map[string]interface{}, stackDefaults map[string]StackConfig) []byte
GetMinimalBlueprint obtain minimal blueprint - compare properties with stack default properties and get a minimal blueprint configuration
func (AmbariRegistry) GetStackDefaultConfigs ¶
func (a AmbariRegistry) GetStackDefaultConfigs(stack string, version string) map[string]StackConfig
GetStackDefaultConfigs obtain default configs for specific (versioned) stack
func (AmbariRegistry) ListAgents ¶
func (a AmbariRegistry) ListAgents() []Host
ListAgents get all the registered hosts
func (AmbariRegistry) ListComponents ¶
func (a AmbariRegistry) ListComponents() []Component
ListComponents get all installed components
func (AmbariRegistry) ListHostComponents ¶
func (a AmbariRegistry) ListHostComponents(param string, useHost bool) []HostComponent
ListHostComponents get all installed host components by component type (or hosts)
func (AmbariRegistry) ListHostComponentsByService ¶
func (a AmbariRegistry) ListHostComponentsByService(service string) []HostComponent
ListHostComponentsByService get all installed host components by service name
func (AmbariRegistry) ListServiceConfigVersions ¶
func (a AmbariRegistry) ListServiceConfigVersions() []ServiceConfig
ListServiceConfigVersions gather service configuration details
func (AmbariRegistry) ListServices ¶
func (a AmbariRegistry) ListServices() []Service
ListServices get all installed services
func (AmbariRegistry) RestartComponent ¶ added in v0.2.0
func (a AmbariRegistry) RestartComponent(component string) []byte
RestartComponent restarts an ambari component of a service
func (AmbariRegistry) RestartService ¶ added in v0.2.0
func (a AmbariRegistry) RestartService(service string)
RestartService restarting an ambari service
func (AmbariRegistry) RunAmbariServiceCommand ¶ added in v0.2.0
func (a AmbariRegistry) RunAmbariServiceCommand(command string, filter Filter, useServiceFilter bool, useComponentFilter bool)
RunAmbariServiceCommand start / stop / restart Ambari services or components
func (AmbariRegistry) RunRemoteHostCommand ¶
func (a AmbariRegistry) RunRemoteHostCommand(command string, filteredHosts map[string]bool, skipJump bool) map[string]RemoteResponse
RunRemoteHostCommand executes bash commands on ambari agent hosts
func (AmbariRegistry) SetConfig ¶ added in v0.2.0
func (a AmbariRegistry) SetConfig(configType string, configKey string, configValue string)
SetConfig sets a config value for a specific config key of a config type
func (AmbariRegistry) StartComponent ¶ added in v0.2.0
func (a AmbariRegistry) StartComponent(component string) []byte
StartComponent start an ambari component of a service
func (AmbariRegistry) StartService ¶ added in v0.2.0
func (a AmbariRegistry) StartService(service string) []byte
StartService starting an ambari service
func (AmbariRegistry) StopComponent ¶ added in v0.2.0
func (a AmbariRegistry) StopComponent(component string) []byte
StopComponent stop an ambari component of a service
func (AmbariRegistry) StopService ¶ added in v0.2.0
func (a AmbariRegistry) StopService(service string) []byte
StopService stopping an ambari service
type Cluster ¶
type Cluster struct { ClusterName string `json:"cluster_name,omitempty"` ClusterVersion string `json:"version,omitempty"` ClusterTotalHosts float64 `json:"total_hosts,omitempty"` ClusterSecurityType string `json:"security_type,omitempty"` }
Cluster holds installed ambari cluster details
type Component ¶
type Component struct { ComponentName string `json:"component_name,omitempty"` ServiceName string `json:"service_name,omitempty"` ComponentState string `json:"state,omitempty"` }
Component ambari managed component details
type ConnectionProfile ¶
type ConnectionProfile struct { Name string `json:"name"` KeyPath string `json:"key_path"` Port int `json:"port"` Username string `json:"username"` HostJump bool `json:"host_jump"` ProxyAddress string `json:"proxy_address"` }
ConnectionProfile represents ssh/connection descriptions which is used to communicate with Ambari server and agents
func GetConnectionProfileById ¶
func GetConnectionProfileById(searchId string) ConnectionProfile
GetConnectionProfileById get the connection profile from ambarictl database by id
func ListConnectionProfileEntries ¶
func ListConnectionProfileEntries() []ConnectionProfile
ListConnectionProfileEntries get all ambari registries from ambarictl database
type Host ¶
type Host struct { HostName string `json:"host_name,omitempty"` IP string `json:"ip,omitempty"` PublicHostname string `json:"public_host_name,omitempty"` OSType string `json:"os_type,omitempty"` OSArch string `json:"os_arch,omitempty"` UnlimitedJCE bool `json:"unlimited_jce,omitempty"` HostState string `json:"host_state,omitempty"` }
Host agent host details
type HostComponent ¶
type HostComponent struct { HostComponentName string `json:"host_component_name,omitempty"` HostComponentState string `json:"state,omitempty"` HostComponntHost string `json:"host_name,omitempty"` }
HostComponent ambari managed host component details
type Input ¶ added in v0.3.0
Input represents a variable that needs to be provided by users (if default value is empty)
type Playbook ¶
type Playbook struct { Name string `yaml:"name"` Description string `yaml:"description"` Tasks []Task `yaml:"tasks"` Inputs []Input `yaml:"inputs"` }
Playbook contains an array of tasks that will be executed on ambari hosts
func LoadPlaybookFile ¶
LoadPlaybookFile read a playbook yaml file and transform it to a Playbook object
type Properties ¶
type Properties map[string]interface{}
Properties represents configuration properties (key/value pairs)
type RemoteResponse ¶
RemoteResponse represents an ssh command output
type Response ¶
type Response struct { Cluster Cluster Hosts []Host Services []Service Components []Component HostComponents []HostComponent ServiceConfigs []ServiceConfig StackConfigs map[string]StackConfig }
Response common type which wraps all of the possible response entry types
type Service ¶
type Service struct { ServiceName string `json:"service_name,omitempty"` ServiceState string `json:"state,omitempty"` }
Service ambari managed service info
type ServiceConfig ¶
type ServiceConfig struct { ServiceConfigType string `json:"type,omitempty"` ServiceConfigTag string `json:"tag,omitempty"` ServiceConfigVersion float64 `json:"version,omitempty"` Properties Properties `json:"properties,omitempty"` }
ServiceConfig represents service specific configurations
type StackConfig ¶
type StackConfig struct { ServiceConfigType string `json:"type,omitempty"` Properties []StackProperty `json:"properties,omitempty"` }
StackConfig represents stack default configurations (with included service name and service config type)
type StackProperty ¶
type StackProperty struct { Type string `json:"type,omitempty"` Name string `json:"property_name,omitempty"` Value string `json:"property_value,omitempty"` PropertyType string `json:"property_type,omitempty"` }
StackProperty represents a stack property with default values and attributes
type Task ¶
type Task struct { Name string `yaml:"name"` Type string `yaml:"type"` Command string `yaml:"command"` HostComponentFilter string `yaml:"host_component_filter"` AmbariServerFilter bool `yaml:"ambari_server"` AmbariAgentFilter bool `yaml:"ambari_agent"` HostFilter string `yaml:"hosts"` ServiceFilter string `yaml:"services"` ComponentFilter string `yaml:"components"` Parameters map[string]string `yaml:"parameters,omitempty"` }
Task represents a task that can be executed on an ambari hosts