connection

package
v0.1.96 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2026 License: Apache-2.0 Imports: 63 Imported by: 4 modules, 4 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const BackendCapabilityArrayFilters = native.BackendCapabilityArrayFilters
View Source
const DefaultKubernetesMaxResources = 20

Variables

This section is empty.

Functions

func CreateHTTPClient

func CreateHTTPClient(ctx ConnectionContext, conn HTTPConnection) (*http.Client, error)

CreateHTTPClient requires a hydrated connection

func Get

func Get(ctx dbcontext.Context, connectionName string) (*models.Connection, error)

func GetFilesystem

func GetFilesystem(ctx context.Context, conn FilesystemProvider) (fs.FilesystemRW, error)

GetFilesystem returns a filesystem interface from any connection that implements FilesystemProvider

func GetFilesystemForConnection

func GetFilesystemForConnection(ctx context.Context, conn interface{}) (fs.FilesystemRW, error)

GetFilesystemForConnection is a helper that attempts to get a filesystem from various connection types

func KubernetesMaxResources added in v0.1.29

func KubernetesMaxResources(ctx context.Context, connectionName string) (int, error)

KubernetesMaxResources resolves the resource-discovery cap stored on a Kubernetes connection. An unnamed ambient connection and an unset property both use the documented default.

func RegisterAWSCredentialsHook added in v0.1.92

func RegisterAWSCredentialsHook(hook AWSCredentialsHook)

RegisterAWSCredentialsHook installs the hook for the process; nil removes it. It is explicit by design: nothing registers a hook from an init function.

func RegisterAzureDefaultCredential added in v0.1.92

func RegisterAzureDefaultCredential(factory AzureCredentialFactory)

RegisterAzureDefaultCredential installs a factory whose credential is tried after the SDK-free ambient chain. It is the extension point used by connection/azuresdk; passing nil removes a previously registered factory.

Types

type AWSConnection

type AWSConnection struct {
	// ConnectionName of the connection. It'll be used to populate the endpoint, accessKey and secretKey.
	ConnectionName string       `yaml:"connection,omitempty" json:"connection,omitempty"`
	AccessKey      types.EnvVar `yaml:"accessKey,omitempty" json:"accessKey,omitempty"`
	SecretKey      types.EnvVar `yaml:"secretKey,omitempty" json:"secretKey,omitempty"`
	SessionToken   types.EnvVar `yaml:"sessionToken,omitempty" json:"sessionToken,omitempty"`
	AssumeRole     string       `yaml:"assumeRole,omitempty" json:"assumeRole,omitempty"`
	Region         string       `yaml:"region,omitempty" json:"region,omitempty"`
	Endpoint       string       `yaml:"endpoint,omitempty" json:"endpoint,omitempty"`
	// Skip TLS verify when connecting to aws
	SkipTLSVerify bool `yaml:"skipTLSVerify,omitempty" json:"skipTLSVerify,omitempty"`
}

+kubebuilder:object:generate=true

func (*AWSConnection) Client

func (t *AWSConnection) Client(ctx context.Context) (*cloudaws.Session, error)

Client returns the SDK-free AWS session for the connection: region, endpoint, TLS settings and the credentials chain described in aws_credentials.go. Call this on a hydrated connection.

func (*AWSConnection) DeepCopy

func (in *AWSConnection) DeepCopy() *AWSConnection

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AWSConnection.

func (*AWSConnection) DeepCopyInto

func (in *AWSConnection) DeepCopyInto(out *AWSConnection)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*AWSConnection) FromModel

func (t *AWSConnection) FromModel(connection models.Connection)

func (*AWSConnection) GetPassword

func (t *AWSConnection) GetPassword() types.EnvVar

func (*AWSConnection) GetProperties

func (t *AWSConnection) GetProperties() map[string]string

func (*AWSConnection) GetURL

func (t *AWSConnection) GetURL() types.EnvVar

func (*AWSConnection) GetUsername

func (t *AWSConnection) GetUsername() types.EnvVar

func (*AWSConnection) Populate

func (t *AWSConnection) Populate(ctx ConnectionContext) error

Populate populates an AWSConnection with credentials and other information. If a connection name is specified, it'll be used to populate the endpoint, accessKey and secretKey.

func (AWSConnection) ToModel

func (t AWSConnection) ToModel() models.Connection

type AWSCredentialsHook added in v0.1.92

type AWSCredentialsHook func(ctx gocontext.Context, conn *AWSConnection) (AWSHookCredentials, error)

AWSCredentialsHook supplies credentials for a connection that carries no static access key, in place of the built-in chain. The opt-in connection/awssdk package registers one that adapts the AWS SDK's default chain (shared profiles, SSO, credential_process).

type AWSHookCredentials added in v0.1.92

type AWSHookCredentials struct {
	Provider awssigv4.CredentialsProvider
	// Region is used only when neither the connection nor the environment names one.
	Region string
}

AWSHookCredentials is what an AWSCredentialsHook resolves: the signing credentials and, optionally, the region its configuration knows about.

type AWSKMS

