Files
autoglue/sdk/go/README.md

13 KiB

Go API client for autoglue

API for managing K3s clusters across cloud providers

Overview

This API client was generated by the OpenAPI Generator project. By using the OpenAPI-spec from a remote server, you can easily generate an API client.

  • API version: 1.0
  • Package version: 1.0.0
  • Generator version: 7.17.0
  • Build package: org.openapitools.codegen.languages.GoClientCodegen

Installation

Install the following dependencies:

go get github.com/stretchr/testify/assert
go get golang.org/x/net/context

Put the package under your project folder and add the following in import:

import autoglue "github.com/glueops/autoglue-sdk-go"

To use a proxy, set the environment variable HTTP_PROXY:

os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port")

Configuration of Server URL

Default configuration comes with Servers field that contains server objects as defined in the OpenAPI specification.

Select Server Configuration

For using other server than the one defined on index 0 set context value autoglue.ContextServerIndex of type int.

ctx := context.WithValue(context.Background(), autoglue.ContextServerIndex, 1)

Templated Server URL

Templated server URL is formatted using default variables from configuration or from context value autoglue.ContextServerVariables of type map[string]string.

ctx := context.WithValue(context.Background(), autoglue.ContextServerVariables, map[string]string{
	"basePath": "v2",
})

Note, enum values are always validated and all unused variables are silently ignored.

URLs Configuration per Operation

Each operation can use different server URL defined using OperationServers map in the Configuration. An operation is uniquely identified by "{classname}Service.{nickname}" string. Similar rules for overriding default operation server index and variables applies by using autoglue.ContextOperationServerIndices and autoglue.ContextOperationServerVariables context maps.

ctx := context.WithValue(context.Background(), autoglue.ContextOperationServerIndices, map[string]int{
	"{classname}Service.{nickname}": 2,
})
ctx = context.WithValue(context.Background(), autoglue.ContextOperationServerVariables, map[string]map[string]string{
	"{classname}Service.{nickname}": {
		"port": "8443",
	},
})

Documentation for API Endpoints

All URIs are relative to http://localhost:8080/api/v1

Class Method HTTP request Description
AnnotationsAPI CreateAnnotation Post /annotations Create annotation (org scoped)
AnnotationsAPI DeleteAnnotation Delete /annotations/{id} Delete annotation (org scoped)
AnnotationsAPI GetAnnotation Get /annotations/{id} Get annotation by ID (org scoped)
AnnotationsAPI ListAnnotations Get /annotations List annotations (org scoped)
AnnotationsAPI UpdateAnnotation Patch /annotations/{id} Update annotation (org scoped)
ArcherAdminAPI AdminCancelArcherJob Post /admin/archer/jobs/{id}/cancel Cancel an Archer job (admin)
ArcherAdminAPI AdminEnqueueArcherJob Post /admin/archer/jobs Enqueue a new Archer job (admin)
ArcherAdminAPI AdminListArcherJobs Get /admin/archer/jobs List Archer jobs (admin)
ArcherAdminAPI AdminListArcherQueues Get /admin/archer/queues List Archer queues (admin)
ArcherAdminAPI AdminRetryArcherJob Post /admin/archer/jobs/{id}/retry Retry a failed/canceled Archer job (admin)
AuthAPI AuthCallback Get /auth/{provider}/callback Handle social login callback
AuthAPI AuthStart Post /auth/{provider}/start Begin social login
AuthAPI GetJWKS Get /.well-known/jwks.json Get JWKS
AuthAPI Logout Post /auth/logout Revoke refresh token family (logout everywhere)
AuthAPI Refresh Post /auth/refresh Rotate refresh token
HealthAPI HealthCheckOperationId Get /healthz Basic health check
LabelsAPI CreateLabel Post /labels Create label (org scoped)
LabelsAPI DeleteLabel Delete /labels/{id} Delete label (org scoped)
LabelsAPI GetLabel Get /labels/{id} Get label by ID (org scoped)
LabelsAPI ListLabels Get /labels List node labels (org scoped)
LabelsAPI UpdateLabel Patch /labels/{id} Update label (org scoped)
MeAPI GetMe Get /me Get current user profile
MeAPI UpdateMe Patch /me Update current user profile
MeAPIKeysAPI CreateUserAPIKey Post /me/api-keys Create a new user API key
MeAPIKeysAPI DeleteUserAPIKey Delete /me/api-keys/{id} Delete a user API key
MeAPIKeysAPI ListUserAPIKeys Get /me/api-keys List my API keys
OrgsAPI AddOrUpdateMember Post /orgs/{id}/members Add or update a member (owner/admin)
OrgsAPI CreateOrg Post /orgs Create organization
OrgsAPI CreateOrgKey Post /orgs/{id}/api-keys Create org key/secret pair (owner/admin)
OrgsAPI DeleteOrg Delete /orgs/{id} Delete organization (owner)
OrgsAPI DeleteOrgKey Delete /orgs/{id}/api-keys/{key_id} Delete org key (owner/admin)
OrgsAPI GetOrg Get /orgs/{id} Get organization
OrgsAPI ListMembers Get /orgs/{id}/members List members in org
OrgsAPI ListMyOrgs Get /orgs List organizations I belong to
OrgsAPI ListOrgKeys Get /orgs/{id}/api-keys List org-scoped API keys (no secrets)
OrgsAPI RemoveMember Delete /orgs/{id}/members/{user_id} Remove a member (owner/admin)
OrgsAPI UpdateOrg Patch /orgs/{id} Update organization (owner/admin)
ServersAPI CreateServer Post /servers Create server (org scoped)
ServersAPI DeleteServer Delete /servers/{id} Delete server (org scoped)
ServersAPI GetServer Get /servers/{id} Get server by ID (org scoped)
ServersAPI ListServers Get /servers List servers (org scoped)
ServersAPI UpdateServer Patch /servers/{id} Update server (org scoped)
SshAPI CreateSSHKey Post /ssh Create ssh keypair (org scoped)
SshAPI DeleteSSHKey Delete /ssh/{id} Delete ssh keypair (org scoped)
SshAPI DownloadSSHKey Get /ssh/{id}/download Download ssh key files by ID (org scoped)
SshAPI GetSSHKey Get /ssh/{id} Get ssh key by ID (org scoped)
SshAPI ListPublicSshKeys Get /ssh List ssh keys (org scoped)
TaintsAPI CreateTaint Post /taints Create node taint (org scoped)
TaintsAPI DeleteTaint Delete /taints/{id} Delete taint (org scoped)
TaintsAPI GetTaint Get /taints/{id} Get node taint by ID (org scoped)
TaintsAPI ListTaints Get /taints List node pool taints (org scoped)
TaintsAPI UpdateTaint Patch /taints/{id} Update node taint (org scoped)

