client

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: May 27, 2022 License: Apache-2.0 Imports: 10 Imported by: 2

Documentation

Overview

Package client provides a client over the REST HTTP API of Calyptia Cloud.

Index

Constants

View Source
const (
	// DefaultBaseURL of the API.
	DefaultBaseURL = "https://cloud-api.calyptia.com"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	BaseURL string
	// Tip: Use oauth2.NewClient(context.Context, *oauth2.TokenSource)
	Client *http.Client
	// contains filtered or unexported fields
}

Client is the client over the REST HTTP API of Calyptia Cloud.

func New

func New() *Client

New default client.

func (*Client) AcceptInvitation

func (c *Client) AcceptInvitation(ctx context.Context, payload types.AcceptInvitation) error

AcceptInvitation to a project. The project to which you join is parsed from the token.

func (*Client) Agent

func (c *Client) Agent(ctx context.Context, agentID string) (types.Agent, error)

Agent by ID.

func (*Client) AgentConfigHistory

func (c *Client) AgentConfigHistory(ctx context.Context, agentID string, params types.AgentConfigHistoryParams) (types.AgentConfigHistory, error)

AgentConfigHistory in descending order. Every time an agent config is updated, a new history entry with the change is created.

func (*Client) AgentMetrics

func (c *Client) AgentMetrics(ctx context.Context, agentID string, params types.MetricsParams) (types.AgentMetrics, error)

AgentMetrics contains an overview of the aggregated metrics for an agent. It includes metrics link the amount of records, bytes, and errors per plugin.

func (*Client) Agents

func (c *Client) Agents(ctx context.Context, projectID string, params types.AgentsParams) (types.Agents, error)

Agents from the given project in descending order.

func (*Client) Aggregator

func (c *Client) Aggregator(ctx context.Context, aggregatorID string) (types.Aggregator, error)

Aggregator by ID.

func (*Client) AggregatorMetrics

func (c *Client) AggregatorMetrics(ctx context.Context, aggregatorID string, params types.MetricsParams) (types.AggregatorMetrics, error)

AggregatorMetrics contains an overview of the aggregated metrics for a project. It includes metrics link the amount of records, bytes, and errors per plugin.

func (*Client) Aggregators

func (c *Client) Aggregators(ctx context.Context, projectID string, params types.AggregatorsParams) (types.Aggregators, error)

Aggregators from a project in descending order.

func (*Client) CreateAggregator

func (c *Client) CreateAggregator(ctx context.Context, payload types.CreateAggregator) (types.CreatedAggregator, error)

CreateAggregator within a project. The project in which the aggregator is created is parser from the authorization token. Users are not allowed to create aggregators.

func (*Client) CreateEnvironment added in v0.3.1

func (c *Client) CreateEnvironment(ctx context.Context, projectID string, payload types.CreateEnvironment) (types.CreatedEnvironment, error)

CreateEnvironment within a project.

func (*Client) CreateInvitation

func (c *Client) CreateInvitation(ctx context.Context, projectID string, payload types.CreateInvitation) error

CreateInvitation to a project. This will send an invitation email with a link to join to the email address provided.

func (*Client) CreatePipeline

func (c *Client) CreatePipeline(ctx context.Context, aggregatorID string, payload types.CreatePipeline) (types.CreatedPipeline, error)

CreatePipeline within an aggregator. The pipeline name must be unique within the aggregator. The resource profile must exist already. If you don't provide one, it will default to "best-effort-low-resource". Use them to easily deploy configured agents to the aggregator.

func (*Client) CreatePipelineFile

func (c *Client) CreatePipelineFile(ctx context.Context, pipelineID string, payload types.CreatePipelineFile) (types.CreatedPipelineFile, error)

CreatePipelineFile within a pipeline. The given name is unique within the pipeline. These files can be referenced by their name within a fluentbit configuration file like so `{{files.thename}}`. Use them to share common stuff like parsers.

func (*Client) CreatePipelinePort

