ocm

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 2, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LogLevelNone    = ""
	LogLevelDebug   = "Debug"
	LogLevelInfo    = "Info"
	LogLevelWarning = "Warning"
	LogLevelError   = "Error"
	LogLevelFatal   = "Fatal"
)
View Source
const (
	OrderNone = ""
	OrderAsc  = "ascending"
	OrderDesc = "descending"
)

Variables

This section is empty.

Functions

func LogEntryInternalOnly added in v0.2.0

func LogEntryInternalOnly(c *LogEntryConfig)

Types

type Addon

type Addon struct {
	// contains filtered or unexported fields
}

Addon wraps an 'ocm-sdk-go' AddOn object.

func NewAddon added in v0.2.2

func NewAddon(addon *cmv1.AddOn, opts ...AddonOption) Addon

func (*Addon) ID added in v0.2.2

func (a *Addon) ID() string

func (*Addon) Name added in v0.2.2

func (a *Addon) Name() string

func (*Addon) ProvideRowData added in v0.2.2

func (a *Addon) ProvideRowData() map[string]interface{}

func (*Addon) WithVersion added in v0.2.2

func (a *Addon) WithVersion(ctx context.Context) (*Addon, error)

type AddonConfig added in v0.2.2

type AddonConfig struct {
	Conn   *sdk.Connection
	Logger log.Interface
}

func (*AddonConfig) Default added in v0.2.2

func (c *AddonConfig) Default()

func (*AddonConfig) Option added in v0.2.2

func (c *AddonConfig) Option(opts ...AddonOption)

type AddonInstallation

type AddonInstallation struct {
	// contains filtered or unexported fields
}

AddonInstallation provides details of an AddonInstallation.

func NewAddonInstallation added in v0.3.3

func NewAddonInstallation(install *cmv1.AddOnInstallation, opts ...AddonInstallationOption) AddonInstallation

func (*AddonInstallation) ID added in v0.3.3

func (a *AddonInstallation) ID() string

func (*AddonInstallation) Name added in v0.3.3

func (a *AddonInstallation) Name() string

func (*AddonInstallation) ProvideRowData added in v0.2.2

func (a *AddonInstallation) ProvideRowData() map[string]interface{}

func (*AddonInstallation) State added in v0.3.3

func (a *AddonInstallation) State() string

type AddonInstallationConfig added in v0.3.3

type AddonInstallationConfig struct {
	Cluster *Cluster
	Addon   *Addon
}

func (*AddonInstallationConfig) Option added in v0.3.3

type AddonInstallationOption added in v0.3.3

type AddonInstallationOption interface {
	ConfigureAddonInstallation(*AddonInstallationConfig)
}

type AddonInstallations

type AddonInstallations []AddonInstallation

AddonInstallations wraps a slice of AddonInstallation objects.

func (AddonInstallations) Matching

func (installs AddonInstallations) Matching(pattern string) AddonInstallations

Matching filters the addons within an AddonInstallations object by only including addons whose name or id matches the supplied pattern.

type AddonOption added in v0.2.2

type AddonOption interface {
	ConfigureAddon(*AddonConfig)
}

type AddonPager

type AddonPager struct {
	// contains filtered or unexported fields
}

AddonPager retains state for paged addon requests and maintains a buffer of the last page of objects.

func RetrieveAddons

func RetrieveAddons(conn *sdk.Connection, logger log.Interface) (*AddonPager, error)

RetrieveAddons initializes a Pager which will request addons from OCM with a fixed page size.

func (*AddonPager) FindByIDs

func (p *AddonPager) FindByIDs(ids ...string) *AddonPager

FindByIDs uses the supplied addon IDs to filter the request to OCM and return only the addons which match.

func (*AddonPager) ForEach

func (p *AddonPager) ForEach(ctx context.Context, applyFunc func(*Addon) error) error

ForEach iterates over the addons requested by an Pager applying the provided function. If the iteration will stop with the first error returned by the provided function.

func (*AddonPager) NextPage

func (p *AddonPager) NextPage(ctx context.Context) ([]Addon, bool, error)

NextPage returns the next page of requested addons if there are any remaining. If no addons remain the second return value will be 'false'.

func (*AddonPager) Search

func (p *AddonPager) Search(query string) *AddonPager

Search filters the addons requested by a generic query string. See 'ocm-sdk-go' for more information on the SQL-like strings that are accepted.

func (*AddonPager) SearchByNameOrID

func (p *AddonPager) SearchByNameOrID(pattern string) *AddonPager

SearchByNameOrID filters the addons requested by a Pager for those whose 'name' or 'id' matches the supplied pattern.

