client

package
v0.0.0-...-2caf503 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2023 License: Apache-2.0 Imports: 30 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// DefaultTimeout is the standard request timeout applied if not specified.
	DefaultTimeout = 10 * time.Second
)
View Source
var NotAuthorizedError = &microerror.Error{
	Kind: "NotAuthorizedError",
}

NotAuthorizedError is used when an API request got a 401 response.

View Source
var ParseError = &microerror.Error{
	Kind: "ParseError",
}

ParseError is used when the client had a problem parsing something.

Functions

func HandleErrors

func HandleErrors(err error)

HandleErrors handles the errors known to this package. Handling normally means printing a user-readable error message and exiting with code 1. If the given error is not recognized, the function returns without action.

func IsClientNotInitializedError

func IsClientNotInitializedError(err error) bool

IsClientNotInitializedError asserts clientNotInitializedError.

func IsEndpointInvalidError

func IsEndpointInvalidError(err error) bool

IsEndpointInvalidError asserts endpointInvalidError.

func IsEndpointNotSpecifiedError

func IsEndpointNotSpecifiedError(err error) bool

IsEndpointNotSpecifiedError asserts endpointNotSpecifiedError.

func IsNotAuthorizedError

func IsNotAuthorizedError(err error) bool

IsNotAuthorizedError asserts NotAuthorizedError.

func IsParseError

func IsParseError(err error) bool

IsParseError asserts ParseError.

Types

type AuxiliaryParams

type AuxiliaryParams struct {
	CommandLine  string
	RequestID    string
	ActivityName string
	Timeout      time.Duration
}

AuxiliaryParams are parameters that can be passed to API calls optionally.

type ClusterStatus

type ClusterStatus struct {
	Cluster *v1alpha1.StatusCluster `json:"cluster,omitempty"`
}

ClusterStatus is a type we use to unmarshal a cluster status JSON response from the API. Note: this is scarce, leaving out many available details.

type Configuration

type Configuration struct {
	// AuthHeaderGetter is a function that returns the header we should use to make API calls.
	AuthHeaderGetter func() (string, error)

	// Endpoint is the base URL of the API.
	Endpoint string

	// Timeout is the maximum time to wait for API requests to succeed.
	Timeout time.Duration

	// UserAgent identifier
	UserAgent string

	// ActivityName identifies the user action through the according header.
	ActivityName string
}

Configuration is the client configuration

type Wrapper

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

Wrapper is the structure holding representing our latest API client.

func New

func New(conf *Configuration) (*Wrapper, error)

New creates a client based on the latest gsclientgen version.

func NewWithConfig

func NewWithConfig(endpointString, token string) (*Wrapper, error)

NewWithConfig creates a new client wrapper for a certain endpoint, optionally using a certain auth token.

func (*Wrapper) CreateApp

func (w *Wrapper) CreateApp(clusterID string, appName string, addAppRequest *models.V4CreateAppRequest, p *AuxiliaryParams) (*apps.CreateClusterAppV4OK, error)

CreateApp creates an App in a cluster.

func (*Wrapper) CreateAuthToken

func (w *Wrapper) CreateAuthToken(email, password string, p *AuxiliaryParams) (*auth_tokens.CreateAuthTokenOK, error)

CreateAuthToken creates an auth token using the gsclientgen client.

func (*Wrapper) CreateClusterV4

func (w *Wrapper) CreateClusterV4(addClusterRequest *models.V4AddClusterRequest, p *AuxiliaryParams) (*clusters.AddClusterCreated, error)

CreateClusterV4 creates a v4 cluster using the gsclientgen client.

func (*Wrapper) CreateClusterV5

func (w *Wrapper) CreateClusterV5(addClusterRequest *models.V5AddClusterRequest, p *AuxiliaryParams) (*clusters.AddClusterV5Created, error)

CreateClusterV5 creates a V5 cluster using the gsclientgen client.

func (*Wrapper) CreateKeyPair

func (w *Wrapper) CreateKeyPair(clusterID string, addKeyPairRequest *models.V4AddKeyPairRequest, p *AuxiliaryParams) (*key_pairs.AddKeyPairOK, error)

CreateKeyPair calls the addKeyPair API operation using the gsclientgen client.

func (*Wrapper) CreateNodePool

func (w *Wrapper) CreateNodePool(clusterID string, addNodePoolRequest *models.V5AddNodePoolRequest, p *AuxiliaryParams) (*node_pools.AddNodePoolCreated, error)

CreateNodePool creates a node pool.

func (*Wrapper) DefaultAuxiliaryParams

func (w *Wrapper) DefaultAuxiliaryParams() *AuxiliaryParams

DefaultAuxiliaryParams returns a partially pre-populated AuxiliaryParams object.

func (*Wrapper) DeleteApp

func (w *Wrapper) DeleteApp(clusterID string, appName string, p *AuxiliaryParams) (*apps.DeleteClusterAppV4OK, error)

DeleteApp deletes an app using the gsclientgen client.

func (*Wrapper) DeleteAuthToken

func (w *Wrapper) DeleteAuthToken(authToken string, p *AuxiliaryParams) (*auth_tokens.DeleteAuthTokenOK, error)

DeleteAuthToken calls the API's deleteAuthToken operation using the gsclientgen client.

func (*Wrapper) DeleteCluster

func (w *Wrapper) DeleteCluster(clusterID string, p *AuxiliaryParams) (*clusters.DeleteClusterAccepted, error)

DeleteCluster deletes a cluster using the gsclientgen client.

func (*Wrapper) DeleteNodePool

