api

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: May 23, 2024 License: GPL-3.0 Imports: 20 Imported by: 0

README

Go API client for api

No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

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: 0.9.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/net/context

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

import api "beryju.io/gravity/api"

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 sw.ContextServerIndex of type int.

ctx := context.WithValue(context.Background(), api.ContextServerIndex, 1)
Templated Server URL

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

ctx := context.WithValue(context.Background(), api.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 sw.ContextOperationServerIndices and sw.ContextOperationServerVariables context maps.

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

Documentation for API Endpoints

All URIs are relative to http://localhost

Class Method HTTP request Description
ClusterInstancesApi ClusterGetInfo Get /api/v1/cluster/info Instance
ClusterInstancesApi ClusterGetInstances Get /api/v1/cluster/instances Instances
ClusterInstancesApi ClusterInstanceRoleRestart Post /api/v1/cluster/roles/restart Instance roles
RolesApiApi ApiAuthConfig Get /api/v1/auth/config API Users
RolesApiApi ApiDeleteTokens Delete /api/v1/auth/tokens Tokens
RolesApiApi ApiDeleteUsers Delete /api/v1/auth/users API Users
RolesApiApi ApiExport Post /api/v1/cluster/export Export Cluster
RolesApiApi ApiGetLogMessages Get /api/v1/cluster/node/logs Log messages
RolesApiApi ApiGetMembers Get /api/v1/etcd/members Etcd members
RolesApiApi ApiGetMetricsCpu Get /api/v1/system/metrics/cpu System Metrics
RolesApiApi ApiGetMetricsMemory Get /api/v1/system/metrics/memory System Metrics
RolesApiApi ApiGetRoleConfig Get /api/v1/roles/api API role config
RolesApiApi ApiGetTokens Get /api/v1/auth/tokens Tokens
RolesApiApi ApiGetUsers Get /api/v1/auth/users API Users
RolesApiApi ApiImport Post /api/v1/cluster/import Import Cluster
RolesApiApi ApiLoginUser Post /api/v1/auth/login API Users
RolesApiApi ApiPutRoleConfig Post /api/v1/roles/api API role config
RolesApiApi ApiPutTokens Post /api/v1/auth/tokens Tokens
RolesApiApi ApiPutUsers Post /api/v1/auth/users API Users
RolesApiApi ApiUsersMe Get /api/v1/auth/me API Users
RolesApiApi ToolsPing Post /api/v1/tools/ping Ping tool
RolesApiApi ToolsPortmap Post /api/v1/tools/portmap Portmap tool
RolesApiApi ToolsTraceroute Post /api/v1/tools/traceroute Traceroute tool
RolesBackupApi BackupGetRoleConfig Get /api/v1/roles/backup Backup role config
RolesBackupApi BackupPutRoleConfig Post /api/v1/roles/backup Backup role config
RolesBackupApi BackupStart Post /api/v1/backup/start Backup start
RolesBackupApi BackupStatus Get /api/v1/backup/status Backup status
RolesDhcpApi DhcpDeleteLeases Delete /api/v1/dhcp/scopes/leases DHCP Leases
RolesDhcpApi DhcpDeleteScopes Delete /api/v1/dhcp/scopes DHCP Scopes
RolesDhcpApi DhcpGetLeases Get /api/v1/dhcp/scopes/leases DHCP Leases
RolesDhcpApi DhcpGetRoleConfig Get /api/v1/roles/dhcp DHCP role config
RolesDhcpApi DhcpGetScopes Get /api/v1/dhcp/scopes DHCP Scopes
RolesDhcpApi DhcpPutLeases Post /api/v1/dhcp/scopes/leases DHCP Leases
RolesDhcpApi DhcpPutRoleConfig Post /api/v1/roles/dhcp DHCP role config
RolesDhcpApi DhcpPutScopes Post /api/v1/dhcp/scopes DHCP Scopes
RolesDhcpApi DhcpWolLeases Post /api/v1/dhcp/scopes/leases/wol DHCP Leases
RolesDiscoveryApi DiscoveryApplyDevice Post /api/v1/discovery/devices/apply Apply Discovered devices
RolesDiscoveryApi DiscoveryDeleteDevices Delete /api/v1/discovery/devices/delete Discovery devices
RolesDiscoveryApi DiscoveryDeleteSubnets Delete /api/v1/discovery/subnets Discovery Subnets
RolesDiscoveryApi DiscoveryGetDevices Get /api/v1/discovery/devices Discovery devices
RolesDiscoveryApi DiscoveryGetRoleConfig Get /api/v1/roles/discovery Discovery role config
RolesDiscoveryApi DiscoveryGetSubnets Get /api/v1/discovery/subnets Discovery subnets
RolesDiscoveryApi DiscoveryPutRoleConfig Post /api/v1/roles/discovery Discovery role config
RolesDiscoveryApi DiscoveryPutSubnets Post /api/v1/discovery/subnets Discovery Subnets
RolesDiscoveryApi DiscoverySubnetStart Post /api/v1/discovery/subnets/start Discovery Subnets
RolesDnsApi DnsDeleteRecords Delete /api/v1/dns/zones/records DNS Records
RolesDnsApi DnsDeleteZones Delete /api/v1/dns/zones DNS Zones
RolesDnsApi DnsGetMetrics Get /api/v1/dns/metrics DNS Metrics
RolesDnsApi DnsGetRecords Get /api/v1/dns/zones/records DNS Records
RolesDnsApi DnsGetRoleConfig Get /api/v1/roles/dns DNS role config
RolesDnsApi DnsGetZones Get /api/v1/dns/zones DNS Zones
RolesDnsApi DnsPutRecords Post /api/v1/dns/zones/records DNS Records
RolesDnsApi DnsPutRoleConfig Post /api/v1/roles/dns DNS role config
RolesDnsApi DnsPutZones Post /api/v1/dns/zones DNS Zones
RolesEtcdApi EtcdJoinMember Post /api/v1/etcd/join Etcd join
RolesMonitoringApi MonitoringGetRoleConfig Get /api/v1/roles/monitoring Monitoring role config
RolesMonitoringApi MonitoringPutRoleConfig Post /api/v1/roles/monitoring Monitoring role config
RolesTsdbApi TsdbGetRoleConfig Get /api/v1/roles/tsdb TSDB role config
RolesTsdbApi TsdbPutRoleConfig Post /api/v1/roles/tsdb TSDB role config

Documentation For Models

Documentation For Authorization

Endpoints do not require authorization.

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ContextServerIndex uses a server configuration from the index.
	ContextServerIndex = contextKey("serverIndex")

	// ContextOperationServerIndices uses a server configuration from the index mapping.
	ContextOperationServerIndices = contextKey("serverOperationIndices")

	// ContextServerVariables overrides a server configuration variables.
	ContextServerVariables = contextKey("serverVariables")

	// ContextOperationServerVariables overrides a server configuration variables using operation specific values.
	ContextOperationServerVariables = contextKey("serverOperationVariables")
)

