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)