cleura

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2024 License: MPL-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const HostURL string = "https://rest.cleura.cloud"

HostURL - Default Cleura API Endpoint prefix.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdvertisedAddress

type AdvertisedAddress struct {
	Name string `json:"name"`
	Url  string `json:"url"`
}

type AuthRequestTwoFactor

type AuthRequestTwoFactor struct {
	Request2FA AuthRequestTwoFactorDetails `json:"request2fa"`
}

type AuthRequestTwoFactorDetails

type AuthRequestTwoFactorDetails struct {
	Login        string `json:"login"`
	Verification string `json:"verification"`
}

type AuthResponse

type AuthResponse struct {
	Result string `json:"result"`
	Token  string `json:"token"`
}

AuthResponse.

type AuthStruct

type AuthStruct struct {
	Username         string `json:"login"`
	Password         string `json:"password"`
	TwoFactorMethod  string `json:"twofa_method,omitempty"`
	VerificationCode string `json:"verification,omitempty"`
}

AuthStruct.

type AuthStructWrapper

type AuthStructWrapper struct {
	Auth AuthStruct `json:"auth"`
}

AuthStruct Wrapper.

type AuthVerificationResult

type AuthVerificationResult struct {
	Result       string `json:"result"`
	Type         string `json:"type"`
	Verification string `json:"verification"`
}

AuthVerificationResult.

type AuthVerifyTwoFactor

type AuthVerifyTwoFactor struct {
	Verify2FA AuthVerifyTwoFactorDetails `json:"verify2fa"`
}

type AuthVerifyTwoFactorDetails

type AuthVerifyTwoFactorDetails struct {
	Login        string `json:"login"`
	Verification string `json:"verification"`
	Code         int    `json:"code"`
}

type CPKubernetes added in v0.0.6

type CPKubernetes struct {
	Versions []CPVersion `json:"versions"`
}

type CPMachineImage added in v0.0.6

type CPMachineImage struct {
	Name     string      `json:"name"`
	Versions []CPVersion `json:"versions"`
}

type CPMachineType added in v0.0.6

type CPMachineType struct {
	Cpu          string `json:"cpu"`
	Gpu          string `json:"gpu"`
	Memory       string `json:"memory"`
	Name         string `json:"name"`
	Usable       bool   `json:"usable"`
	Architecture string `json:"architecture"`
}

type CPVersion added in v0.0.6

type CPVersion struct {
	Version        string `json:"version"`
	ExpirationDate string `json:"expirationDate"`
	Classification string `json:"classification"`
}

type Client

type Client struct {
	HostURL    string
	HTTPClient *http.Client
	Token      string
	Auth       AuthStruct
}

Client.

func NewClient

func NewClient(host, username, password *string, twoFactorAuthEnabled bool) (*Client, error)

NewClient.

func NewClientNoPassword

func NewClientNoPassword(host, username, token *string) (*Client, error)

func (*Client) AddWorkerGroup

func (c *Client) AddWorkerGroup(clusterName string, clusterRegion string, clusterProject string, workerGroupRequest WorkerGroupRequest) (*ShootClusterResponse, error)

func (*Client) CreateShootCluster

func (c *Client) CreateShootCluster(clusterRegion string, clusterProject string, shootClusterRequest ShootClusterRequest) (*ShootClusterCreateResponse, error)

func (*Client) DeleteShootCluster

func (c *Client) DeleteShootCluster(clusterName string, clusterRegion string, clusterProject string) (string, error)

func (*Client) DeleteWorkerGroup

func (c *Client) DeleteWorkerGroup(clusterName string, clusterRegion string, clusterProject string, workerName string) (*ShootClusterResponse, error)

func (*Client) GenerateKubeConfig

func (c *Client) GenerateKubeConfig(clusterRegion string, clusterProject string, clusterName string, durationSeconds int64) ([]byte, error)

func (*Client) GetCloudProfile added in v0.0.6

func (c *Client) GetCloudProfile() (*CloudProfile, error)

Get Cloud Profile Data. This can be used get available kubernetes versions,machine types and images suitable for specification in shoot clusters/ worker groups.

