Containership Cloud go client
This is the home of the go client for Containership 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 Containership Cloud client.
API Clients
Containership 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 Containership Cloud API
- Auth - API specific to user authentication and authorization
- Provision - API specific to provisioning, i.e. for Containership Kubernetes Engine (CKE)
- 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 Containership 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 Containership Cloud's various microservices:
clientset, err := cloud.New(&cloud.Config{
Token: token
})
List all organizations
orgs, err := clientset.API().Organizations().List()
Get a Containership Kubernetes Engine (CKE) cluster
cluster, err := clientset.Provision().CKEClusters(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)