admincli

package
v1.18.0-beta21 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

README

Admincli

Warning This code is not intended to be used within the Control Plane.

Client

This is the Go client that should be used whenever communicating with the Gloo Admin API. Within the Gloo project, it is used inside of tests.

Philosophy

We expose methods that return a Command which can be run by the calling code. Any methods that fit this structure, should end in Cmd:

func InputSnapshotCmd(ctx context.Context) cmdutils.Cmd {}

There are also methods that the client exposes which are syntactic sugar on top of this command API. These methods tend to follow the naming convention: GetX:

func GetInputSnapshot(ctx context.Context) ([]interface{}, error) {}

As a general practice, these methods should return a concrete type, whenever possible.

Documentation

Index

Constants

View Source
const (
	InputSnapshotPath = "/snapshots/input"

	DefaultAdminPort = 9091
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client is a utility for executing requests against the Gloo Admin API The Admin API handlers can be found at: /projects/gloo/pkg/servers/admin

func NewClient

func NewClient() *Client

NewClient returns an implementation of the admincli.Client

func (*Client) Command

func (c *Client) Command(ctx context.Context, options ...curl.Option) cmdutils.Cmd

Command returns a curl Command, using the provided curl.Option as well as the client.curlOptions

func (*Client) GetInputSnapshot

func (c *Client) GetInputSnapshot(ctx context.Context) ([]interface{}, error)

GetInputSnapshot returns the data that is available at the input snapshot endpoint

func (*Client) InputSnapshotCmd

func (c *Client) InputSnapshotCmd(ctx context.Context) cmdutils.Cmd

InputSnapshotCmd returns the cmdutils.Cmd that can be run, and will execute a request against the Input Snapshot path

func (*Client) RequestPathCmd

func (c *Client) RequestPathCmd(ctx context.Context, path string) cmdutils.Cmd

RequestPathCmd returns the cmdutils.Cmd that can be run, and will execute a request against the provided path

func (*Client) RunCommand

func (c *Client) RunCommand(ctx context.Context, options ...curl.Option) error

RunCommand executes a curl Command, using the provided curl.Option as well as the client.curlOptions

func (*Client) WithCurlOptions

func (c *Client) WithCurlOptions(options ...curl.Option) *Client

WithCurlOptions sets the default set of curl.Option that will be used by default with the cmdutils.Cmd created by the Client

func (*Client) WithReceiver

func (c *Client) WithReceiver(receiver io.Writer) *Client

WithReceiver sets the io.Writer that will be used by default for the stdout and stderr of cmdutils.Cmd created by the Client

Jump to

Keyboard shortcuts

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