func (*Client) GetShootCluster

func (c *Client) GetShootCluster(clusterName string, clusterRegion string, clusterProject string) (*ShootClusterResponse, error)

func (*Client) GetToken

func (c *Client) GetToken() (*AuthResponse, error)

GetToken - Get a new token for the user.

func (*Client) GetTokenWith2FA

func (c *Client) GetTokenWith2FA(twoFACodeFromSms int) error

Issue token request with two-factor code received via sms.

func (*Client) HibernateCluster added in v0.0.4

func (c *Client) HibernateCluster(clusterRegion string, clusterProject string, clusterName string) error

Hibernate.

func (*Client) ListDomains

func (c *Client) ListDomains() (*[]OpenstackDomain, error)

func (*Client) ListProjects

func (c *Client) ListProjects(domain_id string) (*[]OpenstackProject, error)

func (*Client) ListShootClusters

func (c *Client) ListShootClusters(clusterRegion string, clusterProject string) ([]ShootClusterResponse, error)

func (*Client) Request2FactorCode

func (c *Client) Request2FactorCode() error

Request verification code if 2-factor auth is enabled.

func (*Client) RevokeToken

func (c *Client) RevokeToken() error

RevokeToken - Revoke client token.

func (*Client) UpdateShootCluster

func (c *Client) UpdateShootCluster(clusterRegion string, clusterProject string, clusterName string, shootClusterUpdateRequest ShootClusterRequest) (*ShootClusterResponse, error)

func (*Client) UpdateWorkerGroup

func (c *Client) UpdateWorkerGroup(clusterName string, clusterRegion string, clusterProject string, workerName string, workerGroupRequest WorkerGroupRequest) (*ShootClusterResponse, error)

func (*Client) ValidateToken

func (c *Client) ValidateToken() error

Validate client token.

func (*Client) WakeUpCluster added in v0.0.4

func (c *Client) WakeUpCluster(clusterRegion string, clusterProject string, clusterName string) error

Wake up call.

type CloudProfile added in v0.0.6

type CloudProfile struct {
	Name string           `json:"name"`
	Spec CloudProfileSpec `json:"spec"`
}

type CloudProfileSpec added in v0.0.6

type CloudProfileSpec struct {
	Kubernetes    CPKubernetes     `json:"kubernetes"`
	MachineImages []CPMachineImage `json:"machineImages"`
	MachineTypes  []CPMachineType  `json:"machineTypes"`
}

type Condition

type Condition struct {
	Type    string `json:"type"`
	Status  string `json:"status"`
	Message string `json:"message"`
}

type HibernationDetails

type HibernationDetails struct {
	Enabled                      bool                          `json:"enabled"`
	HibernationResponseSchedules []HibernationResponseSchedule `json:"schedules,omitempty"`
}

type HibernationResponseSchedule

type HibernationResponseSchedule struct {
	Start    string `json:"start"`
	End      string `json:"end"`
	Location string `json:"location"`
}

type HibernationSchedule

type HibernationSchedule struct {
	Start string `json:"start"`
	End   string `json:"end"`
}

type HibernationSchedules

type HibernationSchedules struct {
	HibernationSchedules []HibernationSchedule `json:"schedules,omitempty"`
}

type ImageDetails

type ImageDetails struct {
	Name    string `json:"name"`
	Version string `json:"version"`
}

type InfrastructureConfigDetails

type InfrastructureConfigDetails struct {
	FloatingPoolName string `json:"floatingPoolName"`
}

type K8sVersion

type K8sVersion struct {
	Version string `json:"version"`
}

type KubernetesDetails

type KubernetesDetails struct {
	Version string `json:"version"`
}

type LastOperationDetails

type LastOperationDetails struct {
	Progress int16  `json:"progress"`
	State    string `json:"state"`
	Type     string `json:"type"`
}

type MachineDetails

type MachineDetails struct {
	Type  string       `json:"type"`
	Image ImageDetails `json:"image"`
}

type MetadataFields

type MetadataFields struct {
	Name string `json:"name"`
	UID  string `json:"uid"`
}