func (c *Client) CreatePipelinePort(ctx context.Context, pipelineID string, payload types.CreatePipelinePort) (types.CreatedPipelinePort, error)

CreatePipelinePort within a pipeline. Ports can automatically be parsed from a config file, but this action allows you to programatically add more.

func (*Client) CreatePipelineSecret

func (c *Client) CreatePipelineSecret(ctx context.Context, pipelineID string, payload types.CreatePipelineSecret) (types.CreatedPipelineSecret, error)

CreatePipelineSecret within a pipeline. The given name is unique within the pipeline. These secrets can be referenced by their name within a fluentbit configuration file like so `{{secrets.thename}}`. Use them to hide sensible values from your config file.

func (*Client) CreateProject

func (c *Client) CreateProject(ctx context.Context, payload types.CreateProject) (types.CreatedProject, error)

CreateProject creates a new project. A project is the base unit of work at Calyptia Cloud. You can register agents here, create aggregators in which you can deploy an entire set of pipelines, and monitor them. You can even invite other people to the project and have a team.

func (*Client) CreateResourceProfile

func (c *Client) CreateResourceProfile(ctx context.Context, aggregatorID string, payload types.CreateResourceProfile) (types.CreatedResourceProfile, error)

CreateResourceProfile within an aggregator. A resource profile is a specification of a resource used during the deployment of a pipeline. By default, when you setup an aggregator, Calyptia Cloud will generate 3 resource profiles for you: - high-performance-guaranteed-delivery. - high-performance-optimal-throughput. - best-effort-low-resource.

func (*Client) CreateToken

func (c *Client) CreateToken(ctx context.Context, projectID string, payload types.CreateToken) (types.Token, error)

CreateToken within a project. These tokens are to authorize other applications to access the project. For example: - an agent might use it to register itself to the project. - you might create a new aggregator in the project using the aggregator CLI. - you might use it within the Calyptia CLI to grant access to your project.

func (*Client) DeleteAgent

func (c *Client) DeleteAgent(ctx context.Context, agentID string) error

DeleteAgent by its ID.

func (*Client) DeleteAggregator

func (c *Client) DeleteAggregator(ctx context.Context, aggregatorID string) error

DeleteAggregator by its ID.

func (*Client) DeleteEnvironment added in v0.3.1

func (c *Client) DeleteEnvironment(ctx context.Context, environmentID string) error

DeleteEnvironment by its ID.

func (*Client) DeletePipeline

func (c *Client) DeletePipeline(ctx context.Context, pipelineID string) error

DeletePipeline by its ID.

func (*Client) DeletePipelineFile

func (c *Client) DeletePipelineFile(ctx context.Context, fileID string) error

DeletePipelineFile by its ID. The file cannot be deleted if some pipeline config is still referencing it; you must delete the pipeline first if you want to delete the file.

func (*Client) DeletePipelinePort

func (c *Client) DeletePipelinePort(ctx context.Context, portID string) error

DeletePipelinePort by its ID.

func (*Client) DeletePipelineSecret

func (c *Client) DeletePipelineSecret(ctx context.Context, secretID string) error

DeletePipelineSecret by its ID. The secret cannot be deleted if some pipeline config is still referencing it; you must delete the pipeline first if you want to delete the secret.

func (*Client) DeleteResourceProfile

func (c *Client) DeleteResourceProfile(ctx context.Context, resourceProfileID string) error

DeleteResourceProfile by its ID. The profile cannot be deleted if some pipeline is still referencing it; you must delete the pipeline first if you want to delete the profile.

func (*Client) DeleteToken

func (c *Client) DeleteToken(ctx context.Context, tokenID string) error

DeleteToken by its ID. Once deleted, any application that might has been using it, will stop working.

func (*Client) Environments added in v0.3.1

func (c *Client) Environments(ctx context.Context, projectID string, params types.EnvironmentsParams) (types.Environments, error)

Environments from the given project in descending order.

func (*Client) Members

func (c *Client) Members(ctx context.Context, projectID string, params types.MembersParams) (types.Memberships, error)

