gusapi

package
v0.0.0-...-edac6e9 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2024 License: BSD-3-Clause Imports: 21 Imported by: 1

README

Go API client for swagger

OpenAPI for GUS (gokrazy update service)

Overview

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

  • API version: 1.4.0
  • Package version: 1.0.0
  • Build package: io.swagger.codegen.v3.generators.go.GoClientCodegen

Installation

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

import "./swagger"

Documentation for API Endpoints

All URIs are relative to https://gus.gokrazy.org/api/v1

Class Method HTTP request Description
HeartbeatApi Heartbeat Post /heartbeat device sends a heartbeat
IngestApi Ingest Post /ingest ingest a gokrazy build into the GUS database
IngestApi Push Put /push push a gokrazy build into the local disk registry
UpdateApi Attempt Post /attempt note that an update will be attempted
UpdateApi Update Post /update check if an update is available

Documentation For Models

Documentation For Authorization

Endpoints do not require authorization.

Author

michael+gokrazy@stapelberg.ch

Documentation

Overview

* GUS (gokrazy update service) * * OpenAPI for GUS (gokrazy update service) * * API version: 1.4.0 * Contact: michael+gokrazy@stapelberg.ch * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* GUS (gokrazy update service) * * OpenAPI for GUS (gokrazy update service) * * API version: 1.4.0 * Contact: michael+gokrazy@stapelberg.ch * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* GUS (gokrazy update service) * * OpenAPI for GUS (gokrazy update service) * * API version: 1.4.0 * Contact: michael+gokrazy@stapelberg.ch * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* GUS (gokrazy update service) * * OpenAPI for GUS (gokrazy update service) * * API version: 1.4.0 * Contact: michael+gokrazy@stapelberg.ch * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* GUS (gokrazy update service) * * OpenAPI for GUS (gokrazy update service) * * API version: 1.4.0 * Contact: michael+gokrazy@stapelberg.ch * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* GUS (gokrazy update service) * * OpenAPI for GUS (gokrazy update service) * * API version: 1.4.0 * Contact: michael+gokrazy@stapelberg.ch * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* GUS (gokrazy update service) * * OpenAPI for GUS (gokrazy update service) * * API version: 1.4.0 * Contact: michael+gokrazy@stapelberg.ch * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* GUS (gokrazy update service) * * OpenAPI for GUS (gokrazy update service) * * API version: 1.4.0 * Contact: michael+gokrazy@stapelberg.ch * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* GUS (gokrazy update service) * * OpenAPI for GUS (gokrazy update service) * * API version: 1.4.0 * Contact: michael+gokrazy@stapelberg.ch * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* GUS (gokrazy update service) * * OpenAPI for GUS (gokrazy update service) * * API version: 1.4.0 * Contact: michael+gokrazy@stapelberg.ch * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* GUS (gokrazy update service) * * OpenAPI for GUS (gokrazy update service) * * API version: 1.4.0 * Contact: michael+gokrazy@stapelberg.ch * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* GUS (gokrazy update service) * * OpenAPI for GUS (gokrazy update service) * * API version: 1.4.0 * Contact: michael+gokrazy@stapelberg.ch * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* GUS (gokrazy update service) * * OpenAPI for GUS (gokrazy update service) * * API version: 1.4.0 * Contact: michael+gokrazy@stapelberg.ch * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* GUS (gokrazy update service) * * OpenAPI for GUS (gokrazy update service) * * API version: 1.4.0 * Contact: michael+gokrazy@stapelberg.ch * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* GUS (gokrazy update service) * * OpenAPI for GUS (gokrazy update service) * * API version: 1.4.0 * Contact: michael+gokrazy@stapelberg.ch * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* GUS (gokrazy update service) * * OpenAPI for GUS (gokrazy update service) * * API version: 1.4.0 * Contact: michael+gokrazy@stapelberg.ch * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* GUS (gokrazy update service) * * OpenAPI for GUS (gokrazy update service) * * API version: 1.4.0 * Contact: michael+gokrazy@stapelberg.ch * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

