integration

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2025 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const GitHubAppName = "name"

GitHubAppName key to identify the GitHubApp name.

View Source
const (
	// QuayURL is the default URL for public Quay.
	QuayURL = "https://quay.io"
)

Variables

View Source
var ErrInvalidJSON = errors.New("invalid JSON")

ErrInvalidJSON is an error returned when a string is not a valid JSON.

View Source
var ErrInvalidURL = errors.New("invalid URL")

ErrInvalidURL is an error returned when a URL is invalid, malformed.

View Source
var ErrJSONContainsSpaces = errors.New("contains unexpected spaces")

ErrJSONContainsSpaces is an error returned when a JSON key or value contains spaces.

View Source
var ErrSecretAlreadyExists = fmt.Errorf("secret already exists")

ErrSecretAlreadyExists integration secret already exists.

Functions

func ValidateJSON

func ValidateJSON(p string, s string) error

ValidateJSON checks if the given string is a valid JSON and that there is no space character in any of the keys and values of a JSON object.

func ValidateURL

func ValidateURL(location string) error

ValidateURL check if the informed URL is valid.

Types

type ACS

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

ACS represents the ACS, Advanced Cluster Security, integration. The coordinates to connect TSSC with a external instance of ACS.

func NewACS

func NewACS() *ACS

NewACS creates a new instance of the ACS integration.l

func (*ACS) Data

func (a *ACS) Data(
	_ context.Context,
	_ *config.Config,
) (map[string][]byte, error)

Data returns the ACS integration data.

func (*ACS) LoggerWith

func (a *ACS) LoggerWith(logger *slog.Logger) *slog.Logger

LoggerWith decorates the logger with the integration flags.

func (*ACS) PersistentFlags

func (a *ACS) PersistentFlags(c *cobra.Command)

PersistentFlags adds the persistent flags to the informed Cobra command.

func (*ACS) SetArgument

func (a *ACS) SetArgument(_, _ string) error

SetArgument sets additional arguments to the integration.

func (*ACS) Type

func (a *ACS) Type() corev1.SecretType

Type shares the Kubernetes secret type for this integration.

func (*ACS) Validate

func (a *ACS) Validate() error

Validate check if the ACS endpoint doesn't contain the protocol, and carries the port number.

type Azure

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

Azure represents the Azure integration coordinates.

func NewAzure

func NewAzure() *Azure

NewAzure creates a new Azure integration instance with default public host.

func (*Azure) Data

func (a *Azure) Data(context.Context, *config.Config) (map[string][]byte, error)

Data returns the data for the Azure integration secret.

func (*Azure) LoggerWith

func (a *Azure) LoggerWith(logger *slog.Logger) *slog.Logger

LoggerWith decorates the logger with the integration flags.

func (*Azure) PersistentFlags

func (a *Azure) PersistentFlags(c *cobra.Command)

PersistentFlags adds the persistent flags to the informed Cobra command.

func (*Azure) SetArgument

func (a *Azure) SetArgument(string, string) error

SetArgument sets additional arguments to the integration.

func (*Azure) Type

func (a *Azure) Type() corev1.SecretType

Type returns the type of the integration.

func (*Azure) Validate

func (a *Azure) Validate() error

Validate ensures the Azure flags are valid.

type BitBucket

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

BitBucket represents the BitBucket integration coordinates.

func NewBitBucket

func NewBitBucket() *BitBucket

NewBitBucket creates a new BitBucket integration instance. By default it uses the public BitBucket host.

func (*BitBucket) Data

func (b *BitBucket) Data(
	_ context.Context,
	_ *config.Config,
) (map[string][]byte, error)

Data returns the BitBucket integration data.

func (*BitBucket) LoggerWith

func (b *BitBucket) LoggerWith(logger *slog.Logger) *slog.Logger

LoggerWith decorates the logger with the integration flags.

func (*BitBucket) PersistentFlags

func (b *BitBucket) PersistentFlags(c *cobra.Command)

PersistentFlags adds the persistent flags to the informed Cobra command.

func (*BitBucket) SetArgument

func (b *BitBucket) SetArgument(_, _ string) error

SetArgument sets additional arguments to the integration.

func (*BitBucket) Type

func (b *BitBucket) Type() corev1.SecretType

Type shares the Kubernetes secret type for this integration.

func (*BitBucket) Validate

func (b *BitBucket) Validate() error

Validate validates the integration.

type GitHub

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

GitHub represents the GitHub App integration attributes. It collects, validates and issues the attributes to the GitHub App API.

func NewGitHub

