client

package
v0.0.0-...-ae01f8c Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2024 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultHTTPClientTimeout = 60 * time.Second
	DefaultPortGRPC          = 9111
	DefaultPortHTTP          = 9191
	StoneWorkServiceName     = "stonework"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API interface {
	GetComponents() ([]Component, error)
	GetHost() string
}

API defines client API. It is supposed to be used by various client applications, such as swctl or other user applications interacting with StoneWork.

type Client

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

Client implements API interface.

func NewClient

func NewClient(opts ...Option) (*Client, error)

NewClient creates a new client that implements API. The client can be customized by options.

func (*Client) DockerClient

func (c *Client) DockerClient() *docker.Client

func (*Client) GetComponents

func (c *Client) GetComponents() ([]Component, error)

func (*Client) GetHost

func (c *Client) GetHost() string

func (*Client) HTTPClient

func (c *Client) HTTPClient() *http.Client

HTTPClient returns configured HTTP client.

func (*Client) StatusInfo

func (c *Client) StatusInfo(ctx context.Context) ([]cnfreg.Info, error)

type Component

type Component interface {
	GetName() string
	GetMode() ComponentMode
	GetInfo() *cnfreg.Info
	GetMetadata() map[string]string
	ConfigStatus() (*ConfigCounts, error)
}

Component is a component of StoneWork. It can be StoneWork instance itself, a CNF connected to it or other Ligato service in connected to StoneWork.

type ComponentMode

type ComponentMode int32
const (
	ComponentUnknown ComponentMode = iota

	// Auxiliary means the component is not a CNF and is not managed by StoneWork
	ComponentAuxiliary

	// Standalone means the component is a standalone CNF
	ComponentStandalone

	// ComponentStonework means the component is a StoneWork module managed by StoneWork
	ComponentStoneworkModule

	// Stonework means the component is a StoneWork instance
	ComponentStonework
)

func (ComponentMode) String

func (c ComponentMode) String() string

type ConfigCounts

type ConfigCounts struct {
	Ok            int
	Err           int
	Missing       int
	Pending       int
	Retrying      int
	Unimplemented int
}

func (ConfigCounts) String

func (cc ConfigCounts) String() string

type Option

type Option func(*Client) error

Option is a function that customizes a Client.

func WithComposeFiles

func WithComposeFiles(files []string) Option

func WithHTTPPort

func WithHTTPPort(p uint16) Option

func WithHTTPTLS

func WithHTTPTLS(cert, key, ca string, skipVerify bool) Option

Jump to

Keyboard shortcuts

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