mirror of
https://github.com/GlueOps/autoglue.git
synced 2026-02-13 04:40:05 +01:00
262 lines
10 KiB
Markdown
262 lines
10 KiB
Markdown
# Go API client for autoglue
|
|
|
|
API for managing K3s clusters across cloud providers
|
|
|
|
## Overview
|
|
This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [OpenAPI-spec](https://www.openapis.org/) 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:
|
|
|
|
```sh
|
|
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:
|
|
|
|
```go
|
|
import autoglue "github.com/glueops/autoglue-sdk"
|
|
```
|
|
|
|
To use a proxy, set the environment variable `HTTP_PROXY`:
|
|
|
|
```go
|
|
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`.
|
|
|
|
```go
|
|
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`.
|
|
|
|
```go
|
|
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.
|
|
|
|
```go
|
|
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
|
|
------------ | ------------- | ------------- | -------------
|
|
*AuthAPI* | [**AuthCallback**](docs/AuthAPI.md#authcallback) | **Get** /auth/{provider}/callback | Handle social login callback
|
|
*AuthAPI* | [**AuthStart**](docs/AuthAPI.md#authstart) | **Post** /auth/{provider}/start | Begin social login
|
|
*AuthAPI* | [**GetJWKS**](docs/AuthAPI.md#getjwks) | **Get** /.well-known/jwks.json | Get JWKS
|
|
*AuthAPI* | [**Logout**](docs/AuthAPI.md#logout) | **Post** /auth/logout | Revoke refresh token family (logout everywhere)
|
|
*AuthAPI* | [**Refresh**](docs/AuthAPI.md#refresh) | **Post** /auth/refresh | Rotate refresh token
|
|
*MeAPI* | [**GetMe**](docs/MeAPI.md#getme) | **Get** /me | Get current user profile
|
|
*MeAPI* | [**UpdateMe**](docs/MeAPI.md#updateme) | **Patch** /me | Update current user profile
|
|
*MeAPIKeysAPI* | [**CreateUserAPIKey**](docs/MeAPIKeysAPI.md#createuserapikey) | **Post** /me/api-keys | Create a new user API key
|
|
*MeAPIKeysAPI* | [**DeleteUserAPIKey**](docs/MeAPIKeysAPI.md#deleteuserapikey) | **Delete** /me/api-keys/{id} | Delete a user API key
|
|
*MeAPIKeysAPI* | [**ListUserAPIKeys**](docs/MeAPIKeysAPI.md#listuserapikeys) | **Get** /me/api-keys | List my API keys
|
|
*OrgsAPI* | [**AddOrUpdateMember**](docs/OrgsAPI.md#addorupdatemember) | **Post** /orgs/{id}/members | Add or update a member (owner/admin)
|
|
*OrgsAPI* | [**CreateOrg**](docs/OrgsAPI.md#createorg) | **Post** /orgs | Create organization
|
|
*OrgsAPI* | [**CreateOrgKey**](docs/OrgsAPI.md#createorgkey) | **Post** /orgs/{id}/api-keys | Create org key/secret pair (owner/admin)
|
|
*OrgsAPI* | [**DeleteOrg**](docs/OrgsAPI.md#deleteorg) | **Delete** /orgs/{id} | Delete organization (owner)
|
|
*OrgsAPI* | [**DeleteOrgKey**](docs/OrgsAPI.md#deleteorgkey) | **Delete** /orgs/{id}/api-keys/{key_id} | Delete org key (owner/admin)
|
|
*OrgsAPI* | [**GetOrg**](docs/OrgsAPI.md#getorg) | **Get** /orgs/{id} | Get organization
|
|
*OrgsAPI* | [**ListMembers**](docs/OrgsAPI.md#listmembers) | **Get** /orgs/{id}/members | List members in org
|
|
*OrgsAPI* | [**ListMyOrgs**](docs/OrgsAPI.md#listmyorgs) | **Get** /orgs | List organizations I belong to
|
|
*OrgsAPI* | [**ListOrgKeys**](docs/OrgsAPI.md#listorgkeys) | **Get** /orgs/{id}/api-keys | List org-scoped API keys (no secrets)
|
|
*OrgsAPI* | [**RemoveMember**](docs/OrgsAPI.md#removemember) | **Delete** /orgs/{id}/members/{user_id} | Remove a member (owner/admin)
|
|
*OrgsAPI* | [**UpdateOrg**](docs/OrgsAPI.md#updateorg) | **Patch** /orgs/{id} | Update organization (owner/admin)
|
|
*ServersAPI* | [**CreateServer**](docs/ServersAPI.md#createserver) | **Post** /servers | Create server (org scoped)
|
|
*ServersAPI* | [**DeleteServer**](docs/ServersAPI.md#deleteserver) | **Delete** /servers/{id} | Delete server (org scoped)
|
|
*ServersAPI* | [**GetServer**](docs/ServersAPI.md#getserver) | **Get** /servers/{id} | Get server by ID (org scoped)
|
|
*ServersAPI* | [**ListServers**](docs/ServersAPI.md#listservers) | **Get** /servers | List servers (org scoped)
|
|
*ServersAPI* | [**UpdateServer**](docs/ServersAPI.md#updateserver) | **Patch** /servers/{id} | Update server (org scoped)
|
|
*SshAPI* | [**CreateSSHKey**](docs/SshAPI.md#createsshkey) | **Post** /ssh | Create ssh keypair (org scoped)
|
|
*SshAPI* | [**DeleteSSHKey**](docs/SshAPI.md#deletesshkey) | **Delete** /ssh/{id} | Delete ssh keypair (org scoped)
|
|
*SshAPI* | [**DownloadSSHKey**](docs/SshAPI.md#downloadsshkey) | **Get** /ssh/{id}/download | Download ssh key files by ID (org scoped)
|
|
*SshAPI* | [**GetSSHKey**](docs/SshAPI.md#getsshkey) | **Get** /ssh/{id} | Get ssh key by ID (org scoped)
|
|
*SshAPI* | [**ListPublicSshKeys**](docs/SshAPI.md#listpublicsshkeys) | **Get** /ssh | List ssh keys (org scoped)
|
|
*TaintsAPI* | [**CreateTaint**](docs/TaintsAPI.md#createtaint) | **Post** /taints | Create node taint (org scoped)
|
|
*TaintsAPI* | [**DeleteTaint**](docs/TaintsAPI.md#deletetaint) | **Delete** /taints/{id} | Delete taint (org scoped)
|
|
*TaintsAPI* | [**GetTaint**](docs/TaintsAPI.md#gettaint) | **Get** /taints/{id} | Get node taint by ID (org scoped)
|
|
*TaintsAPI* | [**ListTaints**](docs/TaintsAPI.md#listtaints) | **Get** /taints | List node pool taints (org scoped)
|
|
*TaintsAPI* | [**UpdateTaint**](docs/TaintsAPI.md#updatetaint) | **Patch** /taints/{id} | Update node taint (org scoped)
|
|
|
|
|
|
## Documentation For Models
|
|
|
|
- [DtoAuthStartResponse](docs/DtoAuthStartResponse.md)
|
|
- [DtoCreateSSHRequest](docs/DtoCreateSSHRequest.md)
|
|
- [DtoCreateServerRequest](docs/DtoCreateServerRequest.md)
|
|
- [DtoCreateTaintRequest](docs/DtoCreateTaintRequest.md)
|
|
- [DtoJWK](docs/DtoJWK.md)
|
|
- [DtoJWKS](docs/DtoJWKS.md)
|
|
- [DtoLogoutRequest](docs/DtoLogoutRequest.md)
|
|
- [DtoRefreshRequest](docs/DtoRefreshRequest.md)
|
|
- [DtoServerResponse](docs/DtoServerResponse.md)
|
|
- [DtoSshResponse](docs/DtoSshResponse.md)
|
|
- [DtoSshRevealResponse](docs/DtoSshRevealResponse.md)
|
|
- [DtoTaintResponse](docs/DtoTaintResponse.md)
|
|
- [DtoTokenPair](docs/DtoTokenPair.md)
|
|
- [DtoUpdateServerRequest](docs/DtoUpdateServerRequest.md)
|
|
- [DtoUpdateTaintRequest](docs/DtoUpdateTaintRequest.md)
|
|
- [HandlersCreateUserKeyRequest](docs/HandlersCreateUserKeyRequest.md)
|
|
- [HandlersMeResponse](docs/HandlersMeResponse.md)
|
|
- [HandlersMemberOut](docs/HandlersMemberOut.md)
|
|
- [HandlersMemberUpsertReq](docs/HandlersMemberUpsertReq.md)
|
|
- [HandlersOrgCreateReq](docs/HandlersOrgCreateReq.md)
|
|
- [HandlersOrgKeyCreateReq](docs/HandlersOrgKeyCreateReq.md)
|
|
- [HandlersOrgKeyCreateResp](docs/HandlersOrgKeyCreateResp.md)
|
|
- [HandlersOrgUpdateReq](docs/HandlersOrgUpdateReq.md)
|
|
- [HandlersUpdateMeRequest](docs/HandlersUpdateMeRequest.md)
|
|
- [HandlersUserAPIKeyOut](docs/HandlersUserAPIKeyOut.md)
|
|
- [ModelsAPIKey](docs/ModelsAPIKey.md)
|
|
- [ModelsOrganization](docs/ModelsOrganization.md)
|
|
- [ModelsUser](docs/ModelsUser.md)
|
|
- [ModelsUserEmail](docs/ModelsUserEmail.md)
|
|
- [UtilsErrorResponse](docs/UtilsErrorResponse.md)
|
|
|
|
|
|
## 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
|
|
|
|
```go
|
|
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
|
|
|
|
```go
|
|
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
|
|
|
|
```go
|
|
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
|
|
|
|
```go
|
|
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
|
|
|
|
|
|
|