lib

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PAGINATION_QUIT = -1

	PAGINATION_OTHER = -2
)

Variables

View Source
var CLIContext = CLI{}

Functions

func AddProfile

func AddProfile(profile Profile, name string) error

func DownloadEnvironmentKubeConfig added in v0.8.2

func DownloadEnvironmentKubeConfig(kubeConfigPath, environmentID string) error

func FormatCommandData

func FormatCommandData(cmd *cobra.Command, data interface{}) error

func FormatCommandError

func FormatCommandError(cmd *cobra.Command, err error) error

func FormatRequestResult

func FormatRequestResult(cmd *cobra.Command, data interface{}, resp *http.Response, err error) error

func GetAPI

func GetAPI() *sdk.APIClient

func GetApiFromProfile

func GetApiFromProfile(profile Profile) *sdk.APIClient

func GetComponent added in v0.7.0

func GetComponent(componentID string) (*bunnysdk.ComponentItem, *http.Response, error)

func GetComponentResources added in v0.7.0

func GetComponentResources(componentID string) ([]bunnysdk.ComponentResourceItem, *http.Response, error)

func GetComponents added in v0.7.0

func GetComponents(environment, operationStatus string) (
	*bunnysdk.PaginatedComponentCollection,
	*http.Response,
	error,
)

func GetContext

func GetContext() (context.Context, context.CancelFunc)

func GetContextFromProfile

func GetContextFromProfile(profile Profile) (context.Context, context.CancelFunc)

func GetEnvironment added in v0.7.0

func GetEnvironment(environmentID string) (*bunnysdk.EnvironmentItem, *http.Response, error)

func GetEnvironments added in v0.7.0

func GetEnvironments(projectID string) (*bunnysdk.PaginatedEnvironmentCollection, *http.Response, error)

func GetOrganization added in v0.7.0

func GetOrganization(organizationID string) (*bunnysdk.OrganizationItem, *http.Response, error)

func GetOrganizations added in v0.7.0

func GetProject added in v0.7.0

func GetProject(projectID string) (*bunnysdk.ProjectItem, *http.Response, error)

func GetProjects added in v0.7.0

func GetProjects(organization string) (*bunnysdk.PaginatedProjectCollection, *http.Response, error)

func LoadViperConfigIntoContext

func LoadViperConfigIntoContext()

func MakeDefaultContext

func MakeDefaultContext()

func ProcessPagination added in v0.9.0

func ProcessPagination(cmd *cobra.Command, m ModelWithPagination) (int32, error)

func RemoveProfile

func RemoveProfile(name string) error

func SetDefaultProfile

func SetDefaultProfile(name string) error

func ShowCollection added in v0.9.0

func ShowCollection(cmd *cobra.Command, page int32, generator CollectionGenerator) error

Types

type CLI

type CLI struct {
	Debug        bool
	NoProgress   bool
	ProfileName  string
	Profile      Profile
	OutputFormat string
	ConfigFile   string
	Verbosity    int
	Timeout      time.Duration
	// contains filtered or unexported fields
}

func (*CLI) Load

func (c *CLI) Load(config Config) error

func (*CLI) RequireTokenOnCommand

func (c *CLI) RequireTokenOnCommand(cmd *cobra.Command)

func (*CLI) SetGlobalFlags

func (c *CLI) SetGlobalFlags(cmd *cobra.Command)

type CollectionGenerator added in v0.9.0

type CollectionGenerator func(page int32) (ModelWithPagination, *http.Response, error)

type Config

type Config struct {
	Debug          bool          `json:"debug" yaml:"debug"`
	OutputFormat   string        `json:"outputFormat,omitempty" yaml:"outputFormat,omitempty" binding:"required"`
	DefaultProfile string        `json:"defaultProfile" yaml:"defaultProfile" binding:"required"`
	Timeout        time.Duration `json:",omitempty" yaml:",omitempty"`
	Profiles       NamedProfiles `json:",omitempty" yaml:",omitempty"`
}

func GetConfig

func GetConfig() (*Config, error)

type Context

type Context struct {
	Organization     string `json:"organization,omitempty" yaml:"organization,omitempty"`
	Project          string `json:"project,omitempty" yaml:"project,omitempty"`
	Environment      string `json:"environment,omitempty" yaml:"environment,omitempty"`
	ServiceComponent string `json:"serviceComponent,omitempty" yaml:"serviceComponent,omitempty"`
}

type ModelWithPagination added in v0.9.0

type ModelWithPagination interface {
	GetPage() int32

	GetItemsPerPage() int32

	GetTotalItems() int32
}

type NamedProfiles

type NamedProfiles map[string]Profile

type Profile

type Profile struct {
	Host    string  `json:"host,omitempty" yaml:"host,omitempty"`
	Token   string  `json:"token,omitempty" yaml:"token,omitempty"`
	Context Context `json:"context,omitempty" yaml:"context,omitempty"`
}

func GetProfile

func GetProfile(name string) (*Profile, error)

func NewProfile

func NewProfile() *Profile

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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