func NewGitHub(logger *slog.Logger, kube *k8s.Kube) *GitHub

NewGitHub instances a new GitHub App integration.

func (*GitHub) Data

func (g *GitHub) Data(
	ctx context.Context,
	cfg *config.Config,
) (map[string][]byte, error)

Data generates the GitHub App integration data after interacting with the service API to create the application, storing the results of this interaction.

func (*GitHub) LoggerWith

func (g *GitHub) LoggerWith(logger *slog.Logger) *slog.Logger

LoggerWith decorates the logger with the integration flags.

func (*GitHub) PersistentFlags

func (g *GitHub) PersistentFlags(c *cobra.Command)

PersistentFlags adds the persistent flags to the informed Cobra command.

func (*GitHub) SetArgument

func (g *GitHub) SetArgument(k, v string) error

SetArgument sets the GitHub App name.

func (*GitHub) Type

func (g *GitHub) Type() corev1.SecretType

Type returns the type of the integration.

func (*GitHub) Validate

func (g *GitHub) Validate() error

Validate validates the integration configuration.

type GitLab

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

GitLab represents the GitLab integration coordinates.

func NewGitLab

func NewGitLab(logger *slog.Logger) *GitLab

NewGitLab instantiate a new GitLab integration. By default it uses the public GitLab host.

func (*GitLab) Data

func (g *GitLab) Data(
	_ context.Context,
	_ *config.Config,
) (map[string][]byte, error)

Data returns the GitLab integration data, using the local configuration and username obtained on the fly.

func (*GitLab) LoggerWith

func (g *GitLab) LoggerWith(logger *slog.Logger) *slog.Logger

LoggerWith decorates the logger with the integration flags.

func (*GitLab) PersistentFlags

func (g *GitLab) PersistentFlags(c *cobra.Command)

PersistentFlags adds the persistent flags to the informed Cobra command.

func (*GitLab) SetArgument

func (g *GitLab) SetArgument(string, string) error

SetArgument sets additional arguments to the integration.

func (*GitLab) Type

func (g *GitLab) Type() corev1.SecretType

Type returns the type of the integration.

func (*GitLab) Validate

func (g *GitLab) Validate() error

Validate validates the integration configuration.

type ImageRegistry

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

ImageRegistry represents the image registry integration coordinates. Works with different TSSC integrations managing image registry configuration.

func NewContainerRegistry

func NewContainerRegistry(defaultURL string) *ImageRegistry

NewContainerRegistry creates a new instance with the default URL.

func (*ImageRegistry) Data

func (i *ImageRegistry) Data(
	_ context.Context,
	_ *config.Config,
) (map[string][]byte, error)

Data returns the integration data.

func (*ImageRegistry) LoggerWith

func (i *ImageRegistry) LoggerWith(logger *slog.Logger) *slog.Logger

LoggerWith decorates the logger with the integration flags.

func (*ImageRegistry) PersistentFlags

func (i *ImageRegistry) PersistentFlags(cmd *cobra.Command)

PersistentFlags adds the persistent flags to the informed Cobra command.

func (*ImageRegistry) SetArgument

func (i *ImageRegistry) SetArgument(_, _ string) error

SetArgument sets additional arguments to the integration.

func (*ImageRegistry) Type

func (i *ImageRegistry) Type() corev1.SecretType

Type returns the type of the integration.

func (*ImageRegistry) Validate

func (i *ImageRegistry) Validate() error

Validate validates the integration configuration.

type Integration

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

Integration represents a generic Kubernetes Secret manager for integrations, it holds the common actions integrations will perform against secrets.

func NewSecret

func NewSecret(
	logger *slog.Logger,
	kube *k8s.Kube,
	name string,
	data Interface,
) *Integration

NewSecret instantiates a new secret manager, it uses the integration data provider to generate the Kubernetes Secret payload.

func (*Integration) Create

func (i *Integration) Create(ctx context.Context, cfg *config.Config) error

Create creates the integration secret in the cluster. It uses the integration data provider to obtain the secret payload.

func (*Integration) Delete

func (i *Integration) Delete(ctx context.Context, cfg *config.Config) error

Delete deletes the Kubernetes secret.

func (*Integration) Exists

func (i *Integration) Exists(
	ctx context.Context,
	cfg *config.Config,
) (bool, error)

Exists checks whether the integration secret exists in the cluster.

func (*Integration) PersistentFlags

func (i *Integration) PersistentFlags(cmd *cobra.Command)

PersistentFlags decorates the cobra instance with persistent flags.

func (*Integration) SetArgument