type AWSKMS struct {
	AWSConnection `json:",inline"`

	// keyID can be an alias (eg: alias/ExampleAlias?region=us-east-1) or the ARN
	KeyID string `json:"keyID,omitempty"`
}

func (*AWSKMS) FromModel

func (t *AWSKMS) FromModel(conn models.Connection)

func (*AWSKMS) Populate

func (t *AWSKMS) Populate(ctx ConnectionContext) error

func (*AWSKMS) SecretKeeper

func (t *AWSKMS) SecretKeeper(ctx commonsContext.Context) (keeper.Keeper, error)

type AzureConnection

type AzureConnection struct {
	ConnectionName string        `yaml:"connection,omitempty" json:"connection,omitempty"`
	ClientID       *types.EnvVar `yaml:"clientID,omitempty" json:"clientID,omitempty"`
	ClientSecret   *types.EnvVar `yaml:"clientSecret,omitempty" json:"clientSecret,omitempty"`
	TenantID       string        `yaml:"tenantID,omitempty" json:"tenantID,omitempty"`
}

+kubebuilder:object:generate=true

func (*AzureConnection) Credential added in v0.1.92

Credential returns an SDK-free Azure AD credential. A connection carrying a client secret authenticates with it. A connection naming nothing uses the ambient chain: environment client secret, workload identity, managed identity, plus the credential registered by azuresdk.Install when that package is imported. A half-filled service principal is a misconfiguration, not a request for ambient auth, so it fails.

func (*AzureConnection) DeepCopy

func (in *AzureConnection) DeepCopy() *AzureConnection

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureConnection.

func (*AzureConnection) DeepCopyInto

func (in *AzureConnection) DeepCopyInto(out *AzureConnection)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*AzureConnection) FromModel

func (g *AzureConnection) FromModel(connection models.Connection)

func (*AzureConnection) HydrateConnection

func (g *AzureConnection) HydrateConnection(ctx ConnectionContext) error

HydrateConnection attempts to find the connection by name and populate the endpoint and credentials.

func (AzureConnection) ToModel

func (g AzureConnection) ToModel() models.Connection

type AzureCredentialFactory added in v0.1.92

type AzureCredentialFactory func() (azuread.Credential, error)

AzureCredentialFactory builds the credential that extends the ambient Azure chain. It is called lazily, when a token is first requested.

type AzureCredentialOptions added in v0.1.92

type AzureCredentialOptions struct {
	// Authority overrides the Azure AD authority (sovereign clouds) for the
	// connection's client secret. It requires a configured client secret;
	// ambient credentials take their authority from AZURE_AUTHORITY_HOST.
	Authority string
}

AzureCredentialOptions tunes the credential built by AzureConnection.Credential.

type AzureKeyVault

type AzureKeyVault struct {
	AzureConnection `json:",inline"`

	// keyID is a URL to the key in the format
	// 	https://<vault-name>.vault.azure.net/keys/<key-name>
	KeyID string `json:"keyID,omitempty"`
}

func (*AzureKeyVault) FromModel

func (t *AzureKeyVault) FromModel(conn models.Connection)

func (*AzureKeyVault) Populate

func (t *AzureKeyVault) Populate(ctx ConnectionContext) error

func (*AzureKeyVault) SecretKeeper

func (t *AzureKeyVault) SecretKeeper(ctx commonsContext.Context) (keeper.Keeper, error)

type BackendCapabilities added in v0.1.37

type BackendCapabilities = native.BackendCapabilities

func ProbeBackendCapabilities added in v0.1.37

func ProbeBackendCapabilities(ctx context.Context, db *databasesql.DB, backend string) (BackendCapabilities, error)

type BackendCapability added in v0.1.37

type BackendCapability = native.BackendCapability

type BackendCapabilityStatus added in v0.1.37

type BackendCapabilityStatus = native.BackendCapabilityStatus

type CNRMConnection

type CNRMConnection struct {
	GKE GKEConnection `json:"gke" yaml:"gke"`

	ClusterResource          string `json:"clusterResource" yaml:"clusterResource"`
	ClusterResourceNamespace string `json:"clusterResourceNamespace" yaml:"clusterResourceNamespace"`
}

+kubebuilder:object:generate=true

func (*CNRMConnection) DeepCopy

func (in *CNRMConnection) DeepCopy() *CNRMConnection

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CNRMConnection.

func (*CNRMConnection) DeepCopyInto

func (in *CNRMConnection) DeepCopyInto(out *CNRMConnection)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*CNRMConnection) KubernetesClient

func (t *CNRMConnection) KubernetesClient(ctx context.Context, freshToken bool) (kubernetes.Interface, *rest.Config, error)

func (*CNRMConnection) Populate

func (t *CNRMConnection) Populate(ctx ConnectionContext) error

type ConnectionContext

type ConnectionContext interface {
	context.Context
	HydrateConnectionByURL(connectionName string) (*models.Connection, error)
	GetEnvValueFromCache(env types.EnvVar, namespace string) (string, error)
	GetNamespace() string
}

type ConnectionSetupResult

type ConnectionSetupResult struct {
	Sources   []string `json:"source,omitempty"`
	EnvVars   []string `json:"envVars,omitempty"`
	ApiServer string   `json:"kubeApiServer,omitempty"`

	Cleanup func() error `json:"-"`
}