* GUS (gokrazy update service) * * OpenAPI for GUS (gokrazy update service) * * API version: 1.4.0 * Contact: michael+gokrazy@stapelberg.ch * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)

Index

Constants

This section is empty.

Variables

View Source
var (
	// ContextOAuth2 takes a oauth2.TokenSource as authentication for the request.
	ContextOAuth2 = contextKey("token")

	// ContextBasicAuth takes BasicAuth as authentication for the request.
	ContextBasicAuth = contextKey("basic")

	// ContextAccessToken takes a string oauth2 access token as authentication for the request.
	ContextAccessToken = contextKey("accesstoken")

	// ContextAPIKey takes an APIKey as authentication for the request
	ContextAPIKey = contextKey("apikey")
)

Functions

func CacheExpires

func CacheExpires(r *http.Response) time.Time

CacheExpires helper function to determine remaining time before repeating a request.

Types

type APIClient

type APIClient struct {
	HeartbeatApi *HeartbeatApiService

	IngestApi *IngestApiService

	UpdateApi *UpdateApiService
	// contains filtered or unexported fields
}

APIClient manages communication with the GUS (gokrazy update service) API v1.4.0 In most cases there should be only one, shared, APIClient.

func NewAPIClient

func NewAPIClient(cfg *Configuration) *APIClient

NewAPIClient creates a new API client. Requires a userAgent string describing your application. optionally a custom http.Client to allow for advanced features such as caching.

func (*APIClient) ChangeBasePath

func (c *APIClient) ChangeBasePath(path string)

Change base path to allow switching to mocks

type APIKey

type APIKey struct {
	Key    string
	Prefix string
}

APIKey provides API key based authentication to a request passed via context using ContextAPIKey

type APIResponse

type APIResponse struct {
	*http.Response `json:"-"`
	Message        string `json:"message,omitempty"`
	// Operation is the name of the swagger operation.
	Operation string `json:"operation,omitempty"`
	// RequestURL is the request URL. This value is always available, even if the
	// embedded *http.Response is nil.
	RequestURL string `json:"url,omitempty"`
	// Method is the HTTP method used for the request.  This value is always
	// available, even if the embedded *http.Response is nil.
	Method string `json:"method,omitempty"`
	// Payload holds the contents of the response body (which may be nil or empty).
	// This is provided here as the raw response.Body() reader will have already
	// been drained.
	Payload []byte `json:"-"`
}

func NewAPIResponse

func NewAPIResponse(r *http.Response) *APIResponse

func NewAPIResponseWithError

func NewAPIResponseWithError(errorMessage string) *APIResponse

type AttemptRequest

type AttemptRequest struct {
	MachineId string `json:"machine_id,omitempty"`
	SbomHash  string `json:"sbom_hash,omitempty"`
}

type AttemptResponse

type AttemptResponse struct {
}

type BasicAuth

type BasicAuth struct {
	UserName string `json:"userName,omitempty"`
	Password string `json:"password,omitempty"`
}

BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth

type Configuration

type Configuration struct {
	BasePath      string            `json:"basePath,omitempty"`
	Host          string            `json:"host,omitempty"`
	Scheme        string            `json:"scheme,omitempty"`
	DefaultHeader map[string]string `json:"defaultHeader,omitempty"`
	UserAgent     string            `json:"userAgent,omitempty"`
	HTTPClient    *http.Client
}

func NewConfiguration

func NewConfiguration() *Configuration

func (*Configuration) AddDefaultHeader

func (c *Configuration) AddDefaultHeader(key string, value string)

type GenericSwaggerError

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

GenericSwaggerError Provides access to the body, error and model on returned errors.

func (GenericSwaggerError) Body

func (e GenericSwaggerError) Body() []byte

Body returns the raw bytes of the response

func (GenericSwaggerError) Error

func (e GenericSwaggerError) Error() string

Error returns non-empty string if there was an error.

func (GenericSwaggerError) Model