type AddonParameter added in v0.2.2

type AddonParameter struct {
	// contains filtered or unexported fields
}

func (*AddonParameter) ProvideRowData added in v0.2.2

func (ap *AddonParameter) ProvideRowData() map[string]interface{}

type AddonRequirement added in v0.2.2

type AddonRequirement struct {
	// contains filtered or unexported fields
}

func (*AddonRequirement) ProvideRowData added in v0.2.2

func (ar *AddonRequirement) ProvideRowData() map[string]interface{}

type AddonSubOperator added in v0.2.2

type AddonSubOperator struct {
	// contains filtered or unexported fields
}

func (*AddonSubOperator) ProvideRowData added in v0.2.2

func (aso *AddonSubOperator) ProvideRowData() map[string]interface{}

type AddonVersion added in v0.2.2

type AddonVersion struct {
	// contains filtered or unexported fields
}

func (*AddonVersion) ProvideRowData added in v0.2.2

func (v *AddonVersion) ProvideRowData() map[string]interface{}

type Cluster

type Cluster struct {
	AddonInstallations AddonInstallations
	// contains filtered or unexported fields
}

Cluster wraps for 'ocm-sdk-go' Cluster objects.

func NewCluster added in v0.2.2

func NewCluster(cluster *cmv1.Cluster, opts ...ClusterOption) Cluster

func (*Cluster) ExternalID added in v0.2.2

func (c *Cluster) ExternalID() string

func (*Cluster) GetLogs

func (c *Cluster) GetLogs(ctx context.Context, opts GetLogsOptions) ([]LogEntry, error)

func (*Cluster) ID added in v0.2.2

func (c *Cluster) ID() string

func (*Cluster) Name added in v0.2.2

func (c *Cluster) Name() string

func (*Cluster) PostLog added in v0.2.0

func (c *Cluster) PostLog(ctx context.Context, opts ...LogEntryOption) error

func (*Cluster) ProductID

func (c *Cluster) ProductID() string

ProductID returns a string indicating the product type (OSD, ROSA, ARO, ...) and whether the cluster is of the Customer Cloud Subscription (CSS) Model.

func (*Cluster) ProvideRowData added in v0.2.2

func (c *Cluster) ProvideRowData() map[string]interface{}

func (*Cluster) WithAddonInstallations

func (c *Cluster) WithAddonInstallations(ctx context.Context) (*Cluster, error)

WithAddonInstallations attempts to retrieve and abstract information about installed addons on the cluster. Any failure to retrieve data will return an error.

func (*Cluster) WithSubscription

func (c *Cluster) WithSubscription(ctx context.Context) (*Cluster, error)

WithSubscription attempts to retrieve a subscription object corresponding to the subscription ID included with the cluster. If the subscription cannot be retrieved an error is returned.

type ClusterConfig added in v0.2.2

type ClusterConfig struct {
	Conn   *sdk.Connection
	Logger log.Interface
}

func (*ClusterConfig) Default added in v0.2.2

func (c *ClusterConfig) Default()

func (*ClusterConfig) Option added in v0.2.2

func (c *ClusterConfig) Option(opts ...ClusterOption)

type ClusterOption added in v0.2.2

type ClusterOption interface {
	ConfigureCluster(*ClusterConfig)
}

type ClusterPager

type ClusterPager struct {
	// contains filtered or unexported fields
}

ClusterPager retains state for paged cluster requests and maintains a buffer of the last page of objects.

func RetrieveClusters

func RetrieveClusters(conn *sdk.Connection, logger log.Interface) (*ClusterPager, error)

RetrieveClusters initializes a ClusterPager which will request clusters from OCM with a fixed page size.

func (*ClusterPager) ForEach

func (p *ClusterPager) ForEach(ctx context.Context, applyFunc func(*Cluster) error) error

ForEach iterates over the clusters requested by an ClusterPager applying the provided function. If the iteration will stop with the first error returned by the provided function.

func (*ClusterPager) NextPage

func (p *ClusterPager) NextPage(ctx context.Context) ([]Cluster, bool, error)

NextPage returns the next page of requested clusters if there are any remaining. If no clusters remain the second return value will be 'false'.

func (*ClusterPager) Search

func (p *ClusterPager) Search(query string) *ClusterPager

Search filters the clusters requested by a generic query string. See 'ocm-sdk-go' for more information on the SQL-like strings that are accepted.

func (*ClusterPager) SearchByNameOrID

func (p *ClusterPager) SearchByNameOrID(pattern string) *ClusterPager

SearchByNameOrID filters the clusters requested by an ClusterPager for those whose 'name', 'id', or 'external_id' matches the supplied pattern.

