Documentation
¶
Index ¶
- Constants
- func DefaultConfigPath() string
- func NewAPIService(ctx context.Context, httpClient http.HTTPDoer, cfg ConfigStore) (api.Service, error)
- func NewConfigInitError(msg string) error
- func NewLoginError(msg string) error
- func ValidateCompanyIdentifier(companyID string) error
- func ValidateDataplaneName(name string) error
- func ValidateEndpointURL(endpoint string) error
- type APIServiceFactory
- type Auth
- func (w *Auth) GetOAuth2Provider() (*OAuth2, error)
- func (w *Auth) GetOIDCProvider() (*OIDC, error)
- func (w *Auth) GetProvider() AuthProvider
- func (w *Auth) MarshalJSON() ([]byte, error)
- func (w Auth) MarshalYAML() (interface{}, error)
- func (w *Auth) UnmarshalJSON(data []byte) error
- func (w *Auth) UnmarshalYAML(value *yaml.Node) error
- func (w *Auth) Validate() error
- type AuthProvider
- type Config
- func (c *Config) AddContext(name string, context Context)
- func (c *Config) GetCredentials() (*auth.Credentials, error)
- func (c *Config) GetCurrentContext() (*Context, error)
- func (c *Config) IsAuthenticated() bool
- func (c *Config) RemoveContext(name string) error
- func (c *Config) SetCredentials(creds *auth.Credentials)
- func (c *Config) SetCurrentContext(name string) error
- func (c *Config) Validate() error
- type ConfigStore
- type Context
- type CredentialStoreAdapter
- type FileConfigStore
- type NamedContext
- type OAuth2
- type OAuthEnvConfig
- type OIDC
Constants ¶
const (
// EnvConfigPath is the environment variable that sets the path to the Airbox configuration.
EnvConfigPath = "AIRBOXCONFIG"
)
Variables ¶
This section is empty.
Functions ¶
func DefaultConfigPath ¶
func DefaultConfigPath() string
DefaultConfigPath returns the default path for airbox config.
func NewAPIService ¶
func NewAPIService(ctx context.Context, httpClient http.HTTPDoer, cfg ConfigStore) (api.Service, error)
NewAPIService creates an authenticated API service with all boilerplate handled
func NewConfigInitError ¶
NewConfigInitError returns an error with config init instructions for the given message.
func NewLoginError ¶
NewLoginError returns an error with login instructions for the given message.
func ValidateCompanyIdentifier ¶
ValidateCompanyIdentifier validates a company identifier for cloud deployment. This validation matches Airbyte platform SSO requirements: only checks for non-empty after trimming whitespace. The platform accepts any characters including spaces and special characters, so we defer complex validation to the server.
func ValidateDataplaneName ¶
ValidateDataplaneName validates a dataplane name follows Kubernetes DNS-1123 subdomain rules. These constraints are required because dataplane names become Kubernetes resource names: - Max 63 characters (DNS label limit) - Start with lowercase letter (K8s requirement) - Only lowercase letters, numbers, hyphens (DNS-safe characters) - Cannot end with hyphen (DNS requirement)
func ValidateEndpointURL ¶
ValidateEndpointURL performs basic validation on an endpoint URL
Types ¶
type APIServiceFactory ¶
type APIServiceFactory func(ctx context.Context, httpClient http.HTTPDoer, cfg ConfigStore) (api.Service, error)
APIServiceFactory creates authenticated API services with all boilerplate handled
type Auth ¶
type Auth struct {
// contains filtered or unexported fields
}
Auth wraps AuthProvider for marshaling/unmarshaling
func NewAuthWithOAuth2 ¶
NewAuthWithOAuth2 creates Auth with OAuth2 provider
func NewAuthWithOIDC ¶
NewAuthWithOIDC creates Auth with OIDC provider
func (*Auth) GetOAuth2Provider ¶
GetOAuth2Provider returns the provider as an OAuth2Provider or an error
func (*Auth) GetOIDCProvider ¶
GetOIDCProvider returns the provider as an OIDCProvider or an error
func (*Auth) GetProvider ¶
func (w *Auth) GetProvider() AuthProvider
GetProvider returns the underlying AuthProvider
func (*Auth) MarshalJSON ¶
MarshalJSON serializes Auth to JSON with type discrimination
func (Auth) MarshalYAML ¶
MarshalYAML implements custom YAML marshaling MarshalYAML serializes Auth to YAML with type discrimination
func (*Auth) UnmarshalJSON ¶
UnmarshalJSON deserializes JSON to Auth with type discrimination
func (*Auth) UnmarshalYAML ¶
UnmarshalYAML implements custom YAML unmarshaling UnmarshalYAML deserializes YAML to Auth with type discrimination
type AuthProvider ¶
AuthProvider interface for authentication configuration
type Config ¶
type Config struct {
CurrentContext string `json:"current-context" yaml:"current-context"`
Credentials *auth.Credentials `json:"credentials,omitempty" yaml:"credentials,omitempty"`
Contexts []NamedContext `json:"contexts" yaml:"contexts"`
}
Config represents the airbox configuration file structure.
func (*Config) AddContext ¶
AddContext adds or updates a context
func (*Config) GetCredentials ¶
func (c *Config) GetCredentials() (*auth.Credentials, error)
GetCredentials returns the current user credentials
func (*Config) GetCurrentContext ¶
GetCurrentContext returns the current context.
func (*Config) IsAuthenticated ¶
IsAuthenticated checks if user has credentials (expiry is handled by auth client)
func (*Config) RemoveContext ¶
RemoveContext removes a context
func (*Config) SetCredentials ¶
func (c *Config) SetCredentials(creds *auth.Credentials)
SetCredentials updates the user credentials in the config (does not save)
func (*Config) SetCurrentContext ¶
SetCurrentContext sets the current context
type ConfigStore ¶
type ConfigStore interface {
Load() (*Config, error)
Save(config *Config) error
GetPath() string
Exists() bool
}
ConfigStore interface for performing config operations on the store.
type Context ¶
type Context struct {
AirbyteAPIURL string `json:"airbyteApiUrl" yaml:"airbyteApiUrl"`
AirbyteURL string `json:"airbyteUrl" yaml:"airbyteUrl"`
OrganizationID string `json:"organizationId" yaml:"organizationId"`
Edition string `json:"edition" yaml:"edition"`
Auth Auth `json:"auth" yaml:"auth"`
}
Context represents a single airbox context (org/workspace combination).
type CredentialStoreAdapter ¶
type CredentialStoreAdapter struct {
// contains filtered or unexported fields
}
CredentialStoreAdapter adapts ConfigStore to auth.CredentialsStore
func NewCredentialStoreAdapter ¶
func NewCredentialStoreAdapter(cfg ConfigStore) *CredentialStoreAdapter
NewCredentialStoreAdapter creates a new credentials store adapter
func (*CredentialStoreAdapter) Load ¶
func (a *CredentialStoreAdapter) Load() (*auth.Credentials, error)
Load implements auth.CredentialsStore
func (*CredentialStoreAdapter) Save ¶
func (a *CredentialStoreAdapter) Save(creds *auth.Credentials) error
Save implements auth.CredentialsStore
type FileConfigStore ¶
type FileConfigStore struct{}
FileConfigStore implements ConfigStore using filesystem.
func (*FileConfigStore) Exists ¶
func (p *FileConfigStore) Exists() bool
Exists checks if the config file exists
func (*FileConfigStore) GetPath ¶
func (p *FileConfigStore) GetPath() string
GetPath returns configuration file path.
func (*FileConfigStore) Load ¶
func (p *FileConfigStore) Load() (*Config, error)
Load and return the configuration from the file store.
func (*FileConfigStore) Save ¶
func (p *FileConfigStore) Save(config *Config) error
Save writes the configuration to the file store.
type NamedContext ¶
type NamedContext struct {
Name string `json:"name" yaml:"name"`
Context Context `json:"context" yaml:"context"`
}
NamedContext represents a named context entry.
type OAuth2 ¶
type OAuth2 struct {
ClientID string `yaml:"clientId" json:"clientId"`
ClientSecret string `yaml:"clientSecret" json:"clientSecret"`
}
OAuth2 configuration for OAuth2 providers
type OAuthEnvConfig ¶
type OAuthEnvConfig struct {
ClientID string `envconfig:"AIRBYTE_CLIENT_ID" required:"true"`
ClientSecret string `envconfig:"AIRBYTE_CLIENT_SECRET" required:"true"`
}
OAuthEnvConfig holds environment-based configuration
func LoadOAuthEnvConfig ¶
func LoadOAuthEnvConfig() (*OAuthEnvConfig, error)
LoadOAuthEnvConfig loads configuration from environment variables
func (*OAuthEnvConfig) ToAuthClient ¶
func (c *OAuthEnvConfig) ToAuthClient(ctx context.Context, httpClient http.HTTPDoer, cfg ConfigStore) (auth.Provider, error)
ToAuthClient creates an authenticated HTTP client from stored credentials