Documentation
¶
Index ¶
- Variables
- func CreatePrimitiveHandler(w http.ResponseWriter, r *http.Request)
- func DeletePrimitiveHandler(w http.ResponseWriter, r *http.Request)
- func FetchClusterDetails(w http.ResponseWriter, r *http.Request)
- func FetchResourceClasses(w http.ResponseWriter, r *http.Request)
- func FetchResourceMetaAttributes(w http.ResponseWriter, r *http.Request)
- func FetchResourceOperationAttributes(w http.ResponseWriter, r *http.Request)
- func FetchResourceOperations(w http.ResponseWriter, r *http.Request)
- func FetchResourceParams(w http.ResponseWriter, r *http.Request)
- func FetchResourceProviders(w http.ResponseWriter, r *http.Request)
- func FetchResourceTypes(w http.ResponseWriter, r *http.Request)
- func RaClassesHandler(w http.ResponseWriter, r *http.Request)
- func RenamePrimitiveHandler(w http.ResponseWriter, r *http.Request)
- func ResourceEditHandler(w http.ResponseWriter, r *http.Request)
- func SubmitResourceMetaAttributes(w http.ResponseWriter, r *http.Request)
- func SubmitResourceOperationAttributes(w http.ResponseWriter, r *http.Request)
- func SubmitResourceOperations(w http.ResponseWriter, r *http.Request)
- func SubmitResourceParams(w http.ResponseWriter, r *http.Request)
- func UpdatePrimitiveHandler(w http.ResponseWriter, r *http.Request)
- type Action
- type CIB
- type ClusterPropertySet
- type Configuration
- type Constraints
- type ContentAttr
- type CrmConfig
- type CrmNode
- type CrmResourceMetadata
- type CrmResourceRow
- type CrmRsc
- type CrmRscNode
- type CrmStatus
- type InstanceAttribute
- type LRM
- type LRMOp
- type LRMResource
- type MetaAttribute
- type MetaParameter
- type NameValue
- type Node
- type NodeRow
- type NodeState
- type Nvpair
- type Operation
- type OperationContent
- type OperationOption
- type Primitive
- type ResourceRow
- type RscColocation
- type RscLocation
- type SelectContent
- type SelectOption
- type Status
Constants ¶
This section is empty.
Variables ¶
var Routehandler http.Handler // set from main
Functions ¶
func CreatePrimitiveHandler ¶
func CreatePrimitiveHandler(w http.ResponseWriter, r *http.Request)
func DeletePrimitiveHandler ¶
func DeletePrimitiveHandler(w http.ResponseWriter, r *http.Request)
func FetchClusterDetails ¶
func FetchClusterDetails(w http.ResponseWriter, r *http.Request)
func FetchResourceClasses ¶
func FetchResourceClasses(w http.ResponseWriter, r *http.Request)
func FetchResourceMetaAttributes ¶
func FetchResourceMetaAttributes(w http.ResponseWriter, r *http.Request)
func FetchResourceOperationAttributes ¶
func FetchResourceOperationAttributes(w http.ResponseWriter, r *http.Request)
func FetchResourceOperations ¶
func FetchResourceOperations(w http.ResponseWriter, r *http.Request)
func FetchResourceParams ¶
func FetchResourceParams(w http.ResponseWriter, r *http.Request)
func FetchResourceProviders ¶
func FetchResourceProviders(w http.ResponseWriter, r *http.Request)
func FetchResourceTypes ¶
func FetchResourceTypes(w http.ResponseWriter, r *http.Request)
func RaClassesHandler ¶
func RaClassesHandler(w http.ResponseWriter, r *http.Request)
func RenamePrimitiveHandler ¶
func RenamePrimitiveHandler(w http.ResponseWriter, r *http.Request)
func ResourceEditHandler ¶
func ResourceEditHandler(w http.ResponseWriter, r *http.Request)
This function does the magic routing between Go and Ruby
func SubmitResourceMetaAttributes ¶
func SubmitResourceMetaAttributes(w http.ResponseWriter, r *http.Request)
func SubmitResourceOperationAttributes ¶
func SubmitResourceOperationAttributes(w http.ResponseWriter, r *http.Request)
func SubmitResourceOperations ¶
func SubmitResourceOperations(w http.ResponseWriter, r *http.Request)
func SubmitResourceParams ¶
func SubmitResourceParams(w http.ResponseWriter, r *http.Request)
func UpdatePrimitiveHandler ¶
func UpdatePrimitiveHandler(w http.ResponseWriter, r *http.Request)
Types ¶
type Action ¶
type Action struct {
Name string `xml:"name,attr"`
Timeout string `xml:"timeout,attr"`
Interval string `xml:"interval,attr"`
Depth string `xml:"depth,attr"`
// We take CibID later from cib, if they are defined
CibID string
// Default values
OpDefaults []MetaParameter
// Help info
Shortdesc string
Longdesc string
}
TODO: Action struct is messy. It's used for both to parse cib.xml * and to store the default values of operations. * Maybe there should be two different structures * (however I might change my mind, so don't hastle with it (17.05.2025))
type CIB ¶
type CIB struct {
XMLName xml.Name `xml:"cib"`
ValidateWith string `xml:"validate-with,attr"`
Epoch string `xml:"epoch,attr"`
NumUpdates string `xml:"num_updates,attr"`
AdminEpoch string `xml:"admin_epoch,attr"`
CibLastWritten string `xml:"cib-last-written,attr"`
UpdateOrigin string `xml:"update-origin,attr"`
UpdateClient string `xml:"update-client,attr"`
UpdateUser string `xml:"update-user,attr"`
HaveQuorum string `xml:"have-quorum,attr"`
DcUuid string `xml:"dc-uuid,attr"`
Configuration Configuration `xml:"configuration"`
Status Status `xml:"status"`
}
type ClusterPropertySet ¶
type Configuration ¶
type Configuration struct {
CrmConfig CrmConfig `xml:"crm_config"`
Node []Node `xml:"nodes>node"`
Constraints Constraints `xml:"constraints"`
Primitives []Primitive `xml:"resources>primitive"`
}
type Constraints ¶
type Constraints struct {
Colocations []RscColocation `xml:"rsc_colocation"`
Locations []RscLocation `xml:"rsc_location"`
}
type ContentAttr ¶
type ContentAttr struct {
Type string `xml:"type,attr"`
Default string `xml:"default,attr"`
// Possible values are hardcoded
PossibleValues []string
// We take CibID and CibValue later from cib, if they are defined
Required string // string, so that ["true", "false", "" for undefined]
CibID string // "" in case of operation attributes, the Action.CibID is used instead
CibValue string
}
type CrmConfig ¶
type CrmConfig struct {
ClusterPropertySet ClusterPropertySet `xml:"cluster_property_set"`
}
type CrmResourceMetadata ¶
type CrmResourceMetadata struct {
Name string `xml:"name,attr"`
Version string `xml:"version,attr"`
Longdesc string `xml:"longdesc"`
Shortdesc string `xml:"shortdesc"`
Parameters []MetaParameter `xml:"parameters>parameter"` // maps to instance_attributes
Actions []Action `xml:"actions>action"`
/* RscDefaults (#meta_attributes) is not in 'crm_resource --show-metadata'
* but it's copied from rscDefaults
* and later enriched from 'cibadmin' */
RscDefaults []MetaParameter
}
type CrmResourceRow ¶
func ToCrmResourceRows ¶
func ToCrmResourceRows(crm CrmStatus) []CrmResourceRow
flatten the CrmStatus for the easier UI
type CrmRsc ¶
type CrmRsc struct {
ID string `xml:"id,attr"`
ResourceAgent string `xml:"resource_agent,attr"`
Role string `xml:"role,attr"`
TargetRole string `xml:"target_role,attr"`
Active bool `xml:"active,attr"`
Maintenance bool `xml:"maintenance,attr"`
Managed bool `xml:"managed,attr"`
Nodes []CrmRscNode `xml:"node"`
}
type CrmRscNode ¶
type CrmStatus ¶
type CrmStatus struct {
XMLName xml.Name `xml:"crm_mon"`
Nodes []CrmNode `xml:"nodes>node"`
Resources []CrmRsc `xml:"resources>resource"`
}
func GetCrmStatus ¶
type InstanceAttribute ¶
type LRM ¶
type LRM struct {
Resources []LRMResource `xml:"lrm_resources>lrm_resource"`
}
type LRMResource ¶
type MetaAttribute ¶
type MetaParameter ¶
type MetaParameter struct {
Name string `xml:"name,attr"`
Longdesc string `xml:"longdesc"`
Shortdesc string `xml:"shortdesc"`
Content ContentAttr `xml:"content"`
}
func GetOpDefaults ¶
func GetOpDefaults() []MetaParameter
func GetOpDescriptions ¶
func GetOpDescriptions() []MetaParameter
func GetRscDefaults ¶
func GetRscDefaults() []MetaParameter
type Operation ¶
type Operation struct {
XMLName xml.Name `xml:"op"`
Description string `xml:"description,attr,omitempty"`
Depth string `xml:"depth,attr,omitempty"`
ID string `xml:"id,attr"`
Interval string `xml:"interval,attr,omitempty"`
Name string `xml:"name,attr"`
Timeout string `xml:"timeout,attr,omitempty"`
}
don't confuse it with Action. * Action is "crm_resource --show-metadata ocf:pacemaker:Dummy" * Operation is "cibamdin -Ql"
type OperationContent ¶
type OperationContent struct {
Options []OperationOption `json:"Options"`
}
type OperationOption ¶
type OperationOption struct {
Name string `json:"Name"`
DefaultValues []NameValue `json:"DefaultValues"`
Shortdesc string `json:"Shortdesc"`
Longdesc string `json:"Longdesc"`
Type string `json:"Type"`
PossibleValues []string `json:"PossibleValues"`
Required string `json:"Required"` // string, so that ["true", "false", "" for undefined]
// FIXME: in case of operations, there might be many CibIDs and each id has several values [interval, timeout,...]
CibID string `json:"CibID"`
/* CibNameValues is kinda hacky thing.
* If it's instance or meta attribute there should be
* `CibValue string` instead, not an array `[]NameValue`
* For example
* `<nvpair id="dummy1-instance_attributes-envfile" name="envfile" value="/etc/sysconfyg/hawk"/>`
* Hoever an operation may contain many key-values
* `<op id="dummy1-monitor-5" interval="5" name="monitor" timeout="22"/>`
* e.i. interval=5, timeout=22, so we use []NameValue for both
* The convention is that the name is empty for instance and meta attributes NameValue{"", CibValue} */
CibNameValues []NameValue `json:"CibNameValues"`
}
type Primitive ¶
type Primitive struct {
XMLName xml.Name `xml:"primitive"` // w/o it, marshalled xml would be 'Primitive' (not 'primitive')
ID string `xml:"id,attr" json:"id"`
Class string `xml:"class,attr" json:"class"`
Provider string `xml:"provider,attr" json:"provider"`
Type string `xml:"type,attr" json:"type"`
MetaAttributes MetaAttribute `xml:"meta_attributes" json:"meta_attributes"`
InstanceAttributes InstanceAttribute `xml:"instance_attributes" json:"instance_attributes"`
Operations []Operation `xml:"operations>op" json:"operations"`
}
type ResourceRow ¶
type RscColocation ¶
type RscColocation struct {
ID string `xml:"id,attr"`
Score string `xml:"score,attr"`
Rsc string `xml:"rsc,attr"`
WithRsc string `xml:"with-rsc,attr"`
}
To add colocation constraint: crm configure colocation location_constration 5000: dummy1 dummy2
type RscLocation ¶
type SelectContent ¶
type SelectContent struct {
Longdesc string `json:"Longdesc"`
Shortdesc string `json:"Shortdesc"`
Options []SelectOption `json:"Options"`
}
Response data.
type SelectOption ¶
type SelectOption struct {
Name string `json:"Name"`
DefaultValue string `json:"DefaultValue"`
Shortdesc string `json:"Shortdesc"`
Longdesc string `json:"Longdesc"`
Type string `json:"Type"`
PossibleValues []string `json:"PossibleValues"`
Required string `json:"Required"` // string, so that ["true", "false", "" for undefined]
CibID string `json:"CibID"`
CibValue string `json:"CibValue"`
}
it's like MetaParameter, but ContentAttr is flattened it has nothing to do with parsing xml, it's in the structure conveniet to work with in the js