Members from a project in descending order.

func (*Client) Pipeline

func (c *Client) Pipeline(ctx context.Context, pipelineID string, params types.PipelineParams) (types.Pipeline, error)

Pipeline by ID.

func (*Client) PipelineConfigHistory

func (c *Client) PipelineConfigHistory(ctx context.Context, pipelineID string, params types.PipelineConfigHistoryParams) (types.PipelineConfigHistory, error)

PipelineConfigHistory in descending order. Every time a pipeline config is updated, a new history entry with the change is created.

func (*Client) PipelineFile

func (c *Client) PipelineFile(ctx context.Context, fileID string) (types.PipelineFile, error)

PipelineFile by ID.

func (*Client) PipelineFiles

func (c *Client) PipelineFiles(ctx context.Context, pipelineID string, params types.PipelineFilesParams) (types.PipelineFiles, error)

PipelineFiles in descending order.

func (*Client) PipelineMetrics

func (c *Client) PipelineMetrics(ctx context.Context, pipelineID string, params types.MetricsParams) (types.AgentMetrics, error)

PipelineMetrics contains an overview of the aggregated metrics for a pipeline. It includes metrics link the amount of records, bytes, and errors per plugin.

func (*Client) PipelinePort

func (c *Client) PipelinePort(ctx context.Context, portID string) (types.PipelinePort, error)

PipelinePort by ID.

func (*Client) PipelinePorts

func (c *Client) PipelinePorts(ctx context.Context, pipelineID string, params types.PipelinePortsParams) (types.PipelinePorts, error)

PipelinePorts in descending order.

func (*Client) PipelineSecret

func (c *Client) PipelineSecret(ctx context.Context, secretID string) (types.PipelineSecret, error)

PipelineSecret by ID.

func (*Client) PipelineSecrets

func (c *Client) PipelineSecrets(ctx context.Context, pipelineID string, params types.PipelineSecretsParams) (types.PipelineSecrets, error)

PipelineSecrets in descending order.

func (*Client) PipelineStatusHistory

func (c *Client) PipelineStatusHistory(ctx context.Context, pipelineID string, params types.PipelineStatusHistoryParams) (types.PipelineStatusHistory, error)

PipelineStatusHistory in descending order. Every time a pipeline status is changed, a new history entry with the change is created.

func (*Client) Pipelines

func (c *Client) Pipelines(ctx context.Context, aggregatorID string, params types.PipelinesParams) (types.Pipelines, error)

Pipelines from an aggregator in descending order.

func (*Client) Project

func (c *Client) Project(ctx context.Context, projectID string) (types.Project, error)

Project by ID.

func (*Client) ProjectMetrics

func (c *Client) ProjectMetrics(ctx context.Context, projectID string, params types.MetricsParams) (types.ProjectMetrics, error)

ProjectMetrics contains an overview of the aggregated metrics for a project. It includes metrics link the amount of records, bytes, and errors per plugin.

func (*Client) ProjectPipelines

func (c *Client) ProjectPipelines(ctx context.Context, projectID string, params types.PipelinesParams) (types.Pipelines, error)

ProjectPipelines returns the entire set of pipelines from a project.

func (*Client) Projects

func (c *Client) Projects(ctx context.Context, params types.ProjectsParams) (types.Projects, error)

Projects you are a member of in descending order.

func (*Client) RegisterAgent

func (c *Client) RegisterAgent(ctx context.Context, payload types.RegisterAgent) (types.RegisteredAgent, error)

RegisterAgent within a project. The project in which the agent is registered is parsed from the authorization token. Users are not allowed to register agents.

func (*Client) ResourceProfile

func (c *Client) ResourceProfile(ctx context.Context, resourceProfileID string) (types.ResourceProfile, error)

ResourceProfile by ID.

func (*Client) ResourceProfiles

func (c *Client) ResourceProfiles(ctx context.Context, aggregatorID string, params types.ResourceProfilesParams) (types.ResourceProfiles, error)

ResourceProfiles from an aggregator in descending order.

