remote

package
v1.13.0 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ProviderEndpointEnvKey holds config provider endpoint.
	//nolint:gosec // Potential hardcoded credentials
	ProviderEndpointEnvKey = "CONFIG_PROVIDER_ENDPOINT"
	// ProviderIdentifierEnvKey holds config provider identifier.
	ProviderIdentifierEnvKey = "CONFIG_PROVIDER_IDENTIFIER"
	// ProviderAPIKeyEnvKey holds config provider API key.
	//nolint:gosec // warns us about 'Potential hardcoded credentials' but there is no security issue here
	ProviderAPIKeyEnvKey = "CONFIG_PROVIDER_API_KEY"
)

Variables

This section is empty.

Functions

func IsEnabled added in v1.10.0

func IsEnabled() bool

IsEnabled returns true if remote configuration is set.

Types

type Config

type Config struct {
	Endpoint   string
	Identifier string
	APIKey     string
}

Config holds configuration for remote configuration.

func GetConfig

func GetConfig() (Config, bool)

GetConfig returns remote configuration if it is set.

type Deployment

type Deployment struct {
	ResourceVersion int
	YAMLConfig      string
}

Deployment returns deployment with Botkube configuration.

type DeploymentClient

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

DeploymentClient defines GraphQL client for Deployment.

func NewDeploymentClient

func NewDeploymentClient(client GraphQLClient) *DeploymentClient

NewDeploymentClient initializes GraphQL client.

func (*DeploymentClient) GetConfigWithResourceVersion

func (g *DeploymentClient) GetConfigWithResourceVersion(ctx context.Context) (Deployment, error)

GetConfigWithResourceVersion retrieves deployment by id.

func (*DeploymentClient) GetResourceVersion

func (g *DeploymentClient) GetResourceVersion(ctx context.Context) (int, error)

GetResourceVersion retrieves resource version for Deployment.

type Gql

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

Gql defines GraphQL client data structure.

func NewDefaultGqlClient

func NewDefaultGqlClient(remoteCfg Config) *Gql

NewDefaultGqlClient initializes GraphQL client with default options.

func NewGqlClient

func NewGqlClient(options ...Option) *Gql

NewGqlClient initializes GraphQL client.

func (*Gql) Client

func (g *Gql) Client() *graphql.Client

Client returns GraphQL client.

func (*Gql) DeploymentID

func (g *Gql) DeploymentID() string

DeploymentID returns deployment ID.

type GraphQLClient

type GraphQLClient interface {
	Client() *graphql.Client
	DeploymentID() string
}

GraphQLClient defines GraphQL client.

type Option

type Option func(*Gql)

Option define GraphQL client option.

func WithAPIKey

func WithAPIKey(apiKey string) Option

WithAPIKey configures API key for GraphQL endpoint.

func WithDeploymentID

func WithDeploymentID(id string) Option

WithDeploymentID configures deployment id for GraphQL endpoint.

func WithEndpoint

func WithEndpoint(url string) Option

WithEndpoint configures ApiURL for GraphQL endpoint.

Jump to

Keyboard shortcuts

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