Documentation For Models

Documentation For Authorization

Authentication schemes defined for the API:

ApiKeyAuth

  • Type: API key
  • API key parameter name: X-API-KEY
  • Location: HTTP header

Note, each API key must be added to a map of map[string]APIKey where the key is: ApiKeyAuth and passed in as the auth context for each request.

Example

auth := context.WithValue(
		context.Background(),
		autoglue.ContextAPIKeys,
		map[string]autoglue.APIKey{
			"ApiKeyAuth": {Key: "API_KEY_STRING"},
		},
	)
r, err := client.Service.Operation(auth, args)

BearerAuth

  • Type: API key
  • API key parameter name: Authorization
  • Location: HTTP header

Note, each API key must be added to a map of map[string]APIKey where the key is: BearerAuth and passed in as the auth context for each request.

Example

auth := context.WithValue(
		context.Background(),
		autoglue.ContextAPIKeys,
		map[string]autoglue.APIKey{
			"BearerAuth": {Key: "API_KEY_STRING"},
		},
	)
r, err := client.Service.Operation(auth, args)

OrgKeyAuth

  • Type: API key
  • API key parameter name: X-ORG-KEY
  • Location: HTTP header

Note, each API key must be added to a map of map[string]APIKey where the key is: OrgKeyAuth and passed in as the auth context for each request.

Example

auth := context.WithValue(
		context.Background(),
		autoglue.ContextAPIKeys,
		map[string]autoglue.APIKey{
			"OrgKeyAuth": {Key: "API_KEY_STRING"},
		},
	)
r, err := client.Service.Operation(auth, args)

OrgSecretAuth

  • Type: API key
  • API key parameter name: X-ORG-SECRET
  • Location: HTTP header

Note, each API key must be added to a map of map[string]APIKey where the key is: OrgSecretAuth and passed in as the auth context for each request.

Example

auth := context.WithValue(
		context.Background(),
		autoglue.ContextAPIKeys,
		map[string]autoglue.APIKey{
			"OrgSecretAuth": {Key: "API_KEY_STRING"},
		},
	)
r, err := client.Service.Operation(auth, args)

Documentation for Utility Methods

Due to the fact that model structure members are all pointers, this package contains a number of utility functions to easily obtain pointers to values of basic types. Each of these functions takes a value of the given basic type and returns a pointer to it:

  • PtrBool
  • PtrInt
  • PtrInt32
  • PtrInt64
  • PtrFloat
  • PtrFloat32
  • PtrFloat64
  • PtrString
  • PtrTime

Author