cloud

package
v0.0.0-...-0111df2 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2020 License: Apache-2.0 Imports: 5 Imported by: 3

README

HKS Cloud go client

This is the home of the go client for HKS Cloud.

Warning: Similar to the rest of this repository, this project is currently under active development and is subject to breaking changes without notice.

Design

This client draws inspiration from the official Kubernetes go client, client-go. If you're familiar with client-go, then you should feel right at home with the HKS Cloud client.

API Clients

HKS Cloud is composed of various microservices, some of which are accessible via a REST API exposed over HTTP. In particular, this client is currently able to interact with the following microservices:

  • API - The main HKS Cloud API
  • Auth - API specific to user authentication and authorization
  • Provision - API specific to provisioning, i.e. for HKS Kubernetes Engine (HKE)
  • Proxy - The API used for proxying requests to the Kubernetes API for a given cluster
Code Generation

Currently, Swagger 2.0 descriptions of the various HKS APIs live in this repository. This is subject to change (a running theme of this repository!). Go structs and validation functions are autogenerated from these swagger.yaml files. See the code generation script.

Examples

Construct a new clientset for interacting with HKS Cloud's various microservices:
clientset, err := cloud.New(&cloud.Config{
    Token: token
})
List all organizations
orgs, err := clientset.API().Organizations().List()
Get a HKS Kubernetes Engine (HKE) cluster
cluster, err := clientset.Provision().HKEClusters(organizationID).Get(clusterID)
Upgrade a node pool
kubernetesVersion := "1.14.3"
req := &provisiontypes.NodePoolUpgradeRequest{
    KubernetesVersion: &kubernetesVersion,
}

nodePool, err := clientset.Provision().NodePools(organizationID, clusterID).Upgrade(nodePoolID, req)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Clientset

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

Clientset implements Interface

func New

func New(cfg Config) (*Clientset, error)

New constructs a new Clientset with the given config If base URLs are not provided, they will be defaulted by the underlying clients

func (*Clientset) API

func (c *Clientset) API() api.Interface

API returns an instance of the API client

func (*Clientset) Auth

func (c *Clientset) Auth() auth.Interface

Auth returns an instance of the Auth client

func (*Clientset) Provision

func (c *Clientset) Provision() provision.Interface

Provision returns an instance of the Provision client

type Config

type Config struct {
	Token string

	// Optional
	APIBaseURL       string
	AuthBaseURL      string
	ProvisionBaseURL string

	DebugEnabled bool
}

Config is the configuration for a Clientset

type Interface

type Interface interface {
	API() api.Interface
	Auth() auth.Interface
	Provision() provision.Interface
}

Interface is the main top-level interface to cloud

Directories

Path Synopsis
api

Jump to

Keyboard shortcuts

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