internal

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BaseURL  = "https://spot.rackspace.com"
	OAuthURL = "https://login.spot.rackspace.com"
)

Variables

This section is empty.

Functions

func Confirm

func Confirm(message string, defaultYes bool) (bool, error)

Confirm prompts the user for a yes/no confirmation

func OutputData

func OutputData(data interface{}, format string) error

OutputData formats and prints data according to the specified format

func PromptForString

func PromptForString(message, defaultValue string) (string, error)

PromptForString prompts the user to enter a string value

Types

type Client

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

Client wraps the Spot SDK client with CLI-specific functionality

func NewClient

func NewClient(cfg ClientConfig) (*Client, error)

NewClient creates a new CLI client with the given configuration

func NewClientWithTokens

func NewClientWithTokens(refreshToken, accessToken string) (*Client, error)

NewClientWithTokens is a convenience function to create a new client with just tokens

func (*Client) Authenticate

func (c *Client) Authenticate(ctx context.Context) (string, error)

Authenticate performs authentication

func (*Client) GetAPI

func (c *Client) GetAPI() rxtspot.SpotAPI

GetAPI returns the underlying Spot API client

func (*Client) GetOnDemandPrice

func (c *Client) GetOnDemandPrice(region, serverClass string) (string, error)

GetOnDemandPrice retrieves the on-demand price for a given region and server class

func (*Client) PromptForBidPrice

func (c *Client) PromptForBidPrice(message, defaultValue string) (string, error)

PromptForBidPrice prompts the user to enter a bid price for a spot node pool

func (*Client) PromptForCNI

func (c *Client) PromptForCNI(defaultCNI string) (string, error)

PromptForCNI prompts the user to select a CNI plugin

func (*Client) PromptForKubernetesVersion

func (c *Client) PromptForKubernetesVersion(defaultVersion string) (string, error)

PromptForKubernetesVersion prompts the user to select a Kubernetes version

func (*Client) PromptForNodeCount

func (c *Client) PromptForNodeCount(poolType string) (string, error)

PromptForNodeCount prompts the user to enter the number of nodes for a node pool

func (*Client) PromptForPoolType

func (c *Client) PromptForPoolType() (string, error)

PromptForPoolType prompts the user to select a node pool type (Spot or On-Demand)

func (*Client) PromptForRegion

func (c *Client) PromptForRegion(ctx context.Context) (string, error)

PromptForRegion prompts the user to select a region from the available regions

func (*Client) PromptForRegionWithDefault

func (c *Client) PromptForRegionWithDefault(ctx context.Context, defaultRegion string) (string, error)

PromptForRegionWithDefault prompts the user to select a region with an optional default using a dropdown

func (*Client) PromptForServerClass

func (c *Client) PromptForServerClass(ctx context.Context, region string) (string, error)

PromptForServerClass prompts the user to select a server class for the given region

func (*Client) PromptForServerClassWithBidPrice

func (c *Client) PromptForServerClassWithBidPrice(ctx context.Context, region, poolType string) (string, string, string, error)

PromptForServerClassWithBidPrice prompts the user to select a server class and returns the class name, minimum bid price, and on-demand price poolType should be either "spot" or "ondemand" to determine which pricing information to display

type ClientConfig

type ClientConfig struct {
	RefreshToken string
	AccessToken  string
	BaseURL      string
	OAuthURL     string
	Timeout      time.Duration
}

ClientConfig holds configuration for creating a new Client

func DefaultConfig

func DefaultConfig() ClientConfig

DefaultConfig returns a default ClientConfig with sensible defaults

Directories

Path Synopsis
Package version provides version information for spotctl.
Package version provides version information for spotctl.

Jump to

Keyboard shortcuts

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