client

package
v0.0.0-...-c4b98d2 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIClient

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

APIClient communicates with the API and parses the results

func (*APIClient) Get

func (cl *APIClient) Get(ctx context.Context, path string, obj interface{}) error

Get retrieves the ressource from the API and unmashals the json retrieved

func (*APIClient) HostName

func (cl *APIClient) HostName() string

HostName returns the name of the host

type Client

type Client interface {
	HostName() string
	Get(ctx context.Context, ressource string, obj interface{}) error
}

func NewClient

func NewClient(hostName, username, password string, tracer trace.Tracer, opts ...ClientOption) Client

NewClient creates a new client instance

type ClientOption

type ClientOption func(*APIClient)

ClientOption applies options to APIClient

func WithDebug

func WithDebug() ClientOption

WithDebug enables debug mode

func WithInsecure

func WithInsecure() ClientOption

WithInsecure disables TLS certificate validation

func WithMaxConcurrentRequests

func WithMaxConcurrentRequests(max uint) ClientOption

WithMaxConcurrentRequests defines the maximum number of GET requests sent against API concurrently

type DummyClient

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

func NewDummy

func NewDummy() *DummyClient

NewDummy returns a new dummy client

func (*DummyClient) Get

func (cl *DummyClient) Get(ctx context.Context, ressource string, obj interface{}) error

Get parses the dummy string for an given ressource and unmarshals the json

func (*DummyClient) HostName

func (cl *DummyClient) HostName() string

func (*DummyClient) SetResponse

func (cl *DummyClient) SetResponse(ressource string, value string)

SetResponse sets an dummy response for an ressource path

Jump to

Keyboard shortcuts

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