connection

package
v1.0.723 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2024 License: Apache-2.0 Imports: 40 Imported by: 12

Documentation

Index

Constants

View Source
const (
	ServiceGithub = "github"
	ServiceGitlab = "gitlab"
)

Variables

This section is empty.

Functions

func CreateHTTPClient added in v1.0.538

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

CreateHTTPClient requires a hydrated connection

func SetupConnection added in v1.0.614

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

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

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 added in v1.0.588

func (t *AWSConnection) Client(ctx context.Context) (aws.Config, error)

Client returns a new aws config. 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) 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 added in v1.0.605

func (t AWSConnection) ToModel() models.Connection

type AzureConnection added in v1.0.614

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) DeepCopy added in v1.0.614

func (in *AzureConnection) DeepCopy() *AzureConnection

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

func (*AzureConnection) DeepCopyInto added in v1.0.614

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) HydrateConnection added in v1.0.614

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

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

type ConnectionContext

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

type ExecConnections added in v1.0.614

type ExecConnections struct {
	AWS   *AWSConnection   `yaml:"aws,omitempty" json:"aws,omitempty"`
	GCP   *GCPConnection   `yaml:"gcp,omitempty" json:"gcp,omitempty"`
	Azure *AzureConnection `yaml:"azure,omitempty" json:"azure,omitempty"`
}

+kubebuilder:object:generate=true

func (*ExecConnections) DeepCopy added in v1.0.614

func (in *ExecConnections) DeepCopy() *ExecConnections

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

func (*ExecConnections) DeepCopyInto added in v1.0.614

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

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

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"`
}

+kubebuilder:object:generate=true

func (*GCPConnection) Client added in v1.0.658

func (conn *GCPConnection) Client(ctx context.Context) (*gcs.Client, error)

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) GetCertificate added in v1.0.247

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

func (*GCPConnection) GetURL added in v1.0.247

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) Validate

func (g *GCPConnection) Validate() *GCPConnection

type GCSConnection added in v1.0.247

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

+kubebuilder:object:generate=true

func (*GCSConnection) DeepCopy added in v1.0.247

func (in *GCSConnection) DeepCopy() *GCSConnection

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

func (*GCSConnection) DeepCopyInto added in v1.0.247

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) GetProperties added in v1.0.247

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

func (*GCSConnection) HydrateConnection added in v1.0.247

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

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

func (*GCSConnection) Validate added in v1.0.247

func (g *GCSConnection) Validate() *GCSConnection

type GitClient added in v1.0.614

type GitClient struct {
	Auth                transport.AuthMethod
	URL                 string
	Owner, Repo, Branch string
	Depth               int
}

func CreateGitConfig added in v1.0.614

func CreateGitConfig(ctx context.Context, conn *GitConnection) (*GitClient, error)

func (*GitClient) Clone added in v1.0.614

func (gitClient *GitClient) Clone(ctx context.Context, dir string) (map[string]any, error)

func (GitClient) GetContext added in v1.0.614

func (gitClient GitClient) GetContext() map[string]any

func (GitClient) GetShortURL added in v1.0.614

func (gitClient GitClient) GetShortURL() string

func (GitClient) LoggerName added in v1.0.614

func (gitClient GitClient) LoggerName() string

type GitConnection added in v1.0.614

type GitConnection struct {
	URL         string        `yaml:"url,omitempty" json:"url,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"`
	// Type of connection e.g. github, gitlab
	Type   string `yaml:"type,omitempty" json:"type,omitempty"`
	Branch string `yaml:"branch,omitempty" json:"branch,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) DeepCopy added in v1.0.614

func (in *GitConnection) DeepCopy() *GitConnection

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

func (*GitConnection) DeepCopyInto added in v1.0.614

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) HydrateConnection added in v1.0.614

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

type HTTPConnection added in v1.0.538

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 added in v1.0.538

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

func (*HTTPConnection) DeepCopy added in v1.0.539

func (in *HTTPConnection) DeepCopy() *HTTPConnection

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

func (*HTTPConnection) DeepCopyInto added in v1.0.539

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) GetEndpoint added in v1.0.540

func (h HTTPConnection) GetEndpoint() string

func (*HTTPConnection) Hydrate added in v1.0.538

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

type S3Connection added in v1.0.247

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 added in v1.0.247

func (in *S3Connection) DeepCopy() *S3Connection

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

func (*S3Connection) DeepCopyInto added in v1.0.247

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) GetProperties added in v1.0.247

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

func (*S3Connection) Populate added in v1.0.247

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 added in v1.0.605

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) GetPort

func (c SFTPConnection) GetPort() int

func (*SFTPConnection) HydrateConnection

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

func (SFTPConnection) ToModel added in v1.0.603

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) GetPort

func (c SMBConnection) GetPort() int

func (*SMBConnection) Populate added in v1.0.603

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

func (SMBConnection) ToModel added in v1.0.603

func (c SMBConnection) ToModel() models.Connection

type TLSConfig added in v1.0.538

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 added in v1.0.539

func (in *TLSConfig) DeepCopy() *TLSConfig

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

func (*TLSConfig) DeepCopyInto added in v1.0.539

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 added in v1.0.538

func (t TLSConfig) IsEmpty() bool

Jump to

Keyboard shortcuts

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