Documentation
¶
Index ¶
- func ApplyAuthToken(cfg *ocmconfig.Config, token string)
- func AuthenticateAsync(cfg *ocmconfig.Config) (string, error)
- func CheckTokens() (*ocmconfig.Config, bool, error)
- type Client
- func (c *Client) Close()
- func (c *Client) GetCluster(ctx context.Context, key string) (*ClusterInfo, error)
- func (c *Client) GetLimitedSupportHistory(ctx context.Context, clusterID string) ([]LimitedSupportReason, error)
- func (c *Client) GetServiceLogs(ctx context.Context, clusterID, externalID string) ([]ServiceLog, error)
- type ClusterInfo
- type LimitedSupportReason
- type MockClient
- func (m *MockClient) Close()
- func (m *MockClient) GetCluster(_ context.Context, clusterID string) (*ClusterInfo, error)
- func (m *MockClient) GetLimitedSupportHistory(_ context.Context, clusterID string) ([]LimitedSupportReason, error)
- func (m *MockClient) GetServiceLogs(_ context.Context, clusterID, _ string) ([]ServiceLog, error)
- type OCMClient
- type ServiceLog
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyAuthToken ¶ added in v1.3.0
ApplyAuthToken classifies a raw auth token and sets the appropriate field on the OCM config (RefreshToken or AccessToken).
func AuthenticateAsync ¶ added in v1.3.0
AuthenticateAsync performs browser-based auth code login. This call blocks until the user completes authentication in the browser. Returns the raw auth token string on success.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client wraps the OCM SDK connection for cluster enrichment.
func NewClient ¶
NewClient creates a real OCM client using the standard config file. Always connects to production OCM. If no valid tokens exist, initiates browser-based auth code login (same flow as ocm-container).
func NewClientFromConfig ¶ added in v1.3.0
NewClientFromConfig builds an OCM client from a pre-loaded config. The config must already have valid tokens set.
func (*Client) GetCluster ¶
func (*Client) GetLimitedSupportHistory ¶
func (*Client) GetServiceLogs ¶
type ClusterInfo ¶
type ClusterInfo struct {
ID string
ExternalID string
Name string
DisplayName string
State string
Region string
CloudProvider string
Version string
Hypershift bool
CCS bool
Organization string
}
ClusterInfo contains enriched cluster data from the OCM API.
type LimitedSupportReason ¶
type LimitedSupportReason struct {
ID string
Summary string
Details string
DetectionType string
CreatedAt string
}
LimitedSupportReason represents a limited support reason entry.
type MockClient ¶
type MockClient struct {
Clusters map[string]*ClusterInfo
ServiceLogs map[string][]ServiceLog
LimitedSupport map[string][]LimitedSupportReason
}
MockClient implements OCMClient for testing and dev mode.
func LoadMockClientFromFixtures ¶
func LoadMockClientFromFixtures(dir string) (*MockClient, error)
LoadMockClientFromFixtures creates a MockClient populated with data from fixture files.
func NewMockClient ¶
func NewMockClient() *MockClient
NewMockClient creates a MockClient with initialized maps.
func (*MockClient) Close ¶
func (m *MockClient) Close()
func (*MockClient) GetCluster ¶
func (m *MockClient) GetCluster(_ context.Context, clusterID string) (*ClusterInfo, error)
func (*MockClient) GetLimitedSupportHistory ¶
func (m *MockClient) GetLimitedSupportHistory(_ context.Context, clusterID string) ([]LimitedSupportReason, error)
func (*MockClient) GetServiceLogs ¶
func (m *MockClient) GetServiceLogs(_ context.Context, clusterID, _ string) ([]ServiceLog, error)
type OCMClient ¶
type OCMClient interface {
GetCluster(ctx context.Context, clusterID string) (*ClusterInfo, error)
GetServiceLogs(ctx context.Context, clusterID, externalID string) ([]ServiceLog, error)
GetLimitedSupportHistory(ctx context.Context, clusterID string) ([]LimitedSupportReason, error)
Close()
}
OCMClient defines the interface for OCM API operations.