func SetupConnection

func SetupConnection(ctx context.Context, connections ExecConnections, cmd *osExec.Cmd) (result *ConnectionSetupResult, resultErr error)

SetupConnections creates the necessary credential files and injects env vars into the cmd

type EKSConnection

type EKSConnection struct {
	AWSConnection `json:",inline" yaml:",inline"`

	Cluster string `json:"cluster"`
}

+kubebuilder:object:generate=true

func (*EKSConnection) DeepCopy

func (in *EKSConnection) DeepCopy() *EKSConnection

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EKSConnection.

func (*EKSConnection) DeepCopyInto

func (in *EKSConnection) DeepCopyInto(out *EKSConnection)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*EKSConnection) KubernetesClient

func (t *EKSConnection) KubernetesClient(ctx context.Context, freshToken bool) (kubernetes.Interface, *rest.Config, error)

func (*EKSConnection) Populate

func (t *EKSConnection) Populate(ctx ConnectionContext) error

type ExecConnections

type ExecConnections struct {
	FromConfigItem *string `yaml:"fromConfigItem,omitempty" json:"fromConfigItem,omitempty" template:"true"`

	// EKSPodIdentity when enabled will allow access to AWS_* env vars
	EKSPodIdentity bool `json:"eksPodIdentity,omitempty"`

	// ServiceAccount when enabled will allow access to KUBERNETES env vars
	ServiceAccount bool `json:"serviceAccount,omitempty"`

	Kubernetes *KubernetesConnection `yaml:"kubernetes,omitempty" json:"kubernetes,omitempty"`
	AWS        *AWSConnection        `yaml:"aws,omitempty" json:"aws,omitempty"`
	GCP        *GCPConnection        `yaml:"gcp,omitempty" json:"gcp,omitempty"`
	Azure      *AzureConnection      `yaml:"azure,omitempty" json:"azure,omitempty"`
	OpenSearch *OpenSearchConnection `yaml:"opensearch,omitempty" json:"opensearch,omitempty"`
}

+kubebuilder:object:generate=true

func (*ExecConnections) DeepCopy

func (in *ExecConnections) DeepCopy() *ExecConnections

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExecConnections.

func (*ExecConnections) DeepCopyInto

func (in *ExecConnections) DeepCopyInto(out *ExecConnections)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type FilesystemProvider

type FilesystemProvider interface {
	Filesystem(ctx context.Context) (fs.FilesystemRW, error)
}

FilesystemProvider is implemented by connections that can provide a filesystem interface

type GCPConnection

type GCPConnection struct {
	// ConnectionName of the connection. It'll be used to populate the endpoint and credentials.
	ConnectionName string        `yaml:"connection,omitempty" json:"connection,omitempty"`
	Endpoint       string        `yaml:"endpoint" json:"endpoint,omitempty"`
	Credentials    *types.EnvVar `yaml:"credentials" json:"credentials,omitempty"`

	// Skip TLS verify
	SkipTLSVerify bool `yaml:"skipTLSVerify,omitempty" json:"skipTLSVerify,omitempty"`

	Project string `yaml:"project" json:"project,omitempty"`
}

+kubebuilder:object:generate=true

func (*GCPConnection) ClientOptions added in v0.1.92

func (g *GCPConnection) ClientOptions(ctx context.Context, credentials string, scopes ...string) (gcp.Options, error)

ClientOptions maps the connection onto cloud/gcp client options: its endpoint and TLS setting, authenticated with credentials (the resolved service-account JSON) scoped to scopes. Empty credentials leave requests unauthenticated, which is what emulators expect; callers that want the ambient application default credentials ask for them explicitly with gcp.DefaultTokenSource.

func (*GCPConnection) DeepCopy

func (in *GCPConnection) DeepCopy() *GCPConnection

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GCPConnection.

func (*GCPConnection) DeepCopyInto

func (in *GCPConnection) DeepCopyInto(out *GCPConnection)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*GCPConnection) FromModel

func (t *GCPConnection) FromModel(connection models.Connection)

func (*GCPConnection) GetCertificate

func (t *GCPConnection) GetCertificate() types.EnvVar

func (*GCPConnection) GetURL

func (t *GCPConnection) GetURL() types.EnvVar

func (*GCPConnection) HydrateConnection

func (g *GCPConnection) HydrateConnection(ctx ConnectionContext) error

HydrateConnection attempts to find the connection by name and populate the endpoint and credentials.

func (*GCPConnection) ToModel

func (t *GCPConnection) ToModel() models.Connection

func (*GCPConnection) Token

func (g *GCPConnection) Token(ctx context.Context, freshToken bool, scopes ...string) (*oauth2.Token, error)

func (*GCPConnection) TokenSource

func (g *GCPConnection) TokenSource(ctx context.Context, scopes ...string) (oauth2.TokenSource, error)

func (*GCPConnection) Validate

func (g *GCPConnection) Validate() *GCPConnection

type GCPKMS

