redfish

package
v0.0.0-...-44af468 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2021 License: MIT Imports: 16 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 {

	// HTTPClient is for direct http actions
	HTTPClient *http.Client

	// Service is the ServiceRoot of this Redfish instance
	Service *redfishapi.Service
	// contains filtered or unexported fields
}

APIClient represents a connection to a Redfish/Swordfish enabled service or device.

func Connect

func Connect(config ClientConfig) (c *APIClient, err error)

Connect creates a new client connection to a Redfish service.

func ConnectContext

func ConnectContext(ctx context.Context, config ClientConfig) (c *APIClient, err error)

ConnectContext is the same as Connect, but sets the ctx.

func ConnectDefault

func ConnectDefault(endpoint string) (c *APIClient, err error)

ConnectDefault creates an unauthenticated connection to a Redfish service.

func ConnectDefaultContext

func ConnectDefaultContext(ctx context.Context, endpoint string) (c *APIClient, err error)

ConnectDefaultContext is the same as ConnectDefault, but sets the ctx.

func (*APIClient) CloneWithSession

func (c *APIClient) CloneWithSession() (*APIClient, error)

CloneWithSession will create a new Client with a session instead of basic auth.

func (*APIClient) Delete

func (c *APIClient) Delete(url string) (*http.Response, error)

Delete performs a Delete request against the Redfish service

func (*APIClient) DeleteWithHeaders

func (c *APIClient) DeleteWithHeaders(url string, customHeaders map[string]string) (*http.Response, error)

DeleteWithHeaders performs a Delete request against the Redfish service but allowing custom headers

func (*APIClient) Get

func (c *APIClient) Get(url string) (*http.Response, error)

Get performs a GET request against the Redfish service.

func (*APIClient) GetSession

func (c *APIClient) GetSession() (*Session, error)

GetSession retrieves the session data from an initialized APIClient. An error is returned if the client is not authenticated.

func (*APIClient) GetWithHeaders

func (c *APIClient) GetWithHeaders(url string, customHeaders map[string]string) (*http.Response, error)

GetWithHeaders performs a GET request against the Redfish service but allowing custom headers

func (*APIClient) Logout

func (c *APIClient) Logout()

Logout will delete any active session. Useful to defer logout when creating a new connection.

func (*APIClient) Patch

func (c *APIClient) Patch(url string, payload interface{}) (*http.Response, error)

Patch performs a Patch request against the Redfish service.

func (*APIClient) PatchWithHeaders

func (c *APIClient) PatchWithHeaders(url string, payload interface{}, customHeaders map[string]string) (*http.Response, error)

PatchWithHeaders performs a Patch request against the Redfish service but allowing custom headers

func (*APIClient) Post

func (c *APIClient) Post(url string, payload interface{}) (*http.Response, error)

Post performs a Post request against the Redfish service.

func (*APIClient) PostMultipart

func (c *APIClient) PostMultipart(url string, payload map[string]io.Reader) (*http.Response, error)

PostMultipart performs a Post request against the Redfish service with multipart payload.

func (*APIClient) PostMultipartWithHeaders

func (c *APIClient) PostMultipartWithHeaders(url string, payload map[string]io.Reader, customHeaders map[string]string) (*http.Response, error)

PostMultipartWithHeadersperforms a Post request against the Redfish service with multipart payload but allowing custom headers

func (*APIClient) PostWithHeaders

func (c *APIClient) PostWithHeaders(url string, payload interface{}, customHeaders map[string]string) (*http.Response, error)

PostWithHeaders performs a Post request against the Redfish service but allowing custom headers

func (*APIClient) Put

func (c *APIClient) Put(url string, payload interface{}) (*http.Response, error)

Put performs a Put request against the Redfish service.

func (*APIClient) PutWithHeaders

func (c *APIClient) PutWithHeaders(url string, payload interface{}, customHeaders map[string]string) (*http.Response, error)

PutWithHeaders performs a Put request against the Redfish service but allowing custom headers

func (*APIClient) SetDumpWriter

func (c *APIClient) SetDumpWriter(writer io.Writer)

SetDumpWriter sets the client the DumpWriter dynamically

type ClientConfig

type ClientConfig struct {
	// Endpoint is the URL of the redfish service
	Endpoint string

	// Username is the optional user name to authenticate with.
	Username string

	// Password is the password to use for authentication.
	Password string

	// Session is an optional session ID+token obtained from a previous session
	// If this is set, it is preferred over Username and Password
	Session *Session

	// Insecure controls whether to enforce SSL certificate validity.
	Insecure bool

	// Controls TLS handshake timeout
	TLSHandshakeTimeout int

	// HTTPClient is the optional client to connect with.
	HTTPClient *http.Client

	// DumpWriter is an optional io.Writer to receive dumps of HTTP
	// requests and responses.
	DumpWriter io.Writer

	// BasicAuth tells the APIClient if basic auth should be used (true) or token based auth must be used (false)
	BasicAuth bool
}

ClientConfig holds the settings for establishing a connection.

type Session

type Session struct {
	ID    string
	Token string
}

Session holds the session ID and auth token needed to identify an authenticated client

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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