ocm

package
v0.0.0-...-96040f1 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package ocm contains ocm api related functions

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Location

func Location() (path string, err error)

Location returns the location of the configuration file. If a configuration file already exists in the HOME directory, it uses that, otherwise it prefers to use the XDG config directory.

Types

type Client

type Client interface {
	GetClusterMachinePools(internalClusterID string) ([]*cmv1.MachinePool, error)
	PostLimitedSupportReason(limitedSupportReason LimitedSupportReason, internalClusterID string) error
	GetSupportRoleARN(internalClusterID string) (string, error)
	GetServiceLog(cluster *cmv1.Cluster, filter string) (*servicelogsv1.ClusterLogsUUIDListResponse, error)
	PostServiceLog(clusterID string, sl *ServiceLog) error
	AwsClassicJumpRoleCompatible(cluster *cmv1.Cluster) (bool, error)
	GetConnection() *sdk.Connection
}

Client is the interface exposing OCM related functions

type Config

type Config struct {
	// TODO(efried): Better docs for things like AccessToken
	// TODO(efried): Dedup with flag docs in cmd/ocm/login/cmd.go:init where possible
	AccessToken  string   `json:"access_token,omitempty" doc:"Bearer access token."`
	ClientID     string   `json:"client_id,omitempty" doc:"OpenID client identifier."`
	ClientSecret string   `json:"client_secret,omitempty" doc:"OpenID client secret."`
	Insecure     bool     `` /* 142-byte string literal not displayed */
	Password     string   `json:"password,omitempty" doc:"User password."`
	RefreshToken string   `json:"refresh_token,omitempty" doc:"Offline or refresh token."`
	Scopes       []string `` /* 172-byte string literal not displayed */
	TokenURL     string   `json:"token_url,omitempty" doc:"OpenID token URL."`
	URL          string   `` /* 162-byte string literal not displayed */
	User         string   `json:"user,omitempty" doc:"User name."`
	Pager        string   `json:"pager,omitempty" doc:"Pager command, for example 'less'. If empty no pager will be used."`
}

Config is the type used to store the configuration of the client. There's no way to line-split or predefine tags, so...

func Load

func Load() (cfg *Config, err error)

Load loads the configuration from the configuration file. If the configuration file doesn't exist it will return an empty configuration object.

func (*Config) Connection

func (c *Config) Connection() (connection *sdk.Connection, err error)

Connection creates a connection using this configuration.

type LimitedSupportReason

type LimitedSupportReason struct {
	Details string
	Summary string
}

LimitedSupportReason is the internal representation of a limited support reason

type SdkClient

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

SdkClient is the ocm client with which we can run the commands currently we do not need to export the connection or the config, as we create the SdkClient using the New func

func New

func New(ocmConfigFile string) (*SdkClient, error)

New will create a new ocm client by using the path to a config file if no path is provided, it will assume it in the default path

func (*SdkClient) AwsClassicJumpRoleCompatible

func (c *SdkClient) AwsClassicJumpRoleCompatible(cluster *cmv1.Cluster) (bool, error)

AwsClassicJumpRoleCompatible check whether or not the CAD jumprole path is supported by the cluster

func (*SdkClient) GetAWSAccountClaim

func (c *SdkClient) GetAWSAccountClaim(internalClusterID string) (*awsv1alpha1.AccountClaim, error)

GetAWSAccountClaim gets the AWS Account Claim object for a given cluster

func (*SdkClient) GetClusterDeployment

func (c *SdkClient) GetClusterDeployment(internalClusterID string) (*hivev1.ClusterDeployment, error)

GetClusterDeployment gets the ClusterDeployment object for a given cluster

func (*SdkClient) GetClusterInfo

func (c *SdkClient) GetClusterInfo(identifier string) (*cmv1.Cluster, error)

GetClusterInfo returns cluster information from ocm by using either internal, external id or the cluster name Returns a v1.Cluster object or an error

func (*SdkClient) GetClusterMachinePools

func (c *SdkClient) GetClusterMachinePools(internalClusterID string) ([]*cmv1.MachinePool, error)

GetClusterMachinePools get the machine pools for a given cluster

func (*SdkClient) GetConnection

func (c *SdkClient) GetConnection() *sdk.Connection

GetConnection returns the active connection of the SdkClient

func (*SdkClient) GetServiceLog

func (c *SdkClient) GetServiceLog(cluster *cmv1.Cluster, filter string) (*servicelogsv1.ClusterLogsUUIDListResponse, error)

GetServiceLog returns all ServiceLogs for a cluster. When supplying a filter it will use the Search call and pass it to this one directly.

func (*SdkClient) GetSupportRoleARN

func (c *SdkClient) GetSupportRoleARN(internalClusterID string) (string, error)

GetSupportRoleARN returns the support role ARN that allows the access to the cluster from internal cluster ID

func (*SdkClient) PostLimitedSupportReason

func (c *SdkClient) PostLimitedSupportReason(limitedSupportReason LimitedSupportReason, internalClusterID string) error

PostLimitedSupportReason allows to post a generic limited support reason to a cluster

func (*SdkClient) PostServiceLog

func (c *SdkClient) PostServiceLog(clusterID string, sl *ServiceLog) error

PostServiceLog allows to send a generic servicelog to a cluster.

type ServiceLog

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

ServiceLog is the internal representation of a service log

Directories

Path Synopsis
Package ocmmock is a generated GoMock package.
Package ocmmock is a generated GoMock package.

Jump to

Keyboard shortcuts

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