func (e GenericSwaggerError) Model() interface{}

Model returns the unpacked model of the error

type HeartbeatApiHeartbeatOpts

type HeartbeatApiHeartbeatOpts struct {
	Body optional.Interface
}

type HeartbeatApiService

type HeartbeatApiService service

func (*HeartbeatApiService) Heartbeat

type HeartbeatRequest

type HeartbeatRequest struct {
	MachineId string `json:"machine_id,omitempty"`
	// TODO
	Hostname      string                         `json:"hostname,omitempty"`
	SbomHash      string                         `json:"sbom_hash,omitempty"`
	Sbom          *HeartbeatRequestSbom          `json:"sbom,omitempty"`
	HumanReadable *HeartbeatRequestHumanReadable `json:"human_readable,omitempty"`
}

type HeartbeatRequestHumanReadable

type HeartbeatRequestHumanReadable struct {
	// Linux kernel version
	Kernel string `json:"kernel,omitempty"`
	// Model
	Model string `json:"model,omitempty"`
}

TODO

type HeartbeatRequestSbom

type HeartbeatRequestSbom struct {
	ConfigHash *PathHash `json:"config_hash,omitempty"`
	// TODO
	GoModHashes []PathHash `json:"go_mod_hashes,omitempty"`
}

TODO

type HeartbeatResponse

type HeartbeatResponse struct {
}

type IngestApiIngestOpts

type IngestApiIngestOpts struct {
	Body optional.Interface
}

type IngestApiPushOpts

type IngestApiPushOpts struct {
	Body optional.Interface
}

type IngestApiService

type IngestApiService service

func (*IngestApiService) Ingest

func (a *IngestApiService) Ingest(ctx context.Context, localVarOptionals *IngestApiIngestOpts) (IngestResponse, *http.Response, error)

func (*IngestApiService) Push

func (a *IngestApiService) Push(ctx context.Context, localVarOptionals *IngestApiPushOpts) (PushResponse, *http.Response, error)

type IngestRequest

type IngestRequest struct {
	// TODO
	MachineIdPattern string `json:"machine_id_pattern,omitempty"`
	SbomHash         string `json:"sbom_hash,omitempty"`
	// the type of registry on which the build is stored. see download_link
	RegistryType string `json:"registry_type,omitempty"`
	// relative (localdisk registry) or absolute download link with which gokrazy devices can download the build
	DownloadLink string `json:"download_link,omitempty"`
}

type IngestResponse

type IngestResponse struct {
}

type PathHash

type PathHash struct {
	// relative or absolute file path
	Path string `json:"path,omitempty"`
	// TODO
	Hash string `json:"hash,omitempty"`
}

type PushResponse

type PushResponse struct {
	// relative download link for the pushed GAF file
	DownloadLink string `json:"download_link,omitempty"`
}

type UpdateApiAttemptOpts

type UpdateApiAttemptOpts struct {
	Body optional.Interface
}

type UpdateApiService

type UpdateApiService service

func (*UpdateApiService) Attempt

func (a *UpdateApiService) Attempt(ctx context.Context, localVarOptionals *UpdateApiAttemptOpts) (AttemptResponse, *http.Response, error)

func (*UpdateApiService) Update

func (a *UpdateApiService) Update(ctx context.Context, localVarOptionals *UpdateApiUpdateOpts) (UpdateResponse, *http.Response, error)

type UpdateApiUpdateOpts

type UpdateApiUpdateOpts struct {
	Body optional.Interface
}

type UpdateRequest

type UpdateRequest struct {
	MachineId string `json:"machine_id,omitempty"`
}

type UpdateResponse

type UpdateResponse struct {
	SbomHash string `json:"sbom_hash,omitempty"`
	// the type of registry on which the build is stored. see download_link
	RegistryType string `json:"registry_type,omitempty"`
	// relative (localdisk registry) or absolute download link with which gokrazy devices can download the build
	DownloadLink string `json:"download_link,omitempty"`
}

Jump to

Keyboard shortcuts

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