type GCPKMS struct {
	GCPConnection `json:",inline"`

	// keyID points to the key in the format
	// projects/MYPROJECT/locations/MYLOCATION/keyRings/MYKEYRING/cryptoKeys/MYKEY
	KeyID string `json:"keyID,omitempty"`
}

func (*GCPKMS) FromModel

func (t *GCPKMS) FromModel(conn models.Connection)

func (*GCPKMS) Populate

func (t *GCPKMS) Populate(ctx ConnectionContext) error

func (*GCPKMS) SecretKeeper

func (t *GCPKMS) SecretKeeper(ctx commonsContext.Context) (keeper.Keeper, error)

type GCSConnection

type GCSConnection struct {
	GCPConnection `json:",inline"`
	Bucket        string `yaml:"bucket,omitempty" json:"bucket,omitempty"`
}

+kubebuilder:object:generate=true

func (*GCSConnection) Client

func (g *GCSConnection) Client(ctx context.Context) (*gcp.StorageClient, error)

Client builds the Cloud Storage client for the connection. A connection with no credentials is unauthenticated (an emulator or a public bucket).

func (*GCSConnection) DeepCopy

func (in *GCSConnection) DeepCopy() *GCSConnection

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GCSConnection.

func (*GCSConnection) DeepCopyInto

func (in *GCSConnection) DeepCopyInto(out *GCSConnection)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*GCSConnection) Filesystem

func (c *GCSConnection) Filesystem(ctx context.Context) (fs.FilesystemRW, error)

Filesystem returns a filesystem interface for GCS operations

func (*GCSConnection) GetProperties

func (t *GCSConnection) GetProperties() map[string]string

func (*GCSConnection) HydrateConnection

func (g *GCSConnection) HydrateConnection(ctx ConnectionContext) error

HydrateConnection attempts to find the connection by name and populate the endpoint and credentials.

func (*GCSConnection) Validate

func (g *GCSConnection) Validate() *GCSConnection

type GKEConnection

type GKEConnection struct {
	GCPConnection `json:",inline" yaml:",inline"`

	ProjectID string `json:"projectID" yaml:"projectID"`
	Zone      string `json:"zone"`
	Cluster   string `json:"cluster"`
}

+kubebuilder:object:generate=true

func (*GKEConnection) Client

Client builds the Kubernetes Engine API client for the connection. A connection with no credentials is unauthenticated.

func (*GKEConnection) DeepCopy

func (in *GKEConnection) DeepCopy() *GKEConnection

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GKEConnection.

func (*GKEConnection) DeepCopyInto

func (in *GKEConnection) DeepCopyInto(out *GKEConnection)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*GKEConnection) KubernetesClient

func (t *GKEConnection) KubernetesClient(ctx context.Context, freshToken bool) (kubernetes.Interface, *rest.Config, error)

func (*GKEConnection) Populate

func (t *GKEConnection) Populate(ctx ConnectionContext) error

func (*GKEConnection) Validate

func (t *GKEConnection) Validate() *GKEConnection

type GitConnection

type GitConnection struct {
	URL         string        `yaml:"url,omitempty" json:"url,omitempty"`
	Path        string        `yaml:"path,omitempty" json:"path,omitempty"`
	Connection  string        `yaml:"connection,omitempty" json:"connection,omitempty"`
	Username    *types.EnvVar `yaml:"username,omitempty" json:"username,omitempty"`
	Password    *types.EnvVar `yaml:"password,omitempty" json:"password,omitempty"`
	Certificate *types.EnvVar `yaml:"certificate,omitempty" json:"certificate,omitempty"`
	// TLS configures custom CA, client certificate and insecure-skip-verify for
	// git-over-HTTPS. InsecureSkipVerify also skips SSH host-key verification.
	TLS TLSConfig `yaml:"tls,omitempty" json:"tls,omitempty"`
	// Type of connection e.g. github, gitlab
	Type   string `yaml:"type,omitempty" json:"type,omitempty"`
	Branch string `yaml:"branch,omitempty" json:"branch,omitempty"`
	Depth  *int   `yaml:"depth,omitempty" json:"depth,omitempty"`
	// Worktree creates a native git worktree for the checkout before running.
	Worktree *GitWorktree `yaml:"worktree,omitempty" json:"worktree,omitempty"`
	// Since is a commit-ish whose merge-base diff against HEAD is folded into
	// the reported dirtyFiles. Informational only.
	Since string `yaml:"since,omitempty" json:"since,omitempty"`
	// Deprecated: no-op, retained so existing configs keep parsing. Use
	// GitWorktree.Uncommitted / GitWorktree.Ignored and Since instead.
	Dirty *GitDirty `yaml:"dirty,omitempty" json:"dirty,omitempty"`
	// Destination is the full path to where the contents of the URL should be downloaded to.
	// If left empty, the sha256 hash of the URL will be used as the dir name.
	Destination *string `yaml:"destination,omitempty" json:"destination,omitempty"`
}

+kubebuilder:object:generate=true

func (GitConnection) CloneOptions added in v0.1.59

func (c GitConnection) CloneOptions(dir string) (dbgit.CloneOptions, error)

