common

package
v0.15.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2025 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrSecretNotFound    = "Cannot find referenced secret"
	ErrSecretKeyNotFound = "Cannot find key in referenced secret"
	ErrSecretSelectorNil = "Secret selector is nil"
)

Variables

This section is empty.

Functions

func GetTokenValueFromLocalSecret

func GetTokenValueFromLocalSecret(ctx context.Context, client client.Client, m resource.Managed, l *xpv1.LocalSecretKeySelector) (*string, error)

func GetTokenValueFromSecret

func GetTokenValueFromSecret(ctx context.Context, client client.Client, m resource.Managed, selector *xpv1.SecretKeySelector) (*string, error)

func NewClient

func NewClient(c Config) *gitlab.Client

NewClient creates new Gitlab Client with provided Gitlab Configurations/Credentials.

func TestCreateLocalSecretKeySelector

func TestCreateLocalSecretKeySelector(name, key string) *xpv1.LocalSecretKeySelector

CreateLocalSecretKeySelector creates a LocalSecretKeySelector for testing

func TestCreateLocalSecretReference

func TestCreateLocalSecretReference(name string) *xpv1.LocalSecretReference

CreateLocalSecretKeySelector creates a LocalSecretKeySelector for testing

func TestCreateSecretKeySelector

func TestCreateSecretKeySelector(name, key string) *xpv1.SecretKeySelector

CreateSecretKeySelector creates a SecretKeySelector for testing

func TestCreateSecretReference

func TestCreateSecretReference(name string) *xpv1.SecretReference

CreateSecretKeySelector creates a SecretKeySelector for testing

Types

type BasicAuth

type BasicAuth struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

BasicAuth is the expected struct that can be passed in the Config.Token field to add support for BasicAuth AuthMethod

type Config

type Config struct {
	Token              string
	BaseURL            string
	InsecureSkipVerify bool
	AuthMethod         auth.AuthType
}

Config provides gitlab configurations for the Gitlab client

func GetConfig

func GetConfig(ctx context.Context, c client.Client, mg resource.Managed) (*Config, error)

GetConfig constructs a Config that can be used to authenticate to Gitlab API by the Gitlab Go client

func UseLegacyProviderConfig

func UseLegacyProviderConfig(ctx context.Context, c client.Client, mg resource.LegacyManaged) (*Config, error)

UseProviderConfig to produce a config that can be used to authenticate to Gitlab.

func UseProvicerConfig

func UseProvicerConfig(ctx context.Context, c client.Client, mg resource.ModernManaged) (*Config, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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