func (*Client) SendVerificationEmail

func (c *Client) SendVerificationEmail(ctx context.Context) error

SendVerificationEmail sends a verification email to the user. When a new user registers within Calyptia Cloud with password, it should receive a verification email, in the case it didn't receive it, or the email expired already, use this endpoint to request a new one.

func (*Client) SetAgentToken

func (c *Client) SetAgentToken(s string)

SetAgentToken sets the "X-Agent-Token" header of the client.

func (*Client) SetAggregatorToken

func (c *Client) SetAggregatorToken(s string)

SetAggregatorToken sets the "X-Aggregator-Token" header of the client.

func (*Client) SetProjectToken

func (c *Client) SetProjectToken(s string)

SetProjectToken sets the "X-Project-Token" header of the client.

func (*Client) SetUserAgent

func (c *Client) SetUserAgent(s string)

SetUserAgent sets the "User-Agent" header of the client.

func (*Client) Token

func (c *Client) Token(ctx context.Context, tokenID string) (types.Token, error)

Token by ID.

func (*Client) Tokens

func (c *Client) Tokens(ctx context.Context, projectID string, params types.TokensParams) (types.Tokens, error)

Tokens from a project.

func (*Client) UpdateAgent

func (c *Client) UpdateAgent(ctx context.Context, agentID string, payload types.UpdateAgent) error

UpdateAgent by its ID. Users are allowed to only update a restricted set of fields (name); while agents are allowed to update the whole configuration.

func (*Client) UpdateAggregator

func (c *Client) UpdateAggregator(ctx context.Context, aggregatorID string, payload types.UpdateAggregator) error

UpdateAggregator by its ID.

func (*Client) UpdateEnvironment added in v0.3.1

func (c *Client) UpdateEnvironment(ctx context.Context, environmentID string, payload types.UpdateEnvironment) error

UpdateEnvironment by its ID.

func (*Client) UpdatePipeline

func (c *Client) UpdatePipeline(ctx context.Context, pipelineID string, opts types.UpdatePipeline) (types.UpdatedPipeline, error)

UpdatePipeline by its ID.

func (*Client) UpdatePipelineFile

func (c *Client) UpdatePipelineFile(ctx context.Context, fileID string, opts types.UpdatePipelineFile) error

UpdatePipelineFile by its ID.

func (*Client) UpdatePipelinePort

func (c *Client) UpdatePipelinePort(ctx context.Context, portID string, opts types.UpdatePipelinePort) error

UpdatePipelinePort by its ID.

func (*Client) UpdatePipelineSecret

func (c *Client) UpdatePipelineSecret(ctx context.Context, secretID string, opts types.UpdatePipelineSecret) error

UpdatePipelineSecret by its ID.

func (*Client) UpdateProject

func (c *Client) UpdateProject(ctx context.Context, projectID string, opts types.UpdateProject) error

UpdateProject by its ID.

func (*Client) UpdateResourceProfile

func (c *Client) UpdateResourceProfile(ctx context.Context, resourceProfileID string, opts types.UpdateResourceProfile) error

UpdateResourceProfile by its ID.

func (*Client) UpdateToken

func (c *Client) UpdateToken(ctx context.Context, tokenID string, opts types.UpdateToken) error

UpdateToken by its ID.

func (*Client) ValidateConfig

func (c *Client) ValidateConfig(ctx context.Context, agentType types.AgentType, payload types.ValidatingConfig) (types.ValidatedConfig, error)

ValidateConfig validates that an already parsed fluentbit or fluentd config is semantically valid. To parse the raw agent config take a look at https://github.com/calyptia/fluent-bit-config-parser.

func (*Client) ValidateConfigV2

func (c *Client) ValidateConfigV2(ctx context.Context, payload types.ValidatingConfig) (types.ValidatedConfigV2, error)

ValidateConfigV2 validates that an already parsed fluentbit(only) config to check if semantically valid To parse the raw agent config take a look at https://github.com/calyptia/fluent-bit-config-parser.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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