Documentation
¶
Index ¶
- Constants
- Variables
- func CheckServiceLogsLastHour(ocmClient *sdk.Connection, clusterID string) bool
- func FetchServiceLogs(ocmClient *sdk.Connection, clusterID string, allMessages bool, ...) (*v1.ClustersClusterLogsListResponse, error)
- func GetServiceLogsSince(ocmClient *sdk.Connection, clusterID string, timeSince time.Time, ...) ([]*v1.LogEntry, error)
- func Post(ocmClient *sdk.Connection, cluster *cmv1.Cluster, req PostRequest) error
- func PostMessage(ocmClient *sdk.Connection, cluster *cmv1.Cluster, msg Message) error
- type Message
- type PostRequest
Constants ¶
const InternalOnlyTemplate = `` /* 149-byte string literal not displayed */
InternalOnlyTemplate is the fixed JSON template used for internal-only service logs (the -i flag in the CLI).
Variables ¶
var ErrDeclined = errors.New("service log not sent: user declined")
Functions ¶
func CheckServiceLogsLastHour ¶
func CheckServiceLogsLastHour(ocmClient *sdk.Connection, clusterID string) bool
checkServiceLogsLastHour returns true if there were service logs sent in the past hour, printing warnings for each one found.
func FetchServiceLogs ¶
func FetchServiceLogs(ocmClient *sdk.Connection, clusterID string, allMessages bool, internalOnly bool) (*v1.ClustersClusterLogsListResponse, error)
FetchServiceLogs retrieves all service logs for a cluster.
func GetServiceLogsSince ¶
func GetServiceLogsSince(ocmClient *sdk.Connection, clusterID string, timeSince time.Time, allMessages bool, internalOnly bool) ([]*v1.LogEntry, error)
GetServiceLogsSince returns the service logs for a cluster sent since the given time.
func Post ¶
func Post(ocmClient *sdk.Connection, cluster *cmv1.Cluster, req PostRequest) error
Post sends a service log to a cluster from a template. It handles the full pipeline: template loading, parameter substitution, link validation, user confirmation, and HTTP POST. It always runs an interactive confirmation flow. For non-interactive sends (e.g. batch operations that confirm upfront), use Prepare + PostMessage directly.
func PostMessage ¶
PostMessage posts a pre-built Message to a cluster. It sets cluster-specific fields (ClusterUUID, ClusterID, SubscriptionID) and sends the HTTP request. No template loading or prompting.
Types ¶
type Message ¶
type Message struct {
Severity string `json:"severity"`
ServiceName string `json:"service_name"`
ClusterUUID string `json:"cluster_uuid,omitempty"`
ClusterID string `json:"cluster_id,omitempty"`
Summary string `json:"summary"`
Description string `json:"description"`
InternalOnly bool `json:"internal_only"`
EventStreamID string `json:"event_stream_id"`
SubscriptionID string `json:"subscription_id,omitempty"`
DocReferences []string `json:"doc_references"`
}
func Prepare ¶
func Prepare(req PostRequest) (Message, error)
Prepare loads a template, substitutes parameters, and validates links, returning a Message ready for PostMessage. Use this to prepare once and send to multiple clusters without re-fetching the template.