func (i *Integration) SetArgument(k, v string) error

SetArgument exposes the data provider method.

func (*Integration) Validate

func (i *Integration) Validate() error

Validate validates the secret payload, using the data interface.

type Interface

type Interface interface {
	// PersistentFlags decorates the cobra command with integration flags.
	PersistentFlags(*cobra.Command)

	// LoggerWith decorates the logger with the integration attributes.
	LoggerWith(*slog.Logger) *slog.Logger

	// Validate checks if all required fields are set and valid.
	Validate() error

	// Type shares the Kubernetes secret type for the integration.
	Type() corev1.SecretType

	// SetArgument sets a optional key-value argument to be used in the
	// generation of the Kubernetes secret data.
	SetArgument(string, string) error

	// Data generates the data for the Kubernetes secret, provides the payload
	// that will become the integration secret stored in the cluster.
	Data(context.Context, *config.Config) (map[string][]byte, error)
}

type Jenkins

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

Jenkins represents the Jenkins integration coordinates.

func NewJenkins

func NewJenkins() *Jenkins

NewJenkins instantiates a new Jenkins integration.

func (*Jenkins) Data

func (j *Jenkins) Data(
	_ context.Context,
	_ *config.Config,
) (map[string][]byte, error)

Data returns the integration data for Jenkins.

func (*Jenkins) LoggerWith

func (j *Jenkins) LoggerWith(logger *slog.Logger) *slog.Logger

LoggerWith decorates the logger with the integration flags.

func (*Jenkins) PersistentFlags

func (j *Jenkins) PersistentFlags(c *cobra.Command)

PersistentFlags adds the persistent flags to the informed Cobra command.

func (*Jenkins) SetArgument

func (j *Jenkins) SetArgument(string, string) error

SetArgument sets additional arguments to the integration.

func (*Jenkins) Type

func (j *Jenkins) Type() corev1.SecretType

Type returns the type of the integration.

func (*Jenkins) Validate

func (j *Jenkins) Validate() error

Validate validates the integration configuration.

type TrustedArtifactSigner

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

TrustedArtifactSigner represents the coordinates to connect to the TrustedArtifactSigner services.

func NewTrustedArtifactSigner

func NewTrustedArtifactSigner() *TrustedArtifactSigner

NewTrustedArtifactSigner creates a new instance of the TrustedArtifactSigner integration.

func (*TrustedArtifactSigner) Data

func (t *TrustedArtifactSigner) Data(
	_ context.Context,
	_ *config.Config,
) (map[string][]byte, error)

Data returns the Kubernetes secret data for this integration.

func (*TrustedArtifactSigner) LoggerWith

func (t *TrustedArtifactSigner) LoggerWith(logger *slog.Logger) *slog.Logger

LoggerWith decorates the logger with the integration flags.

func (*TrustedArtifactSigner) PersistentFlags

func (t *TrustedArtifactSigner) PersistentFlags(c *cobra.Command)

PersistentFlags adds the persistent flags to the informed Cobra command.

func (*TrustedArtifactSigner) SetArgument

func (t *TrustedArtifactSigner) SetArgument(string, string) error

SetArgument sets additional arguments to the integration.

func (*TrustedArtifactSigner) Type

Type shares the Kubernetes secret type for this integration.

func (*TrustedArtifactSigner) Validate

func (t *TrustedArtifactSigner) Validate() error

Validate checks the informed URLs ensure valid inputs.

type Trustification

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

Trustification represents the coordinates to connect the cluster with remote Trustification services.

func NewTrustification

func NewTrustification() *Trustification

NewTrustification creates a new instance of the Trustification integration.

func (*Trustification) Data

func (t *Trustification) Data(
	_ context.Context,
	_ *config.Config,
) (map[string][]byte, error)

Data returns the Kubernetes secret data for this integration.

func (*Trustification) LoggerWith

func (t *Trustification) LoggerWith(logger *slog.Logger) *slog.Logger

LoggerWith decorates the logger with the integration flags.

func (*Trustification) PersistentFlags

func (t *Trustification) PersistentFlags(c *cobra.Command)

PersistentFlags adds the persistent flags to the informed Cobra command.

func (*Trustification) SetArgument

func (t *Trustification) SetArgument(string, string) error

SetArgument sets additional arguments to the integration.

func (*Trustification) Type

func (t *Trustification) Type() corev1.SecretType

Type shares the Kubernetes secret type for this integration.

func (*Trustification) Validate

func (t *Trustification) Validate() error

Validate checks the informed URLs ensure valid inputs.

Jump to

Keyboard shortcuts

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