Documentation ¶
Index ¶
- Constants
- func FormatVersion(version *semver.Version) string
- func ParseVersion(version string) (*semver.Version, error)
- func ProcessConfig(config *Config) diag.Diagnostics
- type CloudQuery
- type Config
- type Connection
- type Option
- type Parser
- type Policy
- type Provider
- type Providers
- type RequiredProvider
- type RequiredProviders
Constants ¶
const EnvVarPrefix = "CQ_VAR_"
EnvVarPrefix is a prefix for environment variable names to be exported for HCL substitution.
Variables ¶
This section is empty.
Functions ¶
func FormatVersion ¶ added in v0.31.4
func FormatVersion(version *semver.Version) string
func ParseVersion ¶ added in v0.31.4
func ProcessConfig ¶ added in v0.31.3
func ProcessConfig(config *Config) diag.Diagnostics
ProcessConfig handles the configuration after it was loaded and parsed 1. Assigns defaults after decoding the raw configuration format 2. Overrides configuration values from CLI flags 3. Validates the configuration provided by the user 4. Normalizes the configuration to make it easier to use
Types ¶
type CloudQuery ¶
type CloudQuery struct { Logger *logging.Config `yaml:"logging,omitempty" json:"logging,omitempty"` Providers RequiredProviders `yaml:"providers,omitempty" json:"providers,omitempty"` Connection *Connection `yaml:"connection,omitempty" json:"connection,omitempty"` Policy *Policy `yaml:"policy,omitempty" json:"policy,omitempty"` // Used internally PluginDirectory string `yaml:"-" json:"-"` PolicyDirectory string `yaml:"-" json:"-"` }
func (CloudQuery) GetRequiredProvider ¶ added in v0.14.5
func (c CloudQuery) GetRequiredProvider(name string) (*RequiredProvider, error)
type Config ¶
type Config struct { CloudQuery CloudQuery `yaml:"cloudquery" json:"cloudquery"` Providers Providers `yaml:"providers" json:"providers"` }
type Connection ¶
type Connection struct { DSN string `yaml:"dsn,omitempty" json:"dsn,omitempty"` DSNFile string `yaml:"dsn_file,omitempty" json:"dsn_file,omitempty"` Type string `yaml:"type,omitempty" json:"type,omitempty"` Username string `yaml:"username,omitempty" json:"username,omitempty"` Password string `yaml:"password,omitempty" json:"password,omitempty"` Host string `yaml:"host,omitempty" json:"host,omitempty"` Port int `yaml:"port,omitempty" json:"port,omitempty"` Database string `yaml:"database,omitempty" json:"database,omitempty"` SSLMode string `yaml:"sslmode,omitempty" json:"sslmode,omitempty"` Schema string `yaml:"schema,omitempty" json:"schema,omitempty"` Extras []string `yaml:"extras,omitempty" json:"extras,omitempty"` }
func (*Connection) BuildFromConnParams ¶ added in v0.23.1
func (c *Connection) BuildFromConnParams()
func (Connection) IsAnyConnParamsSet ¶ added in v0.23.1
func (c Connection) IsAnyConnParamsSet() bool
type Option ¶ added in v0.15.5
type Option func(*Parser)
func WithEnvironmentVariables ¶ added in v0.15.5
WithEnvironmentVariables fills hcl.Context with values of environment variables given in vars. Only variables that start with given prefix are considered. Prefix is removed from the name and the name is lower cased then.
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
Parser is the main interface to read configuration files and other related files from disk.
It retains a cache of all files that are loaded so that they can be used to create source code snippets in diagnostics, etc.
func (*Parser) LoadConfigFile ¶
func (p *Parser) LoadConfigFile(path string) (*Config, diag.Diagnostics)
func (*Parser) LoadConfigFromSource ¶
func (p *Parser) LoadConfigFromSource(data []byte) (*Config, diag.Diagnostics)
type Policy ¶
type Policy struct {
DBPersistence bool `yaml:"db_persistence,omitempty" json:"db_persistence,omitempty"`
}
type Provider ¶
type Provider struct { Name string `yaml:"name,omitempty" json:"name,omitempty"` Alias string `yaml:"alias,omitempty" json:"alias,omitempty"` Resources []string `yaml:"resources,omitempty" json:"resources,omitempty"` SkipResources []string `yaml:"skip_resources,omitempty" json:"skip_resources,omitempty"` Env []string `yaml:"env,omitempty" json:"env,omitempty"` ConfigBytes []byte `yaml:"-" json:"-"` MaxParallelResourceFetchLimit uint64 `yaml:"max_parallel_resource_fetch_limit,omitempty" json:"max_parallel_resource_fetch_limit,omitempty"` MaxGoroutines uint64 `yaml:"max_goroutines,omitempty" json:"max_goroutines,omitempty"` ResourceTimeout uint64 `yaml:"resource_timeout,omitempty" json:"resource_timeout,omitempty"` // Configuration is only used temporarily for provider-specific configuration when decoding YAML Configuration map[string]interface{} `yaml:"configuration,omitempty" json:"configuration,omitempty"` }
type RequiredProvider ¶
type RequiredProvider struct { Name string `yaml:"name,omitempty" json:"name,omitempty"` Source *string `yaml:"source,omitempty" json:"source,omitempty"` Version string `yaml:"version,omitempty" json:"version,omitempty"` }
func (RequiredProvider) String ¶ added in v0.13.7
func (r RequiredProvider) String() string
type RequiredProviders ¶ added in v0.21.0
type RequiredProviders []*RequiredProvider
func (RequiredProviders) Distinct ¶ added in v0.21.0
func (r RequiredProviders) Distinct() RequiredProviders
Distinct returns one name per provider
func (RequiredProviders) Get ¶ added in v0.23.0
func (r RequiredProviders) Get(name string) *RequiredProvider
func (RequiredProviders) Names ¶ added in v0.21.0
func (r RequiredProviders) Names() []string