Functions

func CacheExpires

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

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

func IsNil added in v0.6.7

func IsNil(i interface{}) bool

IsNil checks if an input is nil

func PtrBool

func PtrBool(v bool) *bool

PtrBool is a helper routine that returns a pointer to given boolean value.

func PtrFloat32

func PtrFloat32(v float32) *float32

PtrFloat32 is a helper routine that returns a pointer to given float value.

func PtrFloat64

func PtrFloat64(v float64) *float64

PtrFloat64 is a helper routine that returns a pointer to given float value.

func PtrInt

func PtrInt(v int) *int

PtrInt is a helper routine that returns a pointer to given integer value.

func PtrInt32

func PtrInt32(v int32) *int32

PtrInt32 is a helper routine that returns a pointer to given integer value.

func PtrInt64

func PtrInt64(v int64) *int64

PtrInt64 is a helper routine that returns a pointer to given integer value.

func PtrString

func PtrString(v string) *string

PtrString is a helper routine that returns a pointer to given string value.

func PtrTime

func PtrTime(v time.Time) *time.Time

PtrTime is helper routine that returns a pointer to given Time value.

Types

type APIClient

type APIClient struct {
	ClusterInstancesApi *ClusterInstancesApiService

	RolesApiApi *RolesApiApiService

	RolesBackupApi *RolesBackupApiService

	RolesDhcpApi *RolesDhcpApiService

	RolesDiscoveryApi *RolesDiscoveryApiService

	RolesDnsApi *RolesDnsApiService

	RolesEtcdApi *RolesEtcdApiService

	RolesMonitoringApi *RolesMonitoringApiService

	RolesTsdbApi *RolesTsdbApiService
	// contains filtered or unexported fields
}

