client

package
v0.56.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2024 License: Apache-2.0 Imports: 18 Imported by: 1

Documentation

Overview

Package client is a client usable in the agent or an agent sub-process to receive configs from the core remoteconfig service.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithAgent

func WithAgent(name, version string) func(opts *Options)

WithAgent specifies the client name and version

func WithCluster

func WithCluster(name, id string) func(opts *Options)

WithCluster specifies the cluster name and id

func WithDirectorRootOverride

func WithDirectorRootOverride(site string, directorRootOverride string) func(opts *Options)

WithDirectorRootOverride specifies the director root to

func WithPollInterval

func WithPollInterval(duration time.Duration) func(opts *Options)

WithPollInterval specifies the polling interval

func WithProducts

func WithProducts(products ...string) func(opts *Options)

WithProducts specifies the product lists

func WithUpdater added in v0.52.0

func WithUpdater(tags ...string) func(opts *Options)

WithUpdater specifies that this client is an updater

func WithoutTufVerification

func WithoutTufVerification() func(opts *Options)

WithoutTufVerification disables TUF verification of configs

Types

type Client

type Client struct {
	Options

	ID string
	// contains filtered or unexported fields
}

Client is a remote-configuration client to obtain configurations from the local API

func NewClient

func NewClient(updater ConfigFetcher, opts ...func(o *Options)) (*Client, error)

NewClient creates a new client

func NewGRPCClient

func NewGRPCClient(ipcAddress string, cmdPort string, authTokenFetcher TokenFetcher, opts ...func(o *Options)) (*Client, error)

NewGRPCClient creates a new client that retrieves updates over the datadog-agent's secure GRPC client

func NewUnverifiedGRPCClient

func NewUnverifiedGRPCClient(ipcAddress string, cmdPort string, authTokenFetcher TokenFetcher, opts ...func(o *Options)) (*Client, error)

NewUnverifiedGRPCClient creates a new client that does not perform any TUF verification

func NewUnverifiedMRFGRPCClient added in v0.54.0

func NewUnverifiedMRFGRPCClient(ipcAddress string, cmdPort string, authTokenFetcher TokenFetcher, opts ...func(o *Options)) (*Client, error)

NewUnverifiedMRFGRPCClient creates a new client that does not perform any TUF verification and gets failover configs via gRPC

func (*Client) Close

func (c *Client) Close()

Close terminates the client's poll loop.

A client that has been closed cannot be restarted

func (*Client) GetConfigs

func (c *Client) GetConfigs(product string) map[string]state.RawConfig

GetConfigs returns the current configs applied of a product.

func (*Client) SetAgentName

func (c *Client) SetAgentName(agentName string)

SetAgentName updates the agent name of the RC client should only be used by the fx component

func (*Client) SetCWSWorkloads

func (c *Client) SetCWSWorkloads(workloads []string)

SetCWSWorkloads updates the list of workloads that needs cws profiles

func (*Client) SetUpdaterPackagesState added in v0.53.0

func (c *Client) SetUpdaterPackagesState(packages []*pbgo.PackageState)

SetUpdaterPackagesState sets the updater package state

func (*Client) Start

func (c *Client) Start()

Start starts the client's poll loop.

If the client is already started, this is a no-op. At this time, a client that has been stopped cannot be restarted.

func (*Client) Subscribe

func (c *Client) Subscribe(product string, fn func(update map[string]state.RawConfig, applyStateCallback func(string, state.ApplyStatus)))

Subscribe subscribes to config updates of a product.

func (*Client) UpdateApplyStatus

func (c *Client) UpdateApplyStatus(cfgPath string, status state.ApplyStatus)

UpdateApplyStatus updates the config's metadata to reflect its applied status

type ConfigFetcher added in v0.52.0

type ConfigFetcher interface {
	ClientGetConfigs(context.Context, *pbgo.ClientGetConfigsRequest) (*pbgo.ClientGetConfigsResponse, error)
}

ConfigFetcher defines the interface that an agent client uses to get config updates

func NewAgentGRPCConfigFetcher

func NewAgentGRPCConfigFetcher(ipcAddress string, cmdPort string, authTokenFetcher TokenFetcher) (ConfigFetcher, error)

NewAgentGRPCConfigFetcher returns a gRPC config fetcher using the secure agent client

func NewMRFAgentGRPCConfigFetcher added in v0.54.0

func NewMRFAgentGRPCConfigFetcher(ipcAddress string, cmdPort string, authTokenFetcher TokenFetcher) (ConfigFetcher, error)

NewMRFAgentGRPCConfigFetcher returns a gRPC config fetcher using the secure agent MRF client

type Handler added in v0.53.0

type Handler func(update map[string]state.RawConfig, applyStateCallback func(string, state.ApplyStatus))

Handler is a function that is called when a config update is received.

type Options

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

Options describes the client options

type TokenFetcher

type TokenFetcher func() (string, error)

TokenFetcher defines the callback used to fetch a token

Jump to

Keyboard shortcuts

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