type OpenstackArea

type OpenstackArea struct {
	Name    string            `json:"name"`
	Tag     string            `json:"tag"`
	Regions []OpenstackRegion `json:"regions"`
}

type OpenstackDomain

type OpenstackDomain struct {
	Area    OpenstackArea `json:"area"`
	Id      string        `json:"id"`
	Status  string        `json:"status"`
	Name    string        `json:"name"`
	Enabled bool          `json:"enabled"`
}

Openstack domains.

type OpenstackProject

type OpenstackProject struct {
	Id          string `json:"id"`
	Name        string `json:"name"`
	DomainId    string `json:"domain_id"`
	Enabled     bool   `json:"enabled"`
	Default     bool   `json:"default"`
	Description string `json:"description"`
}

Openstack projects.

type OpenstackRegion

type OpenstackRegion struct {
	Name   string `json:"name"`
	Status string `json:"status"`
	Region string `json:"region"`
}

type ProviderDetails

type ProviderDetails struct {
	InfrastructureConfig InfrastructureConfigDetails `json:"infrastructureConfig"`
	Workers              []Worker                    `json:"workers"`
}

type RequestAPIError

type RequestAPIError struct {
	StatusCode int
	Err        error
}

Need to know status code for retry.

func (*RequestAPIError) Error

func (r *RequestAPIError) Error() string

type ShootClusterCreateResponse added in v0.0.10

type ShootClusterCreateResponse struct {
	Shoot ShootClusterCreateResponseConfig `json:"shoot"`
}

type ShootClusterCreateResponseConfig added in v0.0.10

type ShootClusterCreateResponseConfig struct {
	Name        string             `json:"name"`
	UID         string             `json:"uid"`
	Kubernetes  KubernetesDetails  `json:"kubernetes"`
	Provider    ProviderDetails    `json:"provider"`
	Purpose     string             `json:"purpose"`
	Region      string             `json:"region"`
	Hibernation HibernationDetails `json:"hibernation"`
}

type ShootClusterRequest

type ShootClusterRequest struct {
	Shoot ShootClusterRequestConfig `json:"shoot"`
}

Shoot cluster request data model.

type ShootClusterRequestConfig

type ShootClusterRequestConfig struct {
	Name              string                `json:"name,omitempty"`
	KubernetesVersion *K8sVersion           `json:"kubernetes,omitempty"`
	Provider          *ProviderDetails      `json:"provider,omitempty"`
	Hibernation       *HibernationSchedules `json:"hibernation,omitempty"`
}

type ShootClusterResponse

type ShootClusterResponse struct {
	Metadata MetadataFields `json:"metadata"`
	Spec     SpecFields     `json:"spec"`
	Status   StatusFields   `json:"status"`
}

Shoot cluster response data model.

type SpecFields

type SpecFields struct {
	Purpose     string             `json:"purpose"`
	Region      string             `json:"region"`
	Provider    ProviderDetails    `json:"provider"`
	Kubernetes  KubernetesDetails  `json:"kubernetes"`
	Hibernation HibernationDetails `json:"hibernation"`
}

type StatusFields

type StatusFields struct {
	Conditions          []Condition          `json:"conditions"`
	Hibernated          bool                 `json:"hibernated"`
	AdvertisedAddresses []AdvertisedAddress  `json:"advertisedAddresses"`
	LastOperation       LastOperationDetails `json:"lastOperation"`
}

type VolumeDetails

type VolumeDetails struct {
	Size string `json:"size"`
}

type Worker

type Worker struct {
	Name     string         `json:"name,omitempty"`
	Minimum  int16          `json:"minimum,omitempty"`
	Maximum  int16          `json:"maximum,omitempty"`
	MaxSurge int16          `json:"maxSurge,omitempty"`
	Machine  MachineDetails `json:"machine"`
	Volume   VolumeDetails  `json:"volume"`
}

Worker.

type WorkerGroupRequest

type WorkerGroupRequest struct {
	Worker Worker `json:"worker"`
}

Jump to

Keyboard shortcuts

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