CloneOptions is the checkout this connection asks for in dir: the URL's ?ref= beats Branch and ?depth= beats Depth; an unset depth is 1 and an unset ref is the remote HEAD.

func (*GitConnection) DeepCopy

func (in *GitConnection) DeepCopy() *GitConnection

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GitConnection.

func (*GitConnection) DeepCopyInto

func (in *GitConnection) DeepCopyInto(out *GitConnection)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (GitConnection) GetCertificate

func (git GitConnection) GetCertificate() types.EnvVar

func (GitConnection) GetPassword

func (git GitConnection) GetPassword() types.EnvVar

func (GitConnection) GetURL

func (git GitConnection) GetURL() types.EnvVar

func (GitConnection) GetUsername

func (git GitConnection) GetUsername() types.EnvVar

func (*GitConnection) HydrateConnection

func (c *GitConnection) HydrateConnection(ctx context.Context) error

func (GitConnection) Repository added in v0.1.59

func (c GitConnection) Repository() (*dbgit.Repository, error)

Repository opens the connection's remote with its credentials. Call HydrateConnection first so every EnvVar holds its resolved value.

type GitDirty deprecated added in v0.1.13

type GitDirty struct {
	Staged    bool   `yaml:"staged,omitempty" json:"staged,omitempty"`
	Unstaged  bool   `yaml:"unstaged,omitempty" json:"unstaged,omitempty"`
	Untracked bool   `yaml:"untracked,omitempty" json:"untracked,omitempty"`
	Since     string `yaml:"since,omitempty" json:"since,omitempty"`
}

Deprecated: no-op. See GitConnection.Dirty. +kubebuilder:object:generate=true

func (*GitDirty) DeepCopy added in v0.1.13

func (in *GitDirty) DeepCopy() *GitDirty

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GitDirty.

func (*GitDirty) DeepCopyInto added in v0.1.13

func (in *GitDirty) DeepCopyInto(out *GitDirty)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*GitDirty) IsEmpty added in v0.1.13

func (d *GitDirty) IsEmpty() bool

type GitWorktree added in v0.1.13

type GitWorktree struct {
	Enabled bool   `yaml:"enabled,omitempty" json:"enabled,omitempty"`
	Prefix  string `yaml:"prefix,omitempty" json:"prefix,omitempty"`
	Branch  string `yaml:"branch,omitempty" json:"branch,omitempty"`
	// Existing checks Branch out as it is instead of creating it from Base; the
	// branch must already exist.
	Existing bool   `yaml:"existing,omitempty" json:"existing,omitempty"`
	Base     string `yaml:"base,omitempty" json:"base,omitempty"`
	Path     string `yaml:"path,omitempty" json:"path,omitempty"`
	Keep     bool   `yaml:"keep,omitempty" json:"keep,omitempty"`
	// Uncommitted carries staged, unstaged and untracked changes from the
	// source repo into the worktree. The source is never mutated.
	Uncommitted bool `yaml:"uncommitted,omitempty" json:"uncommitted,omitempty"`
	// Ignored copies gitignored content into the worktree.
	Ignored bool `yaml:"ignored,omitempty" json:"ignored,omitempty"`
}

+kubebuilder:object:generate=true

func (*GitWorktree) DeepCopy added in v0.1.13

func (in *GitWorktree) DeepCopy() *GitWorktree

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GitWorktree.

func (*GitWorktree) DeepCopyInto added in v0.1.13

func (in *GitWorktree) DeepCopyInto(out *GitWorktree)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*GitWorktree) IsEnabled added in v0.1.13

func (w *GitWorktree) IsEnabled() bool

type HTTPConnection

type HTTPConnection struct {
	ConnectionName      string `json:"connection,omitempty" yaml:"connection,omitempty"`
	types.HTTPBasicAuth `json:",inline"`
	URL                 string       `json:"url,omitempty" yaml:"url,omitempty"`
	Bearer              types.EnvVar `json:"bearer,omitempty" yaml:"bearer,omitempty"`
	OAuth               types.OAuth  `json:"oauth,omitempty" yaml:"oauth,omitempty"`
	TLS                 TLSConfig    `json:"tls,omitempty" yaml:"tls,omitempty"`
}

+kubebuilder:object:generate=true

func NewHTTPConnection

func NewHTTPConnection(ctx ConnectionContext, conn models.Connection) (HTTPConnection, error)

func (*HTTPConnection) DeepCopy

func (in *HTTPConnection) DeepCopy() *HTTPConnection

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPConnection.

func (*HTTPConnection) DeepCopyInto

func (in *HTTPConnection) DeepCopyInto(out *HTTPConnection)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*HTTPConnection) FromModel

func (t *HTTPConnection) FromModel(connection models.Connection) error

func (HTTPConnection) GetEndpoint

func (h HTTPConnection) GetEndpoint() string

func (*HTTPConnection) Hydrate

func (h *HTTPConnection) Hydrate(ctx ConnectionContext, namespace string) (*HTTPConnection, error)

func (HTTPConnection) IsEmpty added in v0.1.29

func (h HTTPConnection) IsEmpty() bool

IsEmpty reports whether the connection names no endpoint and carries no credentials, i.e. it would hydrate into nothing usable.

