client

package
v0.0.14 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2024 License: GPL-3.0 Imports: 23 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Go API client for Grendel

Bare Metal Provisioning system for HPC Linux clusters. Find out more about Grendel at https://github.com/ubccr/grendel

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.0
  • Package version: 1.0.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/oauth2
go get golang.org/x/net/context
go get github.com/antihax/optional

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

import "github.com/ubccr/grendel/client"

Documentation for API Endpoints

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

Class Method HTTP request Description
HostApi HostDelete Delete /host/find/{nodeSet} Delete hosts by name or nodeset
HostApi HostFind Get /host/find/{nodeSet} Find hosts by name or nodeset
HostApi HostList Get /host/list List all hosts
HostApi HostProvision Put /host/provision/{nodeSet} Set hosts to provision by name or nodeset
HostApi HostTag Put /host/tag/{nodeSet} Tag hosts by name or nodeset
HostApi HostTags Get /host/tags/{tags} Find hosts by tags
HostApi HostUnprovision Put /host/unprovision/{nodeSet} Set hosts to unprovision by name or nodeset
HostApi HostUntag Put /host/untag/{nodeSet} Untag hosts name or nodeset
HostApi StoreHosts Post /host Add or update hosts in Grendel
ImageApi ImageDelete Delete /bootimage/find/{name} Delete boot images by name
ImageApi ImageFind Get /bootimage/find/{name} Find image by name
ImageApi ImageList Get /bootimage/list List all images
ImageApi StoreImages Post /bootimage Add or update images in Grendel

Documentation For Models

Documentation For Authorization

api_key

  • Type: API key

Example

auth := context.WithValue(context.Background(), sw.ContextAPIKey, sw.APIKey{
    Key: "APIKEY",
    Prefix: "Bearer", // Omit if not necessary.
})
r, err := client.Service.Operation(auth, args)

Author

aebruno2@buffalo.edu

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ContextOAuth2 takes an 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 added in v0.0.2

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

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

Types

type APIClient added in v0.0.2

type APIClient struct {
	HostApi *HostApiService

	ImageApi *ImageApiService
	// contains filtered or unexported fields
}

APIClient manages communication with the Grendel API API v1.0.0 In most cases there should be only one, shared, APIClient.

func NewAPIClient added in v0.0.2

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 added in v0.0.2

func (c *APIClient) ChangeBasePath(path string)

ChangeBasePath changes base path to allow switching to mocks

func (*APIClient) GetConfig added in v0.0.2

func (c *APIClient) GetConfig() *Configuration

Allow modification of underlying config for alternate implementations and testing Caution: modifying the configuration while live can cause data races and potentially unwanted behavior

type APIKey added in v0.0.2

type APIKey struct {
	Key    string
	Prefix string
}

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

type APIResponse added in v0.0.2

type APIResponse struct {
	*http.Response `json:"-"`
	Message        string `json:"message,omitempty"`
	// Operation is the name of the OpenAPI 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:"-"`
}

APIResponse stores the API response returned by the server.

func NewAPIResponse added in v0.0.2

func NewAPIResponse(r *http.Response) *APIResponse

NewAPIResponse returns a new APIResonse object.

func NewAPIResponseWithError added in v0.0.2

func NewAPIResponseWithError(errorMessage string) *APIResponse

NewAPIResponseWithError returns a new APIResponse object with the provided error message.

type BasicAuth added in v0.0.2

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 added in v0.0.2

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"`
	Debug         bool              `json:"debug,omitempty"`
	Servers       []ServerConfiguration
	HTTPClient    *http.Client
}

Configuration stores the configuration of the API client

func NewConfiguration added in v0.0.2

func NewConfiguration() *Configuration

NewConfiguration returns a new Configuration object

func (*Configuration) AddDefaultHeader added in v0.0.2

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

AddDefaultHeader adds a new HTTP header to the default header in the request

func (*Configuration) ServerUrl added in v0.0.2

func (c *Configuration) ServerUrl(index int, variables map[string]string) (string, error)

ServerUrl returns URL based on server settings

type ErrorResponse added in v0.0.2

type ErrorResponse struct {
	Message string `json:"message,omitempty"`
}

ErrorResponse struct for ErrorResponse

type GenericOpenAPIError added in v0.0.2

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

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

func (GenericOpenAPIError) Body added in v0.0.2

func (e GenericOpenAPIError) Body() []byte

Body returns the raw bytes of the response

func (GenericOpenAPIError) Error added in v0.0.2