func (w *Wrapper) DeleteNodePool(clusterID, nodePoolID string, p *AuxiliaryParams) (*node_pools.DeleteNodePoolAccepted, error)

DeleteNodePool deletes a node pool.

func (*Wrapper) GetApp

func (w *Wrapper) GetApp(clusterID string, appName string, p *AuxiliaryParams) (*models.V4GetClusterAppsResponseItems, error)

GetApp fetches details on a cluster using the gsclientgen client.

func (*Wrapper) GetAppStatus

func (w *Wrapper) GetAppStatus(clusterID string, appName string, p *AuxiliaryParams) (string, error)

GetAppStatus fetches details on a cluster using the gsclientgen client.

func (*Wrapper) GetClusterStatus

func (w *Wrapper) GetClusterStatus(clusterID string, p *AuxiliaryParams) (*ClusterStatus, error)

GetClusterStatus fetches details on a cluster using the gsclientgen client.

func (*Wrapper) GetClusterV4

func (w *Wrapper) GetClusterV4(clusterID string, p *AuxiliaryParams) (*clusters.GetClusterOK, error)

GetClusterV4 fetches details on a V4 cluster.

func (*Wrapper) GetClusterV5

func (w *Wrapper) GetClusterV5(clusterID string, p *AuxiliaryParams) (*clusters.GetClusterV5OK, error)

GetClusterV5 fetches details on a V5 cluster.

func (*Wrapper) GetClusters

func (w *Wrapper) GetClusters(p *AuxiliaryParams) (*clusters.GetClustersOK, error)

GetClusters fetches a list of clusters using the gsclientgen client.

func (*Wrapper) GetClustersByLabel

GetClustersByLabel fetches a list of clusters based on a label selector using the gsclientgen client.

func (*Wrapper) GetConfiguration

func (w *Wrapper) GetConfiguration() *Configuration

GetConfiguration returns the client wrapper's configuration, e. g. for debugging purposes.

func (*Wrapper) GetCredential

func (w *Wrapper) GetCredential(organizationID string, credentialID string, p *AuxiliaryParams) (*organizations.GetCredentialOK, error)

GetCredential calls the API's getCredential operation using the gsclientgen client.

func (*Wrapper) GetDefaultCluster

func (w *Wrapper) GetDefaultCluster(p *AuxiliaryParams) (string, error)

GetDefaultCluster determines which is the default cluster. If only one cluster exists, the default cluster is the only cluster.

func (*Wrapper) GetInfo

func (w *Wrapper) GetInfo(p *AuxiliaryParams) (*info.GetInfoOK, error)

GetInfo calls the API's getInfo operation using the gsclientgen client.

func (*Wrapper) GetKeyPairs

func (w *Wrapper) GetKeyPairs(clusterID string, p *AuxiliaryParams) (*key_pairs.GetKeyPairsOK, error)

GetKeyPairs calls the API to fetch key pairs using the gsclientgen client.

func (*Wrapper) GetNodePool

func (w *Wrapper) GetNodePool(clusterID, nodePoolID string, p *AuxiliaryParams) (*node_pools.GetNodePoolOK, error)

GetNodePool fetches a node pool.

func (*Wrapper) GetNodePools

func (w *Wrapper) GetNodePools(clusterID string, p *AuxiliaryParams) (*node_pools.GetNodePoolsOK, error)

GetNodePools fetches a list of node pools.

func (*Wrapper) GetOrganizations

func (w *Wrapper) GetOrganizations(p *AuxiliaryParams) (*organizations.GetOrganizationsOK, error)

GetOrganizations calls the API's getOrganizations operation using the gsclientgen client.

func (*Wrapper) GetReleases

func (w *Wrapper) GetReleases(p *AuxiliaryParams) (*releases.GetReleasesOK, error)

GetReleases calls the API's getReleases operation using the gsclientgen client.

func (*Wrapper) ModifyApp

func (w *Wrapper) ModifyApp(clusterID string, appName string, body *models.V4ModifyAppRequest, p *AuxiliaryParams) (*apps.ModifyClusterAppV4OK, error)

ModifyApp modifies an app using the gsclientgen client.

func (*Wrapper) ModifyClusterV4

func (w *Wrapper) ModifyClusterV4(clusterID string, body *models.V4ModifyClusterRequest, p *AuxiliaryParams) (*clusters.ModifyClusterOK, error)

ModifyClusterV4 modifies a cluster using the gsclientgen client.

func (*Wrapper) ModifyClusterV5

func (w *Wrapper) ModifyClusterV5(clusterID string, body *models.V5ModifyClusterRequest, p *AuxiliaryParams) (*clusters.ModifyClusterV5OK, error)

ModifyClusterV5 modifies a V5 cluster.

func (*Wrapper) ModifyNodePool

func (w *Wrapper) ModifyNodePool(clusterID, nodePoolID string, modifyNodePoolRequest *models.V5ModifyNodePoolRequest, p *AuxiliaryParams) (*node_pools.ModifyNodePoolOK, error)

ModifyNodePool modifies a node pool.

func (*Wrapper) SetCredentials

func (w *Wrapper) SetCredentials(organizationID string, addCredentialsRequest *models.V4AddCredentialsRequest, p *AuxiliaryParams) (*organizations.AddCredentialsCreated, error)

SetCredentials calls the API's addCredentials operation of an organization.

func (*Wrapper) UpdateClusterLabels

func (w *Wrapper) UpdateClusterLabels(clusterID string, body *models.V5SetClusterLabelsRequest, p *AuxiliaryParams) (*cluster_labels.SetClusterLabelsOK, error)

UpdateClusterLabels updates labels of a cluster

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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