Documentation ¶
Index ¶
- Variables
- func GetSortableFieldValue(fieldName string, node Node) (interface{}, error)
- func NodeFieldToJson(field string) (json string)
- func SuggestionFieldArray(field string) bool
- type AbridgedConverge
- type Action
- type ChefError
- type Client
- type Deprecation
- type EventCollection
- type EventCount
- type EventString
- type ExpandedRunList
- type InventoryNode
- type Node
- type NodeAttribute
- type NodesCounts
- type PolicyCookbookLock
- type PolicyCookbooks
- type Resource
- type Run
- type RunsCounts
- type Suggestion
Constants ¶
This section is empty.
Variables ¶
var ( NodeType = reflect.TypeOf(Node{}) Id string = NodeFieldToJson("EntityUuid") Name string = NodeFieldToJson("NodeName") Organization string = NodeFieldToJson("OrganizationName") Cookbook string = "cookbooks" Recipe string = "recipes" ResourceName string = "resource_names" Attribute string = "attributes" Role string = "roles" Environment string = "environment" PolicyRevision string = NodeFieldToJson("PolicyRevision") PolicyName string = NodeFieldToJson("PolicyName") PolicyGroup string = NodeFieldToJson("PolicyGroup") ActionSourceFQDN string = "service_hostname" ActionOrganization string = "organization_name" CheckIn string = NodeFieldToJson("Checkin") LastCCRReceived string = NodeFieldToJson("LastCCRReceived") UptimeSeconds string = NodeFieldToJson("UptimeSeconds") Platform string = NodeFieldToJson("Platform") ChefVersion string = "chef_version" ChefTags string = "chef_tags" Project string = "projects" )
Exposing the following set of variables that consumers might use to map their parameters to the matching param our backend
Functions ¶
func GetSortableFieldValue ¶
GetSortableFieldValue Get the value of a node object from its field name.
func NodeFieldToJson ¶
NodeFieldToJson returns the value associated with key in the tag string of the `Node` struct. We are using this method to be able to convert parameters that consumers provides into backend format
func SuggestionFieldArray ¶
SuggestionFieldArray returns true if the provided field/term is a suggestion type Array. otherwise it returns false for string type.
It matters if the field could be an array or just a single string value, don't forget to add fields that are not string.
Types ¶
type AbridgedConverge ¶
type AbridgedConverge struct { StartTime string `json:"start_time"` RunID string `json:"run_id"` EndTime string `json:"end_time"` Status string `json:"status"` }
A Converge, sometimes called a Run, abridged to contain only the fields returned by the nodes/:node_id/runs endpoint, as opposed to the more data rich nodes/:node_id/runs/:run_id endpoint
type Action ¶
type Action ingest.InternalChefAction
type Client ¶
type Client interface { // @params (nodeid, filters) NodeExists(nodeID string, projectFilters map[string][]string) (bool, error) // @params (page, perPage, sortField, ascending, filters) GetNodes(int, int, string, bool, map[string][]string) ([]Node, error) // @params (filters) GetNodesCounts(map[string][]string) (NodesCounts, error) // @params (node_id, page, per_page, filters, start, end) GetRuns(string, int, int, map[string][]string, string, string) ([]AbridgedConverge, error) // @params (filters nodeID start end) GetRunsCounts(map[string][]string, string, string, string) (RunsCounts, error) // @params (run_id, last_ccr) GetRun(string, time.Time) (Run, error) // @params (node_id) GetAttribute(string) (NodeAttribute, error) // @params (searchTerm, filters) GetListForField(string, map[string][]string) ([]string, error) // @params (type, text, filters) GetSuggestions(string, string, map[string][]string) ([]Suggestion, error) // @param (revision_id) GetPolicyCookbooks(string) (PolicyCookbooks, error) // @params (filters, start, end, pageSize, cursorDate, cursorID, ascending) GetActions(map[string][]string, time.Time, time.Time, int, time.Time, string, bool) ([]Action, int64, error) // @params (filters, start, end) GetActionEventTypeCounts(map[string][]string, time.Time, time.Time) (map[string]int64, error) // @params (filters, start, end) GetActionEventTaskCounts(map[string][]string, time.Time, time.Time) (map[string]int64, error) // @params (start, end, timezone, bucketSizeInHours, eventAction) GetEventString(map[string][]string, string, string, string, int, string) (EventString, error) // @params () // returns (oldestIndexDate, indicesExist, error) GetDateOfOldestConvergeIndices() (time.Time, bool, error) // @params (ctx, start, end, filters, cursorDate, cursorID, pageSize, sortField, ascending) // returns (Node, error) GetInventoryNodes(context.Context, time.Time, time.Time, map[string][]string, time.Time, string, int, string, bool) ([]InventoryNode, error) // @params (ctx, start, end, filters, cursorField, cursorID, pageSize, sortField, ascending) // returns (Node, error) GetNodesPageByCurser(context.Context, time.Time, time.Time, map[string][]string, interface{}, string, int, string, bool) ([]Node, error) }
We would like this backend interface to be pluggable, therefore we will be creating a middle abstraction to call whatever backend we use or will use in the future. Think about it as a set of contracts that the API requires to fulfill the requests
type Deprecation ¶
type Deprecation ingest.Deprecation
type EventCollection ¶
type EventCollection struct {
EventsCount []EventCount `json:"events_count"`
}
type EventCount ¶
type EventString ¶
type EventString struct { EventAction string `json:"event_action"` EventsCollection []EventCollection `json:"events_collection"` }
type ExpandedRunList ¶
type ExpandedRunList ingest.ExpandedRunList
type InventoryNode ¶
type InventoryNode struct { EntityUUID string `json:"entity_uuid"` OrganizationName string `json:"organization_name"` Checkin time.Time `json:"checkin"` EC2 ingest.Ec2 `json:"ec2"` Platform string `json:"platform"` PlatformFamily string `json:"platform_family"` PlatformVersion string `json:"platform_version"` ChefVersion string `json:"chef_version"` // There is a bug in the current code where // the last ccr time is stored as lastCCRReceived. LastCCRReceived time.Time `json:"lastCCRReceived"` NodeName string `json:"node_name"` Fqdn string `json:"fqdn"` }
type NodeAttribute ¶
type NodeAttribute ingest.NodeAttribute
type NodesCounts ¶
type NodesCounts struct { Success int64 `json:"success"` Failure int64 `json:"failure"` Missing int64 `json:"missing"` Total int64 `json:"total"` }
NodesCounts type
Summary of all the nodes counts
func (*NodesCounts) ComputeTotalNodes ¶
func (ns *NodesCounts) ComputeTotalNodes()
type PolicyCookbookLock ¶
type PolicyCookbooks ¶
type PolicyCookbooks struct { PolicyName string `json:"policy_name"` CookbookLocks []PolicyCookbookLock `json:"cookbook_locks"` }
type Run ¶
Types that we consume from the ingest-service
We would like to use a few struct definitions that we have in the ingestion service since it is the origin of our data. Therefore we will just import them as our own so we can call them as `backend.Type`
type RunsCounts ¶
type RunsCounts struct { Success int64 `json:"success"` Failure int64 `json:"failure"` Total int64 `json:"total"` }
RunsCounts type
Summary of all the runs counts