func (e GenericOpenAPIError) Error() string

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

func (GenericOpenAPIError) Model added in v0.0.2

func (e GenericOpenAPIError) Model() interface{}

Model returns the unpacked model of the error

type HostApiService added in v0.0.2

type HostApiService service

HostApiService HostApi service

func (*HostApiService) HostDelete added in v0.0.6

func (a *HostApiService) HostDelete(ctx _context.Context, nodeSet string) (*_nethttp.Response, error)

HostDelete Delete hosts by name or nodeset Delete hosts in the given nodeset

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param nodeSet nodeset syntax. Example: cpn-d13-[01-100]

func (*HostApiService) HostFind added in v0.0.2

func (a *HostApiService) HostFind(ctx _context.Context, nodeSet string) (model.HostList, *_nethttp.Response, error)

HostFind Find hosts by name or nodeset Returns a list of hosts in the given nodeset

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param nodeSet nodeset syntax. Example: cpn-d13-[01-100]

@return []Host

func (*HostApiService) HostList added in v0.0.2

HostList List all hosts Returns all host stored in Grendel

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().

@return []Host

func (*HostApiService) HostProvision added in v0.0.4

func (a *HostApiService) HostProvision(ctx _context.Context, nodeSet string) (*_nethttp.Response, error)

HostProvision Set hosts to provision by name or nodeset Sets hosts to provision in the given nodeset

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param nodeSet nodeset syntax. Example: cpn-d13-[01-100]

func (*HostApiService) HostTag added in v0.0.5

func (a *HostApiService) HostTag(ctx _context.Context, nodeSet string, tags string) (*_nethttp.Response, error)

HostTag Tag hosts by name or nodeset Tag hosts in the given nodeset

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param nodeSet nodeset syntax. Example: cpn-d13-[01-100]
  • @param tags list of tags. Example: ib,noib,k16

func (*HostApiService) HostTags added in v0.0.5

HostTags Find hosts by tags Returns a list of hosts with the given tags

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param tags comman separated list of tags. Example: ib,noib,k16

@return []Host

func (*HostApiService) HostUnprovision added in v0.0.4

func (a *HostApiService) HostUnprovision(ctx _context.Context, nodeSet string) (*_nethttp.Response, error)

HostUnprovision Set hosts to unprovision by name or nodeset Sets hosts to unprovision in the given nodeset

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param nodeSet nodeset syntax. Example: cpn-d13-[01-100]

func (*HostApiService) HostUntag added in v0.0.5

func (a *HostApiService) HostUntag(ctx _context.Context, nodeSet string, tags string) (*_nethttp.Response, error)

HostUntag Untag hosts name or nodeset Untag hosts the given nodeset

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param nodeSet nodeset syntax. Example: cpn-d13-[01-100]
  • @param tags list of tags. Example: ib,noib,k16

func (*HostApiService) StoreHosts added in v0.0.2

func (a *HostApiService) StoreHosts(ctx _context.Context, body model.HostList) (*_nethttp.Response, error)

StoreHosts Add or update hosts in Grendel

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param body Add/Update one or more hosts to Grendel

type ImageApiService added in v0.0.3

type ImageApiService service

ImageApiService ImageApi service

func (*ImageApiService) ImageDelete added in v0.0.6

func (a *ImageApiService) ImageDelete(ctx _context.Context, name string) (*_nethttp.Response, error)

ImageDelete Delete boot images by name Delete boot images with the given name

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param name Name of boot image to delete

func (*ImageApiService) ImageFind added in v0.0.3

ImageFind Find image by name Returns image with the given name

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param name Name of image

@return []BootImage

func (*ImageApiService) ImageList added in v0.0.3

ImageList List all images Returns all images stored in Grendel

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().

@return []BootImage

func (*ImageApiService) StoreImages added in v0.0.3

func (a *ImageApiService) StoreImages(ctx _context.Context, body model.BootImageList) (*_nethttp.Response, error)

StoreImages Add or update images in Grendel

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param body Add/Update one or more images to Grendel

type ServerConfiguration added in v0.0.2

type ServerConfiguration struct {
	Url         string
	Description string
	Variables   map[string]ServerVariable
}

ServerConfiguration stores the information about a server

type ServerVariable added in v0.0.2

type ServerVariable struct {
	Description  string
	DefaultValue string
	EnumValues   []string
}

ServerVariable stores the information about a server variable

Jump to

Keyboard shortcuts

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