Documentation ¶
Overview ¶
Package types contains all user-defined data types used in Smart Proxy REST API service. Some types are the same as in other services (especially in Insights Results Aggregator, Content Service) and thus they are imported (based on) the common package insights-operator-utils/types.
Index ¶
- Constants
- func ClusterInfoArrayToMap(clustersInfo []ClusterInfo) (retval map[ctypes.ClusterName]ClusterInfo)
- func RuleIDWithErrorKeyFromCompositeRuleID(compositeRuleID ctypes.RuleID) (ctypes.RuleID, ctypes.ErrorKey, error)
- type Alert
- type ClusterInfo
- type ClusterListView
- type ClusterName
- type ClusterOverview
- type ClustersDetailData
- type ClustersDetailResponse
- type DataEngResponse
- type ErrorKeyMetadataV1
- type ErrorKeyMetadataV2
- type ImpactingFlag
- type InfoResponse
- type OperatorCondition
- type OrgID
- type OrgOverviewResponse
- type RecommendationContent
- type RecommendationContentUserData
- type RecommendationListView
- type ReportResponseMeta
- type ReportResponseMetaV1
- type ReportResponseMetaV2
- type RequestID
- type RequestStatus
- type RuleContent
- type RuleContentV1
- type RuleContentV2
- type RuleErrorKeyContentV1
- type RuleErrorKeyContentV2
- type RuleID
- type RuleRating
- type RuleWithContent
- type RuleWithContentResponse
- type SimplifiedReport
- type SimplifiedRuleHit
- type SmartProxyReport
- type SmartProxyReportV1
- type SmartProxyReportV2
- type Timestamp
- type UpgradeRecommendation
- type UpgradeRisksMeta
- type UpgradeRisksPredictors
- type UserID
- type UserVote
Constants ¶
const ( // UserVoteDislike shows user's dislike UserVoteDislike = types.UserVoteDislike // UserVoteNone shows no vote from user UserVoteNone = types.UserVoteNone // UserVoteLike shows user's like UserVoteLike = types.UserVoteLike )
Variables ¶
This section is empty.
Functions ¶
func ClusterInfoArrayToMap ¶
func ClusterInfoArrayToMap(clustersInfo []ClusterInfo) (retval map[ctypes.ClusterName]ClusterInfo)
ClusterInfoArrayToMap convert an array of ClusterInfo elements into a map using ClusterName as key
Types ¶
type Alert ¶
type Alert struct { Name string `json:"name"` Namespace string `json:"namespace"` Severity string `json:"severity"` URL string `json:"url"` }
Alert data structure representing a single alert
type ClusterInfo ¶
type ClusterInfo struct { ID ClusterName `json:"cluster_id"` DisplayName string `json:"display_name"` Managed bool `json:"managed"` Status string `json:"status"` }
ClusterInfo is a data structure containing some relevant cluster information
type ClusterListView ¶
type ClusterListView struct { ClusterID types.ClusterName `json:"cluster_id"` ClusterName string `json:"cluster_name"` Managed bool `json:"managed"` LastCheckedAt Timestamp `json:"last_checked_at,omitempty"` TotalHitCount uint32 `json:"total_hit_count"` HitsByTotalRisk map[int]int `json:"hits_by_total_risk"` Version types.Version `json:"cluster_version,omitempty"` }
ClusterListView represents a single item in the response for Clusters List view
type ClusterName ¶
type ClusterName = types.ClusterName
ClusterName is a rename for types.ClusterName
func GetClusterNames ¶
func GetClusterNames(clustersInfo []ClusterInfo) []ClusterName
GetClusterNames extract the ClusterName from an array of ClusterInfo
type ClusterOverview ¶
ClusterOverview type for handling the overview result for each cluster
type ClustersDetailData ¶
type ClustersDetailData struct { EnabledClusters []types.HittingClustersData `json:"enabled"` DisabledClusters []types.DisabledClusterInfo `json:"disabled"` }
ClustersDetailData is the inner data structure for /clusters_detail
type ClustersDetailResponse ¶
type ClustersDetailResponse struct { Data ClustersDetailData `json:"data"` Status string `json:"status"` }
ClustersDetailResponse is a data structure used as the response for /clusters_detail
type DataEngResponse ¶
type DataEngResponse struct { Recommended bool `json:"upgrade_recommended"` RisksPredictors UpgradeRisksPredictors `json:"upgrade_risks_predictors"` LastCheckedAt Timestamp `json:"last_checked_at"` }
DataEngResponse is the response received from the data-eng service
type ErrorKeyMetadataV1 ¶
type ErrorKeyMetadataV1 = types.ErrorKeyMetadataV1
ErrorKeyMetadataV1 is in RuleErrorKeyContentV1
type ErrorKeyMetadataV2 ¶
type ErrorKeyMetadataV2 = types.ErrorKeyMetadataV2
ErrorKeyMetadataV2 is in RuleErrorKeyContentV2
type ImpactingFlag ¶
type ImpactingFlag int
ImpactingFlag controls the behaviour of 'impacting' param on GET /rule/
type InfoResponse ¶
type InfoResponse struct { SmartProxy map[string]string `json:"SmartProxy"` Aggregator map[string]string `json:"Aggregator"` ContentService map[string]string `json:"ContentService"` }
InfoResponse is a data structure returned by /info REST API endpoint
type OperatorCondition ¶
type OperatorCondition struct { Name string `json:"name"` Condition string `json:"condition"` Reason string `json:"reason"` URL string `json:"url"` }
OperatorCondition data structure representing a single operator condition
type OrgOverviewResponse ¶
type OrgOverviewResponse struct { ClustersHit int `json:"clusters_hit"` ClustersHitByTotalRisk map[int]int `json:"hit_by_risk"` ClustersHitByTag map[string]int `json:"hit_by_tag"` }
OrgOverviewResponse serves as a the API response for /org_overview endpoint
type RecommendationContent ¶
type RecommendationContent struct { // RuleSelector = rule.module|ERROR_KEY format RuleSelector types.RuleSelector `json:"rule_id"` Description string `json:"description"` Generic string `json:"generic"` Reason string `json:"reason"` Resolution string `json:"resolution"` MoreInfo string `json:"more_info"` TotalRisk uint8 `json:"total_risk"` Impact uint8 `json:"impact"` Likelihood uint8 `json:"likelihood"` PublishDate time.Time `json:"publish_date"` Tags []string `json:"tags"` }
RecommendationContent is a rule content struct used for Insights Advisor,
type RecommendationContentUserData ¶
type RecommendationContentUserData struct { // RuleSelector = rule.module|ERROR_KEY format RuleSelector types.RuleSelector `json:"rule_id"` Description string `json:"description"` Generic string `json:"generic"` Reason string `json:"reason"` Resolution string `json:"resolution"` MoreInfo string `json:"more_info"` TotalRisk uint8 `json:"total_risk"` Impact uint8 `json:"impact"` Likelihood uint8 `json:"likelihood"` PublishDate time.Time `json:"publish_date"` Tags []string `json:"tags"` Rating types.UserVote `json:"rating"` AckedCount uint32 `json:"hosts_acked_count"` Disabled bool `json:"disabled"` ResolutionRisk uint8 `json:"resolution_risk"` }
RecommendationContentUserData is a rule content struct with additional Insights Advisor related user data, such as rule acknowledging or rating, which requires access to DB/aggregator
type RecommendationListView ¶
type RecommendationListView struct { // RuleID is in "|" format RuleID types.RuleID `json:"rule_id"` Description string `json:"description"` Generic string `json:"generic"` PublishDate time.Time `json:"publish_date"` TotalRisk uint8 `json:"total_risk"` ResolutionRisk uint8 `json:"resolution_risk"` Impact uint8 `json:"impact"` Likelihood uint8 `json:"likelihood"` Tags []string `json:"tags"` Disabled bool `json:"disabled"` ImpactedClustersCnt uint32 `json:"impacted_clusters_count"` }
RecommendationListView represents the API response for Advisor /rule/ related endpoints RuleStatus is based on acknowledgment table (enabled/disabled)
type ReportResponseMeta ¶
type ReportResponseMeta = types.ReportResponseMeta
ReportResponseMeta contains metadata about the report
type ReportResponseMetaV1 ¶
type ReportResponseMetaV1 struct { Count int `json:"count"` LastCheckedAt Timestamp `json:"last_checked_at"` }
ReportResponseMetaV1 contains metadata for /report endpoint in v1
type ReportResponseMetaV2 ¶
type ReportResponseMetaV2 struct { DisplayName string `json:"cluster_name"` Managed bool `json:"managed"` Count int `json:"count"` LastCheckedAt Timestamp `json:"last_checked_at,omitempty"` GatheredAt Timestamp `json:"gathered_at,omitempty"` }
ReportResponseMetaV2 contains metadata for /report endpoint in v2
type RequestID ¶
RequestID is used to store the request ID supplied in input Kafka records as a unique identifier of payloads. Empty string represents a missing request ID.
type RequestStatus ¶
type RequestStatus struct { RequestID string `json:"requestID" redis:"request_id"` Valid bool `json:"valid" redis:"-"` Received string `json:"received" redis:"received_timestamp"` Processed string `json:"processed" redis:"processed_timestamp"` }
RequestStatus contains description about one request ID returned by the sercice to IO
type RuleContent ¶
type RuleContent = types.RuleContent
RuleContent is a rename for types.RuleContent
type RuleContentV1 ¶
type RuleContentV1 = types.RuleContentV1
RuleContentV1 version 1 of RuleConted provided by smart proxy
type RuleContentV2 ¶
type RuleContentV2 = types.RuleContentV2
RuleContentV2 version 2 of RuleContent provided by smart proxy
type RuleErrorKeyContentV1 ¶
type RuleErrorKeyContentV1 = types.RuleErrorKeyContentV1
RuleErrorKeyContentV1 is in RuleContentV1
type RuleErrorKeyContentV2 ¶
type RuleErrorKeyContentV2 = types.RuleErrorKeyContentV2
RuleErrorKeyContentV2 is in RuleContentV2
type RuleRating ¶
type RuleRating = types.RuleRating
RuleRating structure with the rule identifier and the rating
type RuleWithContent ¶
type RuleWithContent struct { Module types.RuleID `json:"module"` Name string `json:"name"` Summary string `json:"summary"` Reason string `json:"reason"` Resolution string `json:"resolution"` MoreInfo string `json:"more_info"` ErrorKey types.ErrorKey `json:"error_key"` Description string `json:"description"` TotalRisk int `json:"total_risk"` ResolutionRisk int `json:"resolution_risk"` Impact int `json:"impact"` Likelihood int `json:"likelihood"` PublishDate time.Time `json:"publish_date"` Active bool `json:"active"` Internal bool `json:"internal"` Generic string `json:"generic"` Tags []string `json:"tags"` OSDCustomer bool `json:"osd_customer"` }
RuleWithContent structure with rule and rule content
type RuleWithContentResponse ¶
type RuleWithContentResponse struct { RuleID types.RuleID `json:"rule_id"` ErrorKey types.ErrorKey `json:"-"` CreatedAt string `json:"created_at"` Description string `json:"description"` Generic string `json:"details"` Reason string `json:"reason"` Resolution string `json:"resolution"` MoreInfo string `json:"more_info"` TotalRisk int `json:"total_risk"` Disabled bool `json:"disabled"` DisableFeedback string `json:"disable_feedback"` DisabledAt types.Timestamp `json:"disabled_at"` Internal bool `json:"internal"` UserVote types.UserVote `json:"user_vote"` TemplateData interface{} `json:"extra_data"` Tags []string `json:"tags"` Impacted Timestamp `json:"impacted,omitempty"` }
RuleWithContentResponse represents a single rule in the response of /report endpoint
type SimplifiedReport ¶
type SimplifiedReport types.SimplifiedReport
SimplifiedReport structure is used to handle single Request data hashes in Redis
type SimplifiedRuleHit ¶
type SimplifiedRuleHit struct { RuleFQDN string `json:"rule_fqdn"` ErrorKey string `json:"error_key"` Description string `json:"description"` TotalRisk int `json:"total_risk"` }
SimplifiedRuleHit structure represents one simplified rule hit for On Demand Data Gathering
type SmartProxyReport ¶
type SmartProxyReport struct { Meta types.ReportResponseMeta `json:"meta"` Data []RuleWithContentResponse `json:"data"` }
SmartProxyReport represents the response of /report (V2) endpoint for smart proxy
type SmartProxyReportV1 ¶
type SmartProxyReportV1 struct { Meta ReportResponseMetaV1 `json:"meta"` Data []RuleWithContentResponse `json:"data"` }
SmartProxyReportV1 represents the response of /report (V1) endpoint for smart proxy This structure exists to make sure we comply with the previous API used by some clients
type SmartProxyReportV2 ¶
type SmartProxyReportV2 struct { Meta ReportResponseMetaV2 `json:"meta"` Data []RuleWithContentResponse `json:"data"` }
SmartProxyReportV2 represents the response of /report (V2) endpoint for smart proxy This structure exists to make sure we comply with the previous API used by some clients
type UpgradeRecommendation ¶
type UpgradeRecommendation struct { Recommended bool `json:"upgrade_recommended"` RisksPredictors UpgradeRisksPredictors `json:"upgrade_risks_predictors"` }
UpgradeRecommendation is the inner data structure for the UpgradeRiskPredictionResponse
type UpgradeRisksMeta ¶
type UpgradeRisksMeta struct {
LastCheckedAt Timestamp `json:"last_checked_at"`
}
UpgradeRisksMeta is a data structure to store metainformation regarding the prediction
type UpgradeRisksPredictors ¶
type UpgradeRisksPredictors struct { Alerts []Alert `json:"alerts"` OperatorConditions []OperatorCondition `json:"operator_conditions"` }
UpgradeRisksPredictors data structure to store the predictors returned by the data engineering service