func (HTTPConnection) Transport

func (h HTTPConnection) Transport() netHTTP.RoundTripper

type KubeconfigConnection

type KubeconfigConnection struct {
	// Connection name to populate kubeconfig
	ConnectionName string        `json:"connection,omitempty" yaml:"connection,omitempty"`
	Kubeconfig     *types.EnvVar `json:"kubeconfig,omitempty" yaml:"kubeconfig,omitempty"`
	Kubecontext    string        `json:"kubecontext,omitempty" yaml:"kubecontext,omitempty"`
	KubeconfigPath string        `json:"kubeconfigPath,omitempty" yaml:"kubeconfigPath,omitempty"`
}

+kubebuilder:object:generate=true

func (*KubeconfigConnection) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KubeconfigConnection.

func (*KubeconfigConnection) DeepCopyInto

func (in *KubeconfigConnection) DeepCopyInto(out *KubeconfigConnection)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (KubeconfigConnection) Populate

type KubernetesConnection

type KubernetesConnection struct {
	KubeconfigConnection `json:",inline" yaml:",inline"`

	EKS  *EKSConnection  `json:"eks,omitempty" yaml:"eks,omitempty"`
	GKE  *GKEConnection  `json:"gke,omitempty" yaml:"gke,omitempty"`
	CNRM *CNRMConnection `json:"cnrm,omitempty" yaml:"cnrm,omitempty"`
}

+kubebuilder:object:generate=true

func (KubernetesConnection) CanExpire

func (c KubernetesConnection) CanExpire() bool

func (*KubernetesConnection) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KubernetesConnection.

func (*KubernetesConnection) DeepCopyInto

func (in *KubernetesConnection) DeepCopyInto(out *KubernetesConnection)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (KubernetesConnection) Hash

func (c KubernetesConnection) Hash() string

Hash returns a unique identifier of a KubernetesConnection, suitable for caching

func (KubernetesConnection) Populate

func (t KubernetesConnection) Populate(ctx context.Context, freshToken bool) (kubernetes.Interface, *rest.Config, error)

func (KubernetesConnection) String

func (c KubernetesConnection) String() string

String returns a human readable string representation of the KubernetesConnection

func (KubernetesConnection) ToModel

type Loki

type Loki struct {
	HTTPConnection `json:",inline" yaml:",inline"`
}

Loki is an HTTP endpoint like any other, and the connection form stores its credentials under the shared HTTP authentication contract (Properties keyed by authType). Embedding HTTPConnection is what makes basic, OAuth, bearer and mTLS all reachable, the same way PrometheusConnection does it.

+kubebuilder:object:generate=true

func (*Loki) DeepCopy

func (in *Loki) DeepCopy() *Loki

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Loki.

func (*Loki) DeepCopyInto

func (in *Loki) DeepCopyInto(out *Loki)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Loki) Populate

func (c *Loki) Populate(ctx ConnectionContext) error

type OpenSearchConnection added in v0.1.69

type OpenSearchConnection struct {
	ConnectionName      string `json:"connection,omitempty" yaml:"connection,omitempty"`
	types.HTTPBasicAuth `json:",inline" yaml:",inline"`
	URLs                []string `json:"urls,omitempty" yaml:"urls,omitempty"`
	Index               string   `json:"index,omitempty" yaml:"index,omitempty"`
	InsecureSkipVerify  bool     `json:"insecureSkipVerify,omitempty" yaml:"insecureSkipVerify,omitempty"`
}

func (*OpenSearchConnection) Hydrate added in v0.1.69

type OpenTelemetry added in v0.1.23

type OpenTelemetry struct {
	Name       string
	Connection string
}

func NewOpenTelemetry added in v0.1.23

func NewOpenTelemetry(connection *models.Connection) (OpenTelemetry, error)

func (OpenTelemetry) ResolveOpenSearch added in v0.1.23

func (connection OpenTelemetry) ResolveOpenSearch(ctx connectionHydrator) (*models.Connection, error)

type ProbeResult added in v0.1.57

type ProbeResult struct {
	OK bool `json:"ok"`
}

ProbeResult is the read-only capability discovered by a connection test.

func ProbeModel added in v0.1.57

func ProbeModel(ctx context.Context, model models.Connection) (ProbeResult, error)

ProbeModel checks the service or repository represented by a persisted connection. Credentials are resolved only for this call and never returned.

type PrometheusConnection

type PrometheusConnection struct {
	HTTPConnection `json:",inline" yaml:",inline"`
}

+kubebuilder:object:generate=true

func (*PrometheusConnection) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PrometheusConnection.

func (*PrometheusConnection) DeepCopyInto

func (in *PrometheusConnection) DeepCopyInto(out *PrometheusConnection)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*PrometheusConnection) FromModel

func (t *PrometheusConnection) FromModel(connection models.Connection) error

func (*PrometheusConnection) NewClient

func (p *PrometheusConnection) NewClient(ctx context.Context) (v1.API, error)

func (*PrometheusConnection) Populate

func (p *PrometheusConnection) Populate(ctx ConnectionContext) error

type S3Connection