APIClient manages communication with the gravity API v0.9.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) GetConfig

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

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 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

func NewAPIResponse(r *http.Response) *APIResponse

NewAPIResponse returns a new APIResponse object.

func NewAPIResponseWithError

func NewAPIResponseWithError(errorMessage string) *APIResponse

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

type ApiAPIExportInput added in v0.6.19

type ApiAPIExportInput struct {
	Safe *bool `json:"safe,omitempty"`
}

ApiAPIExportInput struct for ApiAPIExportInput

func NewApiAPIExportInput added in v0.6.19

func NewApiAPIExportInput() *ApiAPIExportInput

NewApiAPIExportInput instantiates a new ApiAPIExportInput object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed

func NewApiAPIExportInputWithDefaults added in v0.6.19

func NewApiAPIExportInputWithDefaults() *ApiAPIExportInput

NewApiAPIExportInputWithDefaults instantiates a new ApiAPIExportInput object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set

func (*ApiAPIExportInput) GetSafe added in v0.6.19

func (o *ApiAPIExportInput) GetSafe() bool

GetSafe returns the Safe field value if set, zero value otherwise.

func (*ApiAPIExportInput) GetSafeOk added in v0.6.19

func (o *ApiAPIExportInput) GetSafeOk() (*bool, bool)

GetSafeOk returns a tuple with the Safe field value if set, nil otherwise and a boolean to check if the value has been set.

func (*ApiAPIExportInput) HasSafe added in v0.6.19

func (o *ApiAPIExportInput) HasSafe() bool

HasSafe returns a boolean if a field has been set.

func (ApiAPIExportInput) MarshalJSON added in v0.6.19

func (o ApiAPIExportInput) MarshalJSON() ([]byte, error)

func (*ApiAPIExportInput) SetSafe added in v0.6.19

func (o *ApiAPIExportInput) SetSafe(v bool)

SetSafe gets a reference to the given bool and assigns it to the Safe field.

func (ApiAPIExportInput) ToMap added in v0.6.19

func (o ApiAPIExportInput) ToMap() (map[string]interface{}, error)

type ApiAPIExportOutput added in v0.3.1

type ApiAPIExportOutput struct {
	Entries []ApiAPITransportEntry `json:"entries,omitempty"`
}

ApiAPIExportOutput struct for ApiAPIExportOutput

func NewApiAPIExportOutput added in v0.3.1

func NewApiAPIExportOutput() *ApiAPIExportOutput

NewApiAPIExportOutput instantiates a new ApiAPIExportOutput object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed

func NewApiAPIExportOutputWithDefaults added in v0.3.1

func NewApiAPIExportOutputWithDefaults() *ApiAPIExportOutput

NewApiAPIExportOutputWithDefaults instantiates a new ApiAPIExportOutput object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set

func (*ApiAPIExportOutput) GetEntries added in v0.3.1

func (o *ApiAPIExportOutput) GetEntries() []ApiAPITransportEntry

GetEntries returns the Entries field value if set, zero value otherwise (both if not set or set to explicit null).

func (*ApiAPIExportOutput) GetEntriesOk added in v0.3.1

func (o *ApiAPIExportOutput) GetEntriesOk() ([]ApiAPITransportEntry, bool)

GetEntriesOk returns a tuple with the Entries field value if set, nil otherwise and a boolean to check if the value has been set. NOTE: If the value is an explicit nil, `nil, true` will be returned

func (*ApiAPIExportOutput) HasEntries added in v0.3.1

