Documentation ¶
Overview ¶
Package client provides a go client for interacting with the BindPlane OP server. Most of the functions depend on the BindPlane REST API internally.
Index ¶
- func LogRequestError(logger *zap.Logger, err error, endpoint string)
- type AgentInstallOptions
- type BindPlane
- type BindplaneClient
- func (c *BindplaneClient) Agent(_ context.Context, id string) (*model.Agent, error)
- func (c *BindplaneClient) AgentInstallCommand(_ context.Context, options AgentInstallOptions) (string, error)
- func (c *BindplaneClient) AgentLabels(_ context.Context, id string) (*model.Labels, error)
- func (c *BindplaneClient) AgentUpgrade(_ context.Context, id string, version string) error
- func (c *BindplaneClient) AgentVersion(ctx context.Context, name string) (*model.AgentVersion, error)
- func (c *BindplaneClient) AgentVersions(ctx context.Context) ([]*model.AgentVersion, error)
- func (c *BindplaneClient) Agents(_ context.Context, options QueryOptions) ([]*model.Agent, error)
- func (c *BindplaneClient) Apply(_ context.Context, resources []*model.AnyResource) ([]*model.AnyResourceStatus, error)
- func (c *BindplaneClient) ApplyAgentLabels(_ context.Context, id string, labels *model.Labels, overwrite bool) (*model.Labels, error)
- func (c *BindplaneClient) Configuration(ctx context.Context, name string) (*model.Configuration, error)
- func (c *BindplaneClient) Configurations(_ context.Context) ([]*model.Configuration, error)
- func (c *BindplaneClient) CopyConfig(_ context.Context, name, copyName string) error
- func (c *BindplaneClient) Delete(_ context.Context, resources []*model.AnyResource) ([]*model.AnyResourceStatus, error)
- func (c *BindplaneClient) DeleteAgentVersion(ctx context.Context, name string) error
- func (c *BindplaneClient) DeleteAgents(_ context.Context, ids []string) ([]*model.Agent, error)
- func (c *BindplaneClient) DeleteConfiguration(ctx context.Context, name string) error
- func (c *BindplaneClient) DeleteDestination(ctx context.Context, name string) error
- func (c *BindplaneClient) DeleteDestinationType(ctx context.Context, name string) error
- func (c *BindplaneClient) DeleteProcessor(ctx context.Context, name string) error
- func (c *BindplaneClient) DeleteProcessorType(ctx context.Context, name string) error
- func (c *BindplaneClient) DeleteResource(_ context.Context, resourcesURL string, name string) error
- func (c *BindplaneClient) DeleteSource(ctx context.Context, name string) error
- func (c *BindplaneClient) DeleteSourceType(ctx context.Context, name string) error
- func (c *BindplaneClient) Destination(ctx context.Context, name string) (*model.Destination, error)
- func (c *BindplaneClient) DestinationType(ctx context.Context, name string) (*model.DestinationType, error)
- func (c *BindplaneClient) DestinationTypes(ctx context.Context) ([]*model.DestinationType, error)
- func (c *BindplaneClient) Destinations(ctx context.Context) ([]*model.Destination, error)
- func (c *BindplaneClient) PauseRollout(ctx context.Context, name string) (*model.Configuration, error)
- func (c *BindplaneClient) Processor(ctx context.Context, name string) (*model.Processor, error)
- func (c *BindplaneClient) ProcessorType(ctx context.Context, name string) (*model.ProcessorType, error)
- func (c *BindplaneClient) ProcessorTypes(ctx context.Context) ([]*model.ProcessorType, error)
- func (c *BindplaneClient) Processors(ctx context.Context) ([]*model.Processor, error)
- func (c *BindplaneClient) RawConfiguration(ctx context.Context, name string) (string, error)
- func (c *BindplaneClient) Resource(ctx context.Context, resourcesURL string, name string, result any) error
- func (c *BindplaneClient) ResourceHistory(ctx context.Context, kind model.Kind, name string) ([]*model.AnyResource, error)
- func (c *BindplaneClient) Resources(ctx context.Context, resourcesURL string, result any) error
- func (c *BindplaneClient) ResumeRollout(ctx context.Context, name string) (*model.Configuration, error)
- func (c *BindplaneClient) RolloutStatus(ctx context.Context, name string) (*model.Configuration, error)
- func (c *BindplaneClient) Source(ctx context.Context, name string) (*model.Source, error)
- func (c *BindplaneClient) SourceType(ctx context.Context, name string) (*model.SourceType, error)
- func (c *BindplaneClient) SourceTypes(ctx context.Context) ([]*model.SourceType, error)
- func (c *BindplaneClient) Sources(ctx context.Context) ([]*model.Source, error)
- func (c *BindplaneClient) StartRollout(ctx context.Context, name string, options *model.RolloutOptions) (*model.Configuration, error)
- func (c *BindplaneClient) StatusError(resp *resty.Response, err error, message string) error
- func (c *BindplaneClient) SyncAgentVersions(_ context.Context, version string) ([]*model.AnyResourceStatus, error)
- func (c *BindplaneClient) UnauthorizedError(resp *resty.Response) error
- func (c *BindplaneClient) UpdateRollout(ctx context.Context, name string) (*model.Configuration, error)
- func (c *BindplaneClient) UpdateRollouts(ctx context.Context) ([]*model.Configuration, error)
- func (c *BindplaneClient) Version(_ context.Context) (version.Version, error)
- type QueryOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AgentInstallOptions ¶
type AgentInstallOptions struct { // Platform is the platform the agent will run on, e.g. "linux" Platform string // Version is the agent release version to install. Available release versions of the observiq-otel-collector are // available at [observiq-otel-collector Releases] // // [observiq-otel-collector Releases]: https://github.com/observIQ/observiq-otel-collector/releases Version string // Labels is a string representation of the agents labels, e.g. "platform=dev,os=windows,app=nginx" Labels string // SecretKey is the secret key used to authenticate agents with BindPlane OP SecretKey string // RemoteURL is the URL that the agent will use to connect to BindPlane OP RemoteURL string }
AgentInstallOptions contains configuration options used for installing an agent.
type BindPlane ¶
type BindPlane interface { // Agents returns a list of Agents. Agents(ctx context.Context, options QueryOptions) ([]*model.Agent, error) // Agent returns a single Agent. Agent(ctx context.Context, id string) (*model.Agent, error) // DeleteAgents deletes multiple agents by ID. DeleteAgents(ctx context.Context, agentIDs []string) ([]*model.Agent, error) // AgentVersions returns a list of AgentVersion resources. AgentVersions(ctx context.Context) ([]*model.AgentVersion, error) // AgentVersion returns a single AgentVersion resources by name. AgentVersion(ctx context.Context, name string) (*model.AgentVersion, error) // DeleteAgentVersion deletes an AgentVersion resource by name. 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 returns a list of Configuration resources. Configurations(ctx context.Context) ([]*model.Configuration, error) // Configuration returns a single Configuration resource from GET /v1/configurations/:name Configuration(ctx context.Context, name string) (*model.Configuration, error) // Delete configuration deletes a single configuration reseource. DeleteConfiguration(ctx context.Context, name string) error // RawConfiguration returns the raw OpenTelemetry configuration for the configuration with // the specified name. This can either be the raw value of a raw configuration or the // rendered value of a configuration with sources and destinations. RawConfiguration(ctx context.Context, name string) (string, error) // CopyConfig creates a deep copy of an existing resource under a new name. CopyConfig(ctx context.Context, name, copyName string) error // Sources returns a list of all Source resources. Sources(ctx context.Context) ([]*model.Source, error) // Source returns a single Source resource by name. Source(ctx context.Context, name string) (*model.Source, error) // DeleteSource deletes a single Source resource by name. DeleteSource(ctx context.Context, name string) error // SourceTypes returns a list of all SourceType resources. SourceTypes(ctx context.Context) ([]*model.SourceType, error) // SourceType returns a single SourceType resource by name. SourceType(ctx context.Context, name string) (*model.SourceType, error) // DeleteSourceType deletes a single SourceType resource by name. DeleteSourceType(ctx context.Context, name string) error // Processors returns a list of all Processor resources. Processors(ctx context.Context) ([]*model.Processor, error) // Processor returns a single Processor resource by name. Processor(ctx context.Context, name string) (*model.Processor, error) // DeleteProcessor deletes a single Processor resource by name. DeleteProcessor(ctx context.Context, name string) error // ProcessorTypes returns a list of all ProcessorType resources. ProcessorTypes(ctx context.Context) ([]*model.ProcessorType, error) // ProcessorType returns a single ProcessorType resource by name. ProcessorType(ctx context.Context, name string) (*model.ProcessorType, error) // DeleteProcessorType deletes a single ProcessorType resource by name. DeleteProcessorType(ctx context.Context, name string) error // Destinations returns a list of all Destination resources. Destinations(ctx context.Context) ([]*model.Destination, error) // Destination returns a single Destination resource by name. Destination(ctx context.Context, name string) (*model.Destination, error) // DeleteDestination deletes a single Destination resource by name. DeleteDestination(ctx context.Context, name string) error // DestinationTypes returns a list of all DestinationType resources. DestinationTypes(ctx context.Context) ([]*model.DestinationType, error) // DestinationType returns a single DestinationType by name. DestinationType(ctx context.Context, name string) (*model.DestinationType, error) // DeleteDestinationType deletes a single Destination resource by name. DeleteDestinationType(ctx context.Context, name string) error // Apply upserts multiple resources of any kind. Apply(ctx context.Context, r []*model.AnyResource) ([]*model.AnyResourceStatus, error) // Delete deletes multiple resources, minimum required fields to delete are Kind and Metadata.Name. Delete(ctx context.Context, r []*model.AnyResource) ([]*model.AnyResourceStatus, error) // Version returns the version of the BindPlane-OP server. Version(ctx context.Context) (version.Version, error) // AgentInstallCommand returns the installation command for the given AgentInstallationOptions. AgentInstallCommand(ctx context.Context, options AgentInstallOptions) (string, error) // AgentUpgrade upgrades the agent with given ID to the specified version. 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) // RolloutStatus returns the status of a rollout RolloutStatus(ctx context.Context, name string) (*model.Configuration, error) // StartRollout starts a rollout that is pending StartRollout(ctx context.Context, name string, options *model.RolloutOptions) (*model.Configuration, error) // PauseRollout pauses a rollout that is started PauseRollout(ctx context.Context, name string) (*model.Configuration, error) // ResumeRollout resumes a rollout that is paused ResumeRollout(ctx context.Context, name string) (*model.Configuration, error) // UpdateRollout updates a rollout UpdateRollout(ctx context.Context, name string) (*model.Configuration, error) // UpdateRollouts updates all active rollouts UpdateRollouts(ctx context.Context) ([]*model.Configuration, error) // ResourceHistory retrieves the history of the rollout ResourceHistory(ctx context.Context, kind model.Kind, name string) ([]*model.AnyResource, error) }
BindPlane is a REST client for BindPlane OP.
type BindplaneClient ¶ added in v1.16.0
BindplaneClient is the implementation of the Bindplane interface
func (*BindplaneClient) AgentInstallCommand ¶ added in v1.16.0
func (c *BindplaneClient) AgentInstallCommand(_ context.Context, options AgentInstallOptions) (string, error)
AgentInstallCommand returns the agent install command based on the install options
func (*BindplaneClient) AgentLabels ¶ added in v1.16.0
AgentLabels retrieves labels for agent with id
func (*BindplaneClient) AgentUpgrade ¶ added in v1.16.0
AgentUpgrade sends a request to upgrade agent with id to version
func (*BindplaneClient) AgentVersion ¶ added in v1.16.0
func (c *BindplaneClient) AgentVersion(ctx context.Context, name string) (*model.AgentVersion, error)
AgentVersion retrieves the agent version with name
func (*BindplaneClient) AgentVersions ¶ added in v1.16.0
func (c *BindplaneClient) AgentVersions(ctx context.Context) ([]*model.AgentVersion, error)
AgentVersions retries all gent versions
func (*BindplaneClient) Agents ¶ added in v1.16.0
func (c *BindplaneClient) Agents(_ context.Context, options QueryOptions) ([]*model.Agent, error)
Agents retries agents based on the query
func (*BindplaneClient) Apply ¶ added in v1.16.0
func (c *BindplaneClient) Apply(_ context.Context, resources []*model.AnyResource) ([]*model.AnyResourceStatus, error)
Apply apply resources
func (*BindplaneClient) ApplyAgentLabels ¶ added in v1.16.0
func (c *BindplaneClient) ApplyAgentLabels(_ context.Context, id string, labels *model.Labels, overwrite bool) (*model.Labels, error)
ApplyAgentLabels apply labels to agent with id
func (*BindplaneClient) Configuration ¶ added in v1.16.0
func (c *BindplaneClient) Configuration(ctx context.Context, name string) (*model.Configuration, error)
Configuration retrieves configuration with name
func (*BindplaneClient) Configurations ¶ added in v1.16.0
func (c *BindplaneClient) Configurations(_ context.Context) ([]*model.Configuration, error)
Configurations retrieves all configurations
func (*BindplaneClient) CopyConfig ¶ added in v1.16.0
func (c *BindplaneClient) CopyConfig(_ context.Context, name, copyName string) error
CopyConfig copies config with name and gives the new config copyName
func (*BindplaneClient) Delete ¶ added in v1.16.0
func (c *BindplaneClient) Delete(_ context.Context, resources []*model.AnyResource) ([]*model.AnyResourceStatus, error)
Delete deletes passed in resources
func (*BindplaneClient) DeleteAgentVersion ¶ added in v1.16.0
func (c *BindplaneClient) DeleteAgentVersion(ctx context.Context, name string) error
DeleteAgentVersion deletes the agent version with name
func (*BindplaneClient) DeleteAgents ¶ added in v1.16.0
DeleteAgents deletes agents with the ids
func (*BindplaneClient) DeleteConfiguration ¶ added in v1.16.0
func (c *BindplaneClient) DeleteConfiguration(ctx context.Context, name string) error
DeleteConfiguration deletes the configuration with name
func (*BindplaneClient) DeleteDestination ¶ added in v1.16.0
func (c *BindplaneClient) DeleteDestination(ctx context.Context, name string) error
DeleteDestination deletes destination with given name
func (*BindplaneClient) DeleteDestinationType ¶ added in v1.16.0
func (c *BindplaneClient) DeleteDestinationType(ctx context.Context, name string) error
DeleteDestinationType deletes destination type with given name
func (*BindplaneClient) DeleteProcessor ¶ added in v1.16.0
func (c *BindplaneClient) DeleteProcessor(ctx context.Context, name string) error
DeleteProcessor deletes the processor with the given name
func (*BindplaneClient) DeleteProcessorType ¶ added in v1.16.0
func (c *BindplaneClient) DeleteProcessorType(ctx context.Context, name string) error
DeleteProcessorType deletes processor type with given name
func (*BindplaneClient) DeleteResource ¶ added in v1.16.0
DeleteResource deletes the resource at the URL of name
func (*BindplaneClient) DeleteSource ¶ added in v1.16.0
func (c *BindplaneClient) DeleteSource(ctx context.Context, name string) error
DeleteSource deletes the source with the given name
func (*BindplaneClient) DeleteSourceType ¶ added in v1.16.0
func (c *BindplaneClient) DeleteSourceType(ctx context.Context, name string) error
DeleteSourceType deletes source type with given name
func (*BindplaneClient) Destination ¶ added in v1.16.0
func (c *BindplaneClient) Destination(ctx context.Context, name string) (*model.Destination, error)
Destination retrieves destination with given name
func (*BindplaneClient) DestinationType ¶ added in v1.16.0
func (c *BindplaneClient) DestinationType(ctx context.Context, name string) (*model.DestinationType, error)
DestinationType retrieves destination type with given name
func (*BindplaneClient) DestinationTypes ¶ added in v1.16.0
func (c *BindplaneClient) DestinationTypes(ctx context.Context) ([]*model.DestinationType, error)
DestinationTypes retrieves all destination types
func (*BindplaneClient) Destinations ¶ added in v1.16.0
func (c *BindplaneClient) Destinations(ctx context.Context) ([]*model.Destination, error)
Destinations retrieves all destinations
func (*BindplaneClient) PauseRollout ¶ added in v1.16.0
func (c *BindplaneClient) PauseRollout(ctx context.Context, name string) (*model.Configuration, error)
PauseRollout pauses a rollout that is started
func (*BindplaneClient) ProcessorType ¶ added in v1.16.0
func (c *BindplaneClient) ProcessorType(ctx context.Context, name string) (*model.ProcessorType, error)
ProcessorType retrieves processor type with given name
func (*BindplaneClient) ProcessorTypes ¶ added in v1.16.0
func (c *BindplaneClient) ProcessorTypes(ctx context.Context) ([]*model.ProcessorType, error)
ProcessorTypes retrieves all processor types
func (*BindplaneClient) Processors ¶ added in v1.16.0
Processors retrieves all processors
func (*BindplaneClient) RawConfiguration ¶ added in v1.16.0
RawConfiguration retrieves the raw config with name
func (*BindplaneClient) Resource ¶ added in v1.16.0
func (c *BindplaneClient) Resource(ctx context.Context, resourcesURL string, name string, result any) error
Resource gets the Resource with the specified name from the REST server and stores it in the provided result.
func (*BindplaneClient) ResourceHistory ¶ added in v1.16.0
func (c *BindplaneClient) ResourceHistory(ctx context.Context, kind model.Kind, name string) ([]*model.AnyResource, error)
ResourceHistory retrieves the history of the rollout
func (*BindplaneClient) Resources ¶ added in v1.16.0
Resources gets the Resources from the REST server and stores them in the provided result.
func (*BindplaneClient) ResumeRollout ¶ added in v1.16.0
func (c *BindplaneClient) ResumeRollout(ctx context.Context, name string) (*model.Configuration, error)
ResumeRollout resumes a rollout that is paused
func (*BindplaneClient) RolloutStatus ¶ added in v1.16.0
func (c *BindplaneClient) RolloutStatus(ctx context.Context, name string) (*model.Configuration, error)
RolloutStatus returns the status of a rollout
func (*BindplaneClient) SourceType ¶ added in v1.16.0
func (c *BindplaneClient) SourceType(ctx context.Context, name string) (*model.SourceType, error)
SourceType retrieves source type with given name
func (*BindplaneClient) SourceTypes ¶ added in v1.16.0
func (c *BindplaneClient) SourceTypes(ctx context.Context) ([]*model.SourceType, error)
SourceTypes retrieves all source types
func (*BindplaneClient) StartRollout ¶ added in v1.16.0
func (c *BindplaneClient) StartRollout(ctx context.Context, name string, options *model.RolloutOptions) (*model.Configuration, error)
StartRollout starts a rollout that is pending
func (*BindplaneClient) StatusError ¶ added in v1.16.0
func (c *BindplaneClient) StatusError(resp *resty.Response, err error, message string) error
StatusError returns and error if resp is not 2XX or err is not nil
func (*BindplaneClient) SyncAgentVersions ¶ added in v1.16.0
func (c *BindplaneClient) SyncAgentVersions(_ context.Context, version string) ([]*model.AnyResourceStatus, error)
SyncAgentVersions syncs the specific agent version
func (*BindplaneClient) UnauthorizedError ¶ added in v1.16.0
func (c *BindplaneClient) UnauthorizedError(resp *resty.Response) error
UnauthorizedError checks if response is Unauthorized error and returns error if it is
func (*BindplaneClient) UpdateRollout ¶ added in v1.16.0
func (c *BindplaneClient) UpdateRollout(ctx context.Context, name string) (*model.Configuration, error)
UpdateRollout updates a rollout
func (*BindplaneClient) UpdateRollouts ¶ added in v1.16.0
func (c *BindplaneClient) UpdateRollouts(ctx context.Context) ([]*model.Configuration, error)
UpdateRollouts updates all active rollouts