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 ChefErrorCount
- type Client
- type CountPeroid
- type CountedDuration
- type Deprecation
- type EventCollection
- type EventCount
- type EventString
- type ExpandedRunList
- type InventoryNode
- type Node
- type NodeAttribute
- type NodeSegment
- type NodeSegmentRevisionsStatus
- type NodeSegmentRolloutProgress
- type NodesCounts
- type PolicyCookbookLock
- type PolicyCookbooks
- type PolicyRevisionNodeStatus
- type Resource
- type Run
- type RunDurationStatus
- type RunsCounts
- type Suggestion
- type TypeCount
- type ValueCount
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" ErrorMessage string = "error_message" ErrorType string = "error_type" ChefServer string = NodeFieldToJson("SourceFqdn") EntityTypeName string = "entity_type" RunEndTime string = "end_time" Timestamp string = "timestamp" Created string = "created" ExistsTag string = NodeFieldToJson("Exists") StatusTag string = "status" RunIDTag string = "run_id" CloudProviderTag string = "cloud_provider" TimezoneTag string = "timezone" KernelReleaseTag string = "kernel_release" KernelVersionTag string = "kernel_version" VirtualizationSystemTag string = "virtualization_system" VirtualizationRoleTag string = "virtualization_role" DmiSystemManufacturerTag string = "dmi_system_manufacturer" DmiSystemSerialNumberTag string = "dmi_system_serial_number" DomainTag string = "domain" HostnameTag string = "hostname" MacaddressTag string = "macaddress" )
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 ChefErrorCount ¶
type Client ¶
type Client interface { // @params (nodeid, filters) NodeExists(nodeID string, projectFilters map[string][]string) (bool, error) // @params (page, perPage, sortField, ascending, filters, startDate, endDate) GetNodes(int, int, string, bool, map[string][]string, string, string) ([]Node, error) // @params (filters, startDate, endDate) GetNodesCounts(map[string][]string, 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) // @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) GetNodesPageByCursor(context.Context, time.Time, time.Time, map[string][]string, interface{}, string, int, string, bool) ([]Node, error) // @params (ctx, nodeID, start, end, filters, cursorEndTime, cursorID, pageSize, ascending) // returns (Runs, error) GetRunsPageByCursor(context.Context, string, time.Time, time.Time, map[string][]string, time.Time, string, int, bool) ([]Run, error) GetCheckinCountsTimeSeries(time.Time, time.Time, map[string][]string) ([]CountPeroid, error) GetDeletedCountsTimeSeries(time.Time, time.Time, map[string][]string) ([]CountPeroid, error) GetCreateCountsTimeSeries(time.Time, time.Time, map[string][]string) ([]CountPeroid, error) GetErrors(int32, map[string][]string) ([]*ChefErrorCount, error) GetMissingNodeDurationCounts(durations []string) ([]CountedDuration, error) GetNodeMetadataCounts(filters map[string][]string, types []string, startDate, endDate string) ([]TypeCount, error) GetNodeRunsDailyStatusTimeSeries(string, time.Time, time.Time) ([]RunDurationStatus, error) GetLatestRunRolloutBreakdownCounts() (*NodeSegmentRolloutProgress, error) GetUniqueNodesCount(int64, time.Time) (int64, 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 CountedDuration ¶
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"` IPAddress string `json:"ipaddress"` }
type Node ¶
type Node ingest.UpsertNode
type NodeAttribute ¶
type NodeAttribute ingest.NodeAttribute
type NodeSegment ¶
type NodeSegmentRevisionsStatus ¶
type NodeSegmentRevisionsStatus struct { NodeSegment NodesInSegment int32 ByPolicyRevision map[string]*PolicyRevisionNodeStatus }
type NodeSegmentRolloutProgress ¶
type NodeSegmentRolloutProgress struct {
BySegment map[NodeSegment]*NodeSegmentRevisionsStatus
}
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"` RevisionID string `json:"revision_id"` 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 RunDurationStatus ¶
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
type Suggestion ¶
type TypeCount ¶
type TypeCount struct { Values []ValueCount Type string }