hzctl

package
v0.0.0-...-9c0d32c Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApplyOption

type ApplyOption func(*applyOptions)

func WithApplyData

func WithApplyData(data []byte) ApplyOption

func WithApplyObject

func WithApplyObject(object hz.Objecter) ApplyOption

type Client

type Client struct {
	Server  string
	Session string
	Manager string
}

Client is an HTTP client for interacting with a Horizon server.

It is intended for CLIs and other tooling for end users. If you are building a service or controller, use the hz.Client instead which uses a NATS directly, and not the HTTP API.

func (*Client) Apply

func (c *Client) Apply(
	ctx context.Context,
	opts ...ApplyOption,
) (hz.ApplyOpResult, error)

func (*Client) Delete

func (c *Client) Delete(
	ctx context.Context,
	opts ...DeleteOption,
) error

func (*Client) List

func (c *Client) List(ctx context.Context, opts ...ListOption) error

type Config

type Config struct {
	CurrentContext string    `json:"currentContext"`
	Contexts       []Context `json:"contexts"`
}

Config represents the configuration file for the Horizon CLI. It contains a list of context and the current context.

func (*Config) Add

func (c *Config) Add(ctx Context)

Add adds a context to the config.

func (*Config) Context

func (c *Config) Context(opts ...ContextOption) (Context, error)

Context returns a context based on the given context options, or an error if no such context was found.

type Context

type Context struct {
	Name string `json:"name,omitempty"`

	URL     string  `json:"url,omitempty"`
	Session *string `json:"session,omitempty"`
}

Context represents a Horizon context. It contains the name, URL and session for a Horizon server.

func (*Context) Validate

func (c *Context) Validate(opts ...ValidateOption) error

Validate validates the context based on the given validation options.

type ContextOption

type ContextOption func(*contextOptions)

func WithContextByName

func WithContextByName(name string) ContextOption

WithContextByName returns a ContextOption that sets the context to the one with the given name.

func WithContextCurrent

func WithContextCurrent(b bool) ContextOption

WithContextCurrent returns a ContextOption that sets the context to the current context based on the given bool.

func WithContextTryName

func WithContextTryName(name *string) ContextOption

WithContextTryName returns a ContextOption that sets the context name to the given string, if it is not nil nor empty. If the given string is nil or empty, it does nothing.

func WithContextValidate

func WithContextValidate(opts ...ValidateOption) ContextOption

WithContextValidate returns a ContextOption that sets the context validation options to the given ValidateOptions.

type DeleteOption

type DeleteOption func(*deleteOptions)

func WithDeleteData

func WithDeleteData(data []byte) DeleteOption

func WithDeleteKey

func WithDeleteKey(key hz.ObjectKeyer) DeleteOption

type ListOption

type ListOption func(*getOptions)

func WithListKey

func WithListKey(key hz.ObjectKey) ListOption

func WithListResponseGenericObject

func WithListResponseGenericObject(
	resp *hz.GenericObjectList,
) ListOption

func WithListResponseWriter

func WithListResponseWriter(w io.Writer) ListOption

type ValidateOption

type ValidateOption func(*validateOptions)

func WithValidateSession

func WithValidateSession(b bool) ValidateOption

WithValidateSession returns a ValidateOption that sets the session validation to the given bool.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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