func (o *ApiAPIExportOutput) HasEntries() bool

HasEntries returns a boolean if a field has been set.

func (ApiAPIExportOutput) MarshalJSON added in v0.3.1

func (o ApiAPIExportOutput) MarshalJSON() ([]byte, error)

func (*ApiAPIExportOutput) SetEntries added in v0.3.1

func (o *ApiAPIExportOutput) SetEntries(v []ApiAPITransportEntry)

SetEntries gets a reference to the given []ApiAPITransportEntry and assigns it to the Entries field.

func (ApiAPIExportOutput) ToMap added in v0.6.7

func (o ApiAPIExportOutput) ToMap() (map[string]interface{}, error)

type ApiAPIImportInput added in v0.3.1

type ApiAPIImportInput struct {
	Entries []ApiAPITransportEntry `json:"entries,omitempty"`
}

ApiAPIImportInput struct for ApiAPIImportInput

func NewApiAPIImportInput added in v0.3.1

func NewApiAPIImportInput() *ApiAPIImportInput

NewApiAPIImportInput instantiates a new ApiAPIImportInput object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed

func NewApiAPIImportInputWithDefaults added in v0.3.1

func NewApiAPIImportInputWithDefaults() *ApiAPIImportInput

NewApiAPIImportInputWithDefaults instantiates a new ApiAPIImportInput object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set

func (*ApiAPIImportInput) GetEntries added in v0.3.1

func (o *ApiAPIImportInput) GetEntries() []ApiAPITransportEntry

GetEntries returns the Entries field value if set, zero value otherwise (both if not set or set to explicit null).

func (*ApiAPIImportInput) GetEntriesOk added in v0.3.1

func (o *ApiAPIImportInput) GetEntriesOk() ([]ApiAPITransportEntry, bool)

GetEntriesOk returns a tuple with the Entries field value if set, nil otherwise and a boolean to check if the value has been set. NOTE: If the value is an explicit nil, `nil, true` will be returned

func (*ApiAPIImportInput) HasEntries added in v0.3.1

func (o *ApiAPIImportInput) HasEntries() bool

HasEntries returns a boolean if a field has been set.

func (ApiAPIImportInput) MarshalJSON added in v0.3.1

func (o ApiAPIImportInput) MarshalJSON() ([]byte, error)

func (*ApiAPIImportInput) SetEntries added in v0.3.1

func (o *ApiAPIImportInput) SetEntries(v []ApiAPITransportEntry)

SetEntries gets a reference to the given []ApiAPITransportEntry and assigns it to the Entries field.

func (ApiAPIImportInput) ToMap added in v0.6.7

func (o ApiAPIImportInput) ToMap() (map[string]interface{}, error)

type ApiAPILogMessage added in v0.6.8

type ApiAPILogMessage struct {
	Message *string `json:"message,omitempty"`
	Node    *string `json:"node,omitempty"`
}

ApiAPILogMessage struct for ApiAPILogMessage

func NewApiAPILogMessage added in v0.6.8

func NewApiAPILogMessage() *ApiAPILogMessage

NewApiAPILogMessage instantiates a new ApiAPILogMessage object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed

func NewApiAPILogMessageWithDefaults added in v0.6.8

func NewApiAPILogMessageWithDefaults() *ApiAPILogMessage

NewApiAPILogMessageWithDefaults instantiates a new ApiAPILogMessage object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set

func (*ApiAPILogMessage) GetMessage added in v0.6.8

func (o *ApiAPILogMessage) GetMessage() string

GetMessage returns the Message field value if set, zero value otherwise.

func (*ApiAPILogMessage) GetMessageOk added in v0.6.8

func (o *ApiAPILogMessage) GetMessageOk() (*string, bool)

GetMessageOk returns a tuple with the Message field value if set, nil otherwise and a boolean to check if the value has been set.

func (*ApiAPILogMessage) GetNode added in v0.6.8

func (o *ApiAPILogMessage) GetNode() string

GetNode returns the Node field value if set, zero value otherwise.

func (*ApiAPILogMessage)