client

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2022 License: Apache-2.0 Imports: 19 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentInstallOptions

type AgentInstallOptions struct {
	// Platform is the platform the agent will run on, such as Linux and Windows.
	Platform string
	// Version is the agent release version.
	Version string
	// Labels is a string representation of the agents labels.
	// Example: "dev,windows,nginx".
	Labels string
	// SecretKey is the secret key used for authentication against BindPlane.
	// TODO(jsirianni) is this correct ^ ?
	// TODO(jsirianni) should this be type uuid.UUID?
	SecretKey string
	// RemoteURL TODO(doc)
	RemoteURL string
}

AgentInstallOptions contains configuration options used for installing an agent.

type BindPlane

type BindPlane interface {
	// Agents TODO(doc)
	Agents(ctx context.Context, options ...QueryOption) ([]*model.Agent, error)
	// Agent TODO(doc)
	Agent(ctx context.Context, id string) (*model.Agent, error)
	DeleteAgents(ctx context.Context, agentIDs []string) ([]*model.Agent, error)

	AgentVersions(ctx context.Context) ([]*model.AgentVersion, error)
	AgentVersion(ctx context.Context, name string) (*model.AgentVersion, error)
	DeleteAgentVersion(ctx context.Context, name string) error

	// SyncAgentVersions builds agent-version from the release data in GitHub. If version is empty, it syncs the last 10
	// releases.
	SyncAgentVersions(ctx context.Context, version string) ([]*model.AnyResourceStatus, error)

	// Configurations TODO(doc)
	Configurations(ctx context.Context) ([]*model.Configuration, error)
	// Configuration TODO(doc)
	Configuration(ctx context.Context, name string) (*model.Configuration, error)
	// DeleteConfiguration TODO(doc)
	DeleteConfiguration(ctx context.Context, name string) error
	// RawConfiguration TODO(doc)
	RawConfiguration(ctx context.Context, name string) (string, error)
	CopyConfig(ctx context.Context, name, copyName string) error

	Sources(ctx context.Context) ([]*model.Source, error)
	Source(ctx context.Context, name string) (*model.Source, error)
	DeleteSource(ctx context.Context, name string) error

	SourceTypes(ctx context.Context) ([]*model.SourceType, error)
	SourceType(ctx context.Context, name string) (*model.SourceType, error)
	DeleteSourceType(ctx context.Context, name string) error

	Processors(ctx context.Context) ([]*model.Processor, error)
	Processor(ctx context.Context, name string) (*model.Processor, error)
	DeleteProcessor(ctx context.Context, name string) error

	ProcessorTypes(ctx context.Context) ([]*model.ProcessorType, error)
	ProcessorType(ctx context.Context, name string) (*model.ProcessorType, error)
	DeleteProcessorType(ctx context.Context, name string) error

	Destinations(ctx context.Context) ([]*model.Destination, error)
	Destination(ctx context.Context, name string) (*model.Destination, error)
	DeleteDestination(ctx context.Context, name string) error

	DestinationTypes(ctx context.Context) ([]*model.DestinationType, error)
	DestinationType(ctx context.Context, name string) (*model.DestinationType, error)
	DeleteDestinationType(ctx context.Context, name string) error

	// Apply TODO(doc)
	Apply(ctx context.Context, r []*model.AnyResource) ([]*model.AnyResourceStatus, error)
	// Delete TODO(doc)
	Delete(ctx context.Context, r []*model.AnyResource) ([]*model.AnyResourceStatus, error)

	// Version returns the BindPlane version
	Version(ctx context.Context) (version.Version, error)

	// AgentInstallCommand TODO(doc)
	AgentInstallCommand(ctx context.Context, options AgentInstallOptions) (string, error)
	// AgentUpgrade TODO(doc)
	AgentUpgrade(ctx context.Context, id string, version string) error

	// AgentLabels gets the labels for an agent
	AgentLabels(ctx context.Context, id string) (*model.Labels, error)
	// ApplyAgentLabels applies the specified labels to an agent, merging the specified labels with the existing labels
	// and returning the labels of the agent
	ApplyAgentLabels(ctx context.Context, id string, labels *model.Labels, override bool) (*model.Labels, error)
}

BindPlane TODO(doc)

func NewBindPlane

func NewBindPlane(config *common.Client, logger *zap.Logger) (BindPlane, error)

NewBindPlane takes a client configuration, logger and returns a new BindPlane.

type QueryOption

type QueryOption func(*queryOptions)

QueryOption is an option used in may Store queries

func WithLimit

func WithLimit(limit int) QueryOption

WithLimit sets the maximum number of results to return. For paging, if the pages have 10 items per page, set the limit to 10.

func WithOffset

func WithOffset(offset int) QueryOption

WithOffset sets the offset for the results to return. For paging, if the pages have 10 items per page and this is the 3rd page, set the offset to 20.

func WithQuery

func WithQuery(query string) QueryOption

WithQuery adds a search query string to the query options

func WithSelector

func WithSelector(selector string) QueryOption

WithSelector adds a selector to the query options

func WithSort

func WithSort(field string) QueryOption

WithSort sets the sort order for the request. The sort value is the name of the field, sorted ascending. To sort descending, prefix the field with a minus sign (-). Some Stores only allow sorting by certain fields. Sort values not supported will be ignored.

Jump to

Keyboard shortcuts

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