type CredentialRequest added in v0.3.2

type CredentialRequest struct {
	// contains filtered or unexported fields
}

func (*CredentialRequest) ProvideRowData added in v0.3.2

func (cr *CredentialRequest) ProvideRowData() map[string]interface{}

type GetLogsOption

type GetLogsOption func(*GetLogsOptions)

func GetLogsAfter

func GetLogsAfter(t time.Time) GetLogsOption

func GetLogsBefore

func GetLogsBefore(t time.Time) GetLogsOption

func GetLogsMatchingPattern

func GetLogsMatchingPattern(p string) GetLogsOption

func GetLogsSorted

func GetLogsSorted(s LogEntrySortFunc) GetLogsOption

func GetLogsWithLevel

func GetLogsWithLevel(l LogLevel) GetLogsOption

type GetLogsOptions

type GetLogsOptions struct {
	// contains filtered or unexported fields
}

func NewGetLogsOptions

func NewGetLogsOptions(opts ...GetLogsOption) GetLogsOptions

func (GetLogsOptions) Query

func (g GetLogsOptions) Query() string

type LogEntry

type LogEntry struct {
	Entry *slv1.LogEntry
}

func NewLogEntry added in v0.2.0

func NewLogEntry(cluster *Cluster, opts ...LogEntryOption) (LogEntry, error)

func (*LogEntry) ProvideRowData added in v0.2.2

func (l *LogEntry) ProvideRowData() map[string]interface{}

type LogEntryConfig added in v0.2.0

type LogEntryConfig struct {
	Description  string
	InternalOnly bool
	ServiceName  string
	Severity     string
	Summary      string
}

type LogEntryOption added in v0.2.0

type LogEntryOption func(*LogEntryConfig)

func LogEntryDescription added in v0.2.0

func LogEntryDescription(desc string) LogEntryOption

func LogEntryServiceName added in v0.2.0

func LogEntryServiceName(name string) LogEntryOption

func LogEntrySeverity added in v0.2.0

func LogEntrySeverity(sev string) LogEntryOption

func LogEntrySummary added in v0.2.0

func LogEntrySummary(sum string) LogEntryOption

type LogEntrySortFunc

type LogEntrySortFunc func(LogEntry, LogEntry) bool

func LogEntryByTime

func LogEntryByTime(ord Order) LogEntrySortFunc

type LogEntrySorter

type LogEntrySorter struct {
	// contains filtered or unexported fields
}

func NewLogEntrySorter

func NewLogEntrySorter(size int, sortFunc LogEntrySortFunc) *LogEntrySorter

func (*LogEntrySorter) Append

func (s *LogEntrySorter) Append(e LogEntry)

func (*LogEntrySorter) Entries

func (s *LogEntrySorter) Entries() []LogEntry

func (*LogEntrySorter) Len

func (s *LogEntrySorter) Len() int

func (*LogEntrySorter) Less

func (s *LogEntrySorter) Less(i, j int) bool

func (*LogEntrySorter) Swap

func (s *LogEntrySorter) Swap(i, j int)

type LogLevel

type LogLevel string

type Order

type Order string

type Subscription

type Subscription struct {
	// contains filtered or unexported fields
}

Subscription wraps an 'ocm-sdk-go' Subscription object.

func (*Subscription) ProvideRowData added in v0.2.2

func (s *Subscription) ProvideRowData() map[string]interface{}

type WithAddon added in v0.3.3

type WithAddon struct{ *Addon }

func (WithAddon) ConfigureAddonInstallation added in v0.3.3

func (a WithAddon) ConfigureAddonInstallation(c *AddonInstallationConfig)

type WithCluster added in v0.3.3

type WithCluster struct{ *Cluster }

func (WithCluster) ConfigureAddonInstallation added in v0.3.3

func (cl WithCluster) ConfigureAddonInstallation(c *AddonInstallationConfig)

type WithConnection added in v0.2.2

type WithConnection struct{ *sdk.Connection }

func (WithConnection) ConfigureAddon added in v0.2.2

func (wc WithConnection) ConfigureAddon(c *AddonConfig)

func (WithConnection) ConfigureCluster added in v0.2.2

func (wc WithConnection) ConfigureCluster(c *ClusterConfig)

type WithLogger added in v0.2.2

type WithLogger struct {
	Logger log.Interface
}

func (WithLogger) ConfigureAddon added in v0.2.2

func (wl WithLogger) ConfigureAddon(c *AddonConfig)

func (WithLogger) ConfigureCluster added in v0.2.2

func (wl WithLogger) ConfigureCluster(c *ClusterConfig)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL