httphandler

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: May 10, 2023 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HTTPClientBuilder

func HTTPClientBuilder(opts *clioptions.CLIOptions) (*http.Client, error)

HTTPClientBuilder creates an HTTP client from the given CLI options

func ParseResponseBody

func ParseResponseBody(contextName string, body io.Reader, out interface{}) error

ParseResponseBody reads and unmarshals the response body in the given interface

Types

type Auth

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

func (*Auth) Authenticate

func (a *Auth) Authenticate() (string, error)

type IAuth

type IAuth interface {
	Authenticate() (string, error)
}

type MiaClient

type MiaClient struct {
	SessionHandler SessionHandler
}

MiaClient is the type spec for miactl custom client

func ConfigureDefaultMiaClient

func ConfigureDefaultMiaClient(opts *clioptions.CLIOptions, uri string) (*MiaClient, error)

ConfigureDefaultMiaClient creates a MiaClient object with default options

func FakeMiaClient

func FakeMiaClient(url string) *MiaClient

FakeMiaClient creates a fake MiaClient with a fake SessionHandler for testing purposes

func NewMiaClientBuilder

func NewMiaClientBuilder() *MiaClient

NewMiaClientBuilder returns an empty MiaClient

func (*MiaClient) GetSession

func (m *MiaClient) GetSession() *SessionHandler

GetSession returns the MiaClient SessionHandler

func (*MiaClient) WithSessionHandler

func (m *MiaClient) WithSessionHandler(s SessionHandler) *MiaClient

WithSessionHandler sets the MiaClient SessionHandler

type SessionHandler

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

SessionHandler is the type spec for miactl HTTP sessions

func ConfigureDefaultSessionHandler

func ConfigureDefaultSessionHandler(opts *clioptions.CLIOptions, contextName, uri string) (*SessionHandler, error)

ConfigureDefaultSessionHandler returns a session handler with default settings

func FakeSessionHandler

func FakeSessionHandler(url string) *SessionHandler

func NewSessionHandler

func NewSessionHandler(url string) (*SessionHandler, error)

NewSessionHandler returns a SessionHandler with the specified URL

func (*SessionHandler) ExecuteRequest

func (s *SessionHandler) ExecuteRequest() (*http.Response, error)

ExecuteRequest executes the HTTP request with the info in the SessionHandler object.

func (*SessionHandler) Get

func (s *SessionHandler) Get() *SessionHandler

Get sets the SessionHandler method to HTTP GET

func (*SessionHandler) GetContext

func (s *SessionHandler) GetContext() string

GetContext returns the SessionHandler miactl context

func (*SessionHandler) Post

func (s *SessionHandler) Post(body io.Reader) *SessionHandler

Post sets the SessionHandler method to HTTP POST

func (*SessionHandler) WithAuthentication

func (s *SessionHandler) WithAuthentication(url, providerID string, b browser.URLOpener) *SessionHandler

WithAuthentication initializes the SessionHandler auth field

func (*SessionHandler) WithBody

func (s *SessionHandler) WithBody(body io.Reader) *SessionHandler

WithBody sets the SessionHandler request body

func (*SessionHandler) WithClient

func (s *SessionHandler) WithClient(c *http.Client) *SessionHandler

WithClient sets the SessionHandler HTTP client

func (*SessionHandler) WithContext

func (s *SessionHandler) WithContext(ctx string) *SessionHandler

WithContext sets the SessionHandler miactl context

func (*SessionHandler) WithURL

func (s *SessionHandler) WithURL(url string) *SessionHandler

Jump to

Keyboard shortcuts

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