type S3Connection struct {
	AWSConnection `json:",inline"`
	Bucket        string `yaml:"bucket,omitempty" json:"bucket,omitempty"`
	// glob path to restrict matches to a subset
	ObjectPath string `yaml:"objectPath,omitempty" json:"objectPath,omitempty"`
	// Use path style path: http://s3.amazonaws.com/BUCKET/KEY instead of http://BUCKET.s3.amazonaws.com/KEY
	UsePathStyle bool `yaml:"usePathStyle,omitempty" json:"usePathStyle,omitempty"`
}

+kubebuilder:object:generate=true

func (*S3Connection) DeepCopy

func (in *S3Connection) DeepCopy() *S3Connection

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new S3Connection.

func (*S3Connection) DeepCopyInto

func (in *S3Connection) DeepCopyInto(out *S3Connection)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*S3Connection) Filesystem

func (c *S3Connection) Filesystem(ctx context.Context) (fs.FilesystemRW, error)

Filesystem returns a filesystem interface for S3 operations

func (*S3Connection) GetProperties

func (t *S3Connection) GetProperties() map[string]string

func (*S3Connection) Populate

func (t *S3Connection) Populate(ctx ConnectionContext) error

Populate populates an AWSConnection with credentials and other information. If a connection name is specified, it'll be used to populate the endpoint, accessKey and secretKey.

func (S3Connection) ToModel

func (c S3Connection) ToModel() models.Connection

type SFTPConnection

type SFTPConnection struct {
	// ConnectionName of the connection. It'll be used to populate the connection fields.
	ConnectionName string `yaml:"connection,omitempty" json:"connection,omitempty"`
	// Port for the SSH server. Defaults to 22
	Port                 int    `yaml:"port,omitempty" json:"port,omitempty"`
	Host                 string `yaml:"host,omitempty" json:"host,omitempty"`
	types.Authentication `yaml:",inline" json:",inline"`
}

+kubebuilder:object:generate=true

func (*SFTPConnection) DeepCopy

func (in *SFTPConnection) DeepCopy() *SFTPConnection

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SFTPConnection.

func (*SFTPConnection) DeepCopyInto

func (in *SFTPConnection) DeepCopyInto(out *SFTPConnection)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*SFTPConnection) Filesystem

func (c *SFTPConnection) Filesystem(ctx context.Context) (fs.FilesystemRW, error)

Filesystem returns a filesystem interface for SFTP operations

func (SFTPConnection) GetPort

func (c SFTPConnection) GetPort() int

func (*SFTPConnection) HydrateConnection

func (c *SFTPConnection) HydrateConnection(ctx ConnectionContext) (err error)

func (SFTPConnection) ToModel

func (c SFTPConnection) ToModel() models.Connection

type SMBConnection

type SMBConnection struct {
	types.Authentication `yaml:",inline" json:",inline"`
	// ConnectionName of the connection. It'll be used to populate the connection fields.
	ConnectionName string `yaml:"connection,omitempty" json:"connection,omitempty"`
	// Port on which smb server is running. Defaults to 445
	Port   int    `yaml:"port,omitempty" json:"port,omitempty"`
	Domain string `yaml:"domain,omitempty" json:"domain,omitempty"`
	Share  string `yaml:"share,omitempty" json:"share,omitempty"`
}

+kubebuilder:object:generate=true

func (*SMBConnection) DeepCopy

func (in *SMBConnection) DeepCopy() *SMBConnection

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SMBConnection.

func (*SMBConnection) DeepCopyInto

func (in *SMBConnection) DeepCopyInto(out *SMBConnection)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*SMBConnection) Filesystem

func (c *SMBConnection) Filesystem(ctx context.Context) (fs.FilesystemRW, error)

Filesystem returns a filesystem interface for SMB operations

func (SMBConnection) GetPort

func (c SMBConnection) GetPort() int

func (*SMBConnection) Populate

func (c *SMBConnection) Populate(ctx ConnectionContext) error

func (SMBConnection) ToModel

func (c SMBConnection) ToModel() models.Connection

type SQLClientOptions added in v0.1.72

type SQLClientOptions struct {
	// OnMessage receives raw PostgreSQL notice text on the query's goroutine.
	OnMessage func(string)
}

SQLClientOptions controls runtime reporting without exposing driver types.

type SQLConnection added in v0.1.13

type SQLConnection struct {
	ConnectionName string              `yaml:"connection,omitempty" json:"connection,omitempty"`
	Type           string              `yaml:"type,omitempty" json:"type,omitempty"`
	URL            types.EnvVar        `yaml:"url,omitempty" json:"url,omitempty"`
	Username       types.EnvVar        `yaml:"username,omitempty" json:"username,omitempty"`
	Password       types.EnvVar        `yaml:"password,omitempty" json:"password,omitempty"`
	Properties     types.JSONStringMap `yaml:"properties,omitempty" json:"properties,omitempty"`
}

SQLConnection is a multi-driver SQL connection (postgres, mysql, sqlserver). Ported from duty/connection so commons-db data providers can open arbitrary SQL backends from a models.Connection or an inline URL.

+kubebuilder:object:generate=true

func (*SQLConnection) Client added in v0.1.13

func (s *SQLConnection) Client(ctx context.Context, options ...SQLClientOptions) (*databasesql.DB, error)

Client creates and returns a database/sql DB client.

NOTE: Must be run on a hydrated SQLConnection.

func (*SQLConnection) DeepCopy added in v0.1.27

func (in *SQLConnection) DeepCopy() *SQLConnection

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SQLConnection.

func (*SQLConnection) DeepCopyInto added in v0.1.27

func (in *SQLConnection) DeepCopyInto(out *SQLConnection)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*SQLConnection) FromModel added in v0.1.13

func (s *SQLConnection) FromModel(connection models.Connection) error

func (*SQLConnection) HydrateConnection added in v0.1.13

func (s *SQLConnection) HydrateConnection(ctx context.Context) error

func (SQLConnection) Target added in v0.1.72

func (s SQLConnection) Target() (SQLTarget, error)

Target is the SQLTarget of the DSN Client opens, read through each driver's own parser so defaults (a postgres keyword DSN's PGHOST, the SQL Server port) are the ones the driver applies.

NOTE: Must be run on a hydrated SQLConnection.

func (SQLConnection) ToModel added in v0.1.13

func (s SQLConnection) ToModel() models.Connection

func (SQLConnection) UseDatabase added in v0.1.15

func (s SQLConnection) UseDatabase(database string) (SQLConnection, error)

UseDatabase returns a copy of the connection scoped to database. Credentials remain in their existing EnvVar fields and are applied when Client is opened.

func (SQLConnection) UseDefaultDatabase added in v0.1.37

func (s SQLConnection) UseDefaultDatabase() (SQLConnection, error)

UseDefaultDatabase returns a copy of a SQL Server connection without an initial database, allowing SQL Server to select the login's default database.

func (SQLConnection) Validate added in v0.1.72

func (s SQLConnection) Validate() error

type SQLTarget added in v0.1.72

type SQLTarget struct {
	Host     string `json:"host,omitempty"`
	Port     string `json:"port,omitempty"`
	User     string `json:"user,omitempty"`
	Database string `json:"database,omitempty"`
}

SQLTarget is where a SQL connection points — the server, login and database the driver is opened with — and never its password.

func (SQLTarget) String added in v0.1.72

func (t SQLTarget) String() string

type TLSConfig

type TLSConfig struct {
	// InsecureSkipVerify controls whether a client verifies the server's
	// certificate chain and host name
	InsecureSkipVerify bool `json:"insecureSkipVerify,omitempty" yaml:"insecureSkipVerify,omitempty"`
	// HandshakeTimeout defaults to 10 seconds
	HandshakeTimeout time.Duration `json:"handshakeTimeout,omitempty" yaml:"handshakeTimeout,omitempty"`
	// PEM encoded certificate of the CA to verify the server certificate
	CA types.EnvVar `json:"ca,omitempty" yaml:"ca,omitempty"`
	// PEM encoded client certificate
	Cert types.EnvVar `json:"cert,omitempty" yaml:"cert,omitempty"`
	// PEM encoded client private key
	Key types.EnvVar `json:"key,omitempty" yaml:"key,omitempty"`
}

+kubebuilder:object:generate=true

func (*TLSConfig) DeepCopy

func (in *TLSConfig) DeepCopy() *TLSConfig

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TLSConfig.

func (*TLSConfig) DeepCopyInto

func (in *TLSConfig) DeepCopyInto(out *TLSConfig)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (TLSConfig) IsEmpty

func (t TLSConfig) IsEmpty() bool

func (TLSConfig) TLSClientConfig added in v0.1.29

func (t TLSConfig) TLSClientConfig() (*tls.Config, error)

TLSClientConfig builds the tls.Config this connection describes. Exported because not every client is an http.RoundTripper — the Loki tail stream needs the same certificates on a websocket dialer.

Directories

Path Synopsis
Package awssdk is the opt-in bridge to the AWS SDK for Go v2.
Package awssdk is the opt-in bridge to the AWS SDK for Go v2.
Package azuresdk is the opt-in bridge to the Azure SDK's default credential chain.
Package azuresdk is the opt-in bridge to the Azure SDK's default credential chain.
Package catalog persists organization-owned connections as encrypted payloads.
Package catalog persists organization-owned connections as encrypted payloads.
Package crd is the typed mission-control Connection resource (mission-control.flanksource.com/v1, kind Connection) and its conversion to models.Connection, so a connection written for mission-control is read the same way wherever commons-db resolves connections.
Package crd is the typed mission-control Connection resource (mission-control.flanksource.com/v1, kind Connection) and its conversion to models.Connection, so a connection written for mission-control is read the same way wherever commons-db resolves connections.
Package store resolves named connections from typed Connection resources (connection/crd) kept as files, in layers a later one of which overrides an earlier one by name: by default the connections every Flanksource tool shares, then an app's own, then the working directory's.
Package store resolves named connections from typed Connection resources (connection/crd) kept as files, in layers a later one of which overrides an earlier one by name: by default the connections every Flanksource tool shares, then an app's own, then the working directory's.

Jump to

Keyboard shortcuts

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