Documentation ¶
Index ¶
- Constants
- Variables
- func AptProxyConfigMap(proxySettings proxy.Settings) map[string]any
- func Coerce(attrs map[string]string) (map[string]any, error)
- func CoerceForStorage(attrs map[string]any) map[string]any
- func ConfigDefaults() map[string]any
- func PreferredBase(cfg HasDefaultBase) corebase.Base
- func ProxyConfigMap(proxySettings proxy.Settings) map[string]any
- func Schema(extra environschema.Fields) (environschema.Fields, error)
- func Validate(_ctx context.Context, cfg, old *Config) error
- type AggregateValidator
- type AttributeDefaultValues
- type Config
- func (c *Config) AgentMetadataURL() (string, bool)
- func (c *Config) AgentStream() string
- func (c *Config) AgentVersion() (version.Number, bool)
- func (c *Config) AllAttrs() map[string]any
- func (c *Config) Apply(attrs map[string]any) (*Config, error)
- func (c *Config) AptFTPProxy() string
- func (c *Config) AptHTTPProxy() string
- func (c *Config) AptHTTPSProxy() string
- func (c *Config) AptMirror() string
- func (c *Config) AptNoProxy() string
- func (c *Config) AptProxySettings() proxy.Settings
- func (c *Config) AuthorizedKeys() string
- func (c *Config) AutomaticallyRetryHooks() bool
- func (c *Config) BackupDir() string
- func (c *Config) CharmHubURL() (string, bool)
- func (c *Config) CloudInitUserData() map[string]any
- func (c *Config) ContainerImageMetadataDefaultsDisabled() bool
- func (c *Config) ContainerImageMetadataURL() (string, bool)
- func (c *Config) ContainerImageStream() string
- func (c *Config) ContainerInheritProperties() string
- func (c *Config) ContainerNetworkingMethod() coremodelconfig.ContainerNetworkingMethod
- func (c *Config) DefaultBase() (string, bool)
- func (c *Config) DefaultSpace() string
- func (c *Config) Development() bool
- func (c *Config) DisableNetworkManagement() (bool, bool)
- func (c *Config) EgressSubnets() []string
- func (c *Config) EnableOSRefreshUpdate() bool
- func (c *Config) EnableOSUpgrade() bool
- func (c *Config) FTPProxy() string
- func (c *Config) FirewallMode() string
- func (c *Config) HTTPProxy() string
- func (c *Config) HTTPSProxy() string
- func (c *Config) HasJujuProxy() bool
- func (c *Config) HasLegacyProxy() bool
- func (c *Config) IgnoreMachineAddresses() (bool, bool)
- func (c *Config) ImageMetadataDefaultsDisabled() bool
- func (c *Config) ImageMetadataURL() (string, bool)
- func (c *Config) ImageStream() string
- func (c *Config) JujuFTPProxy() string
- func (c *Config) JujuHTTPProxy() string
- func (c *Config) JujuHTTPSProxy() string
- func (c *Config) JujuNoProxy() string
- func (c *Config) JujuProxySettings() proxy.Settings
- func (c *Config) LXDSnapChannel() string
- func (c *Config) LegacyProxySettings() proxy.Settings
- func (c *Config) LoggingConfig() string
- func (c *Config) MaxActionResultsAge() time.Duration
- func (c *Config) MaxActionResultsSizeMB() uint
- func (c *Config) MaxStatusHistoryAge() time.Duration
- func (c *Config) MaxStatusHistorySizeMB() uint
- func (c *Config) Mode() (set.Strings, bool)
- func (c *Config) Name() string
- func (c *Config) NetBondReconfigureDelay() int
- func (c *Config) NoProxy() string
- func (c *Config) NumContainerProvisionWorkers() int
- func (c *Config) NumProvisionWorkers() int
- func (c *Config) ProvisionerHarvestMode() HarvestMode
- func (c *Config) ProxySSH() bool
- func (c *Config) Remove(attrs []string) (*Config, error)
- func (c *Config) ResourceTags() (map[string]string, bool)
- func (c *Config) SAASIngressAllow() []string
- func (c *Config) SSHAllow() []string
- func (c *Config) SSLHostnameVerification() bool
- func (c *Config) SnapHTTPProxy() string
- func (c *Config) SnapHTTPSProxy() string
- func (c *Config) SnapProxySettings() proxy.Settings
- func (c *Config) SnapStoreAssertions() string
- func (c *Config) SnapStoreProxy() string
- func (c *Config) SnapStoreProxyURL() string
- func (c *Config) StorageDefaultBlockSource() (string, bool)
- func (c *Config) StorageDefaultFilesystemSource() (string, bool)
- func (c *Config) Telemetry() bool
- func (c *Config) TransmitVendorMetrics() bool
- func (c *Config) Type() string
- func (c *Config) UUID() string
- func (c *Config) UnknownAttrs() map[string]any
- func (c *Config) UpdateStatusHookInterval() time.Duration
- func (c *Config) ValidateUnknownAttrs(extrafields schema.Fields, defaults schema.Defaults) (map[string]any, error)
- type ConfigSchemaSource
- type ConfigSchemaSourceGetter
- type ConfigValue
- type ConfigValues
- type Defaulting
- type HarvestMode
- type HasDefaultBase
- type ModelDefaultAttributes
- type RegionDefaultValue
- type ValidationError
- type Validator
- type ValidatorFunc
Constants ¶
const ( // FwInstance requests the use of an individual firewall per instance. FwInstance = "instance" // FwGlobal requests the use of a single firewall group for all machines. // When ports are opened for one machine, all machines will have the same // port opened. FwGlobal = "global" // FwNone requests that no firewalling should be performed inside // the environment. No firewaller worker will be started. It's // useful for clouds without support for either global or per // instance security groups. FwNone = "none" )
const ( // AdminSecretKey AdminSecretKey = "admin-secret" // CAPrivateKeyKey CAPrivateKeyKey = "ca-private-key" // NameKey is the key for the model's name. NameKey = "name" // TypeKey is the key for the model's cloud type. TypeKey = "type" // AgentVersionKey is the key for the model's Juju agent version. AgentVersionKey = "agent-version" // UUIDKey is the key for the model UUID attribute. UUIDKey = "uuid" // AuthorizedKeysKey is the key for the authorized-keys attribute. AuthorizedKeysKey = "authorized-keys" // ProvisionerHarvestModeKey stores the key for this setting. ProvisionerHarvestModeKey = "provisioner-harvest-mode" // NumProvisionWorkersKey is the key for number of model provisioner // workers. NumProvisionWorkersKey = "num-provision-workers" // NumContainerProvisionWorkersKey is the key for the number of // container provisioner workers per machine setting. NumContainerProvisionWorkersKey = "num-container-provision-workers" // ImageStreamKey is the key used to specify the stream // for OS images. ImageStreamKey = "image-stream" // ImageMetadataURLKey is the key used to specify the location // of OS image metadata. ImageMetadataURLKey = "image-metadata-url" // ImageMetadataDefaultsDisabledKey is the key used to disable image // metadata default sources. ImageMetadataDefaultsDisabledKey = "image-metadata-defaults-disabled" // AgentStreamKey stores the key for this setting. AgentStreamKey = "agent-stream" // AgentMetadataURLKey stores the key for this setting. AgentMetadataURLKey = "agent-metadata-url" // ContainerImageStreamKey is the key used to specify the stream // for container OS images. ContainerImageStreamKey = "container-image-stream" // ContainerImageMetadataURLKey is the key used to specify the location // of OS image metadata for containers. ContainerImageMetadataURLKey = "container-image-metadata-url" // ContainerImageMetadataDefaultsDisabledKey is the key used to disable image // metadata default sources for containers. ContainerImageMetadataDefaultsDisabledKey = "container-image-metadata-defaults-disabled" // HTTPProxyKey stores the key for this setting. HTTPProxyKey = "http-proxy" // HTTPSProxyKey stores the key for this setting. HTTPSProxyKey = "https-proxy" // FTPProxyKey stores the key for this setting. FTPProxyKey = "ftp-proxy" // NoProxyKey stores the key for this setting. NoProxyKey = "no-proxy" // JujuHTTPProxyKey stores the key for this setting. JujuHTTPProxyKey = "juju-http-proxy" // JujuHTTPSProxyKey stores the key for this setting. JujuHTTPSProxyKey = "juju-https-proxy" // JujuFTPProxyKey stores the key for this setting. JujuFTPProxyKey = "juju-ftp-proxy" // JujuNoProxyKey stores the key for this setting. JujuNoProxyKey = "juju-no-proxy" // AptHTTPProxyKey stores the key for this setting. AptHTTPProxyKey = "apt-http-proxy" // AptHTTPSProxyKey stores the key for this setting. AptHTTPSProxyKey = "apt-https-proxy" // AptFTPProxyKey stores the key for this setting. AptFTPProxyKey = "apt-ftp-proxy" // AptNoProxyKey stores the key for this setting. AptNoProxyKey = "apt-no-proxy" // AptMirrorKey is used to set the apt mirror. AptMirrorKey = "apt-mirror" // SnapHTTPProxyKey is used to set the snap core setting proxy.http for deployed machines. SnapHTTPProxyKey = "snap-http-proxy" // SnapHTTPSProxyKey is used to set the snap core setting proxy.https for deployed machines. SnapHTTPSProxyKey = "snap-https-proxy" // SnapStoreProxyKey is used to set the snap core setting proxy.store for deployed machines. SnapStoreProxyKey = "snap-store-proxy" // SnapStoreAssertionsKey is used to configure the deployed machines to acknowledge the // store proxy assertions. SnapStoreAssertionsKey = "snap-store-assertions" // SnapStoreProxyURLKey is used to specify the URL to a snap store proxy. SnapStoreProxyURLKey = "snap-store-proxy-url" // NetBondReconfigureDelayKey is the key to pass when bridging // the network for containers. NetBondReconfigureDelayKey = "net-bond-reconfigure-delay" // ContainerNetworkingMethodKey is the key for setting up networking method // for containers. ContainerNetworkingMethodKey = "container-networking-method" // StorageDefaultBlockSourceKey is the key for the default block storage source. StorageDefaultBlockSourceKey = "storage-default-block-source" // StorageDefaultFilesystemSourceKey is the key for the default filesystem storage source. StorageDefaultFilesystemSourceKey = "storage-default-filesystem-source" // ResourceTagsKey is an optional list or space-separated string // of k=v pairs, defining the tags for ResourceTags. ResourceTagsKey = "resource-tags" // AutomaticallyRetryHooks determines whether the uniter will // automatically retry a hook that has failed AutomaticallyRetryHooks = "automatically-retry-hooks" // EnableOSRefreshUpdateKey determines whether newly provisioned instances // should run their respective OS's update capability. EnableOSRefreshUpdateKey = "enable-os-refresh-update" // EnableOSUpgradeKey determines whether newly provisioned instances // should run their respective OS's upgrade capability. EnableOSUpgradeKey = "enable-os-upgrade" // DevelopmentKey determines whether the model is in development mode. DevelopmentKey = "development" // SSLHostnameVerificationKey determines whether the environment has // SSL hostname verification enabled. SSLHostnameVerificationKey = "ssl-hostname-verification" // TransmitVendorMetricsKey is the key for whether the controller sends // metrics collected in this model for anonymized aggregate analytics. TransmitVendorMetricsKey = "transmit-vendor-metrics" // ExtraInfoKey is the key for arbitrary user specified string data that // is stored against the model. ExtraInfoKey = "extra-info" // MaxStatusHistoryAge is the maximum age of status history values // to keep when pruning, eg "72h" MaxStatusHistoryAge = "max-status-history-age" // MaxStatusHistorySize is the maximum size the status history // collection can grow to before it is pruned, eg "5M" MaxStatusHistorySize = "max-status-history-size" // MaxActionResultsAge is the maximum age of actions to keep when pruning, eg // "72h" MaxActionResultsAge = "max-action-results-age" // MaxActionResultsSize is the maximum size the actions collection can // grow to before it is pruned, eg "5M" MaxActionResultsSize = "max-action-results-size" // UpdateStatusHookInterval is how often to run the update-status hook. UpdateStatusHookInterval = "update-status-hook-interval" // EgressSubnets are the source addresses from which traffic from this model // originates if the model is deployed such that NAT or similar is in use. EgressSubnets = "egress-subnets" // CloudInitUserDataKey is the key to specify cloud-init yaml the user // wants to add into the cloud-config data produced by Juju when // provisioning machines. CloudInitUserDataKey = "cloudinit-userdata" // BackupDirKey specifies the backup working directory. BackupDirKey = "backup-dir" // ContainerInheritPropertiesKey is the key to specify a list of properties // to be copied from a machine to a container during provisioning. The // list will be comma separated. ContainerInheritPropertiesKey = "container-inherit-properties" // DefaultSpace specifies which space should be used for the default // endpoint bindings. DefaultSpaceKey = "default-space" // LXDSnapChannel selects the channel to use when installing LXD from a snap. LXDSnapChannel = "lxd-snap-channel" // CharmHubURLKey is the key for the url to use for CharmHub API calls CharmHubURLKey = "charmhub-url" // ModeKey is the key for defining the mode that a given model should be // using. // It is expected that when in a different mode, Juju will perform in a // different state. ModeKey = "mode" // SSHAllowKey is a comma separated list of CIDRs from which machines in // this model will accept connections to the SSH service SSHAllowKey = "ssh-allow" // SAASIngressAllowKey is a comma separated list of CIDRs // specifying what ingress can be applied to offers in this model SAASIngressAllowKey = "saas-ingress-allow" // IgnoreMachineAddresses when true, will cause the // machine worker not to discover any machine addresses // on start up. IgnoreMachineAddresses = "ignore-machine-addresses" // TestModeKey is the key for identifying the model should be run in test // mode. TestModeKey = "test-mode" // DisableTelemetryKey is a key for determining whether telemetry on juju // models will be done. DisableTelemetryKey = "disable-telemetry" // DefaultBaseKey is a key for determining the base a model should // explicitly use for charms unless otherwise provided. DefaultBaseKey = "default-base" // LoggingConfigKey is used to specify the logging backend configuration. LoggingConfigKey = "logging-config" )
TODO(katco-): Please grow this over time. Centralized place to store values of config keys. This transitions mistakes in referencing key-values to a compile-time error.
const ( // DefaultStatusHistoryAge is the default value for MaxStatusHistoryAge. DefaultStatusHistoryAge = "336h" // 2 weeks // DefaultStatusHistorySize is the default value for MaxStatusHistorySize. DefaultStatusHistorySize = "5G" // DefaultUpdateStatusHookInterval is the default value for // UpdateStatusHookInterval DefaultUpdateStatusHookInterval = "5m" // DefaultActionResultsAge is the default for the age of the results for an // action. DefaultActionResultsAge = "336h" // 2 weeks // DefaultActionResultsSize is the default size of the action results. DefaultActionResultsSize = "5G" // DefaultLxdSnapChannel is the default lxd snap channel to install on host vms. DefaultLxdSnapChannel = "5.0/stable" // DefaultSecretBackend is the default secret backend to use. DefaultSecretBackend = "auto" )
const ( MaxNumProvisionWorkers = 100 MaxNumContainerProvisionWorkers = 25 )
const ( // RequiresPromptsMode is used to tell clients interacting with // model that confirmation prompts are required when removing // potentially important resources RequiresPromptsMode = "requires-prompts" // StrictMode is currently unused // TODO(jack-w-shaw) remove this mode StrictMode = "strict" )
const ( // JujuDefaultSource is used to label model config attributes that // come from hard coded defaults. JujuDefaultSource = "default" // JujuControllerSource is used to label model config attributes that // come from those associated with the controller. JujuControllerSource = "controller" // JujuRegionSource is used to label model config attributes that come from // those associated with the region where the model is // running. JujuRegionSource = "region" // JujuModelConfigSource is used to label model config attributes that // have been explicitly set by the user. JujuModelConfigSource = "model" )
These constants define named sources of model config attributes. After a call to UpdateModelConfig, any attributes added/removed will have a source of JujuModelConfigSource.
Variables ¶
var GetDefaultSupportedLTSBase = jujuversion.DefaultSupportedLTSBase
GetDefaultSupportedLTSBase returns the DefaultSupportedLTSBase. This is exposed for one reason and one reason only; testing! The fact that PreferredBase doesn't take an argument for a default base as a fallback. We then have to expose this so we can exercise the branching code for other scenarios makes me sad.
Functions ¶
func AptProxyConfigMap ¶
AptProxyConfigMap returns a map suitable to be applied to a Config to update proxy settings.
func CoerceForStorage ¶
CoerceForStorage transforms attributes prior to being saved in a persistent store.
func ConfigDefaults ¶
ConfigDefaults returns the config default values to be used for any new model where there is no value yet defined.
func PreferredBase ¶
func PreferredBase(cfg HasDefaultBase) corebase.Base
PreferredBase returns the preferred base to use when a charm does not explicitly specify a base.
func ProxyConfigMap ¶
ProxyConfigMap returns a map suitable to be applied to a Config to update proxy settings.
Types ¶
type AggregateValidator ¶
type AggregateValidator struct { // Validators is the slice of Validator's to run as part of the aggregate // check. Validators []Validator }
AggregateValidator is a Validator that will run zero or more validators, making sure that all succeed or returning the first error encountered.
type AttributeDefaultValues ¶
type AttributeDefaultValues struct { // Default and Controller represent the values as set at those levels. Default interface{} `json:"default,omitempty" yaml:"default,omitempty"` Controller interface{} `json:"controller,omitempty" yaml:"controller,omitempty"` // Regions is a slice of Region representing the values as set in each // region. Regions []RegionDefaultValue `json:"regions,omitempty" yaml:"regions,omitempty"` }
AttributeDefaultValues represents all the default values at each level for a given setting.
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config holds an immutable environment configuration.
func New ¶
func New(withDefaults Defaulting, attrs map[string]any) (*Config, error)
New returns a new configuration. Fields that are common to all environment providers are verified. If useDefaults is UseDefaults, default values will be taken from the environment.
"ca-cert-path" and "ca-private-key-path" are translated into the "ca-cert" and "ca-private-key" values. If not specified, CA details will be read from:
~/.local/share/juju/<name>-cert.pem ~/.local/share/juju/<name>-private-key.pem
if $XDG_DATA_HOME is defined it will be used instead of ~/.local/share
The attrs map can not be nil, otherwise a panic is raised.
func (*Config) AgentMetadataURL ¶
AgentMetadataURL returns the URL that locates the agent tarballs and metadata, and whether it has been set.
func (*Config) AgentStream ¶
AgentStream returns the simplestreams stream used to identify which tools to use when bootstrapping or upgrading an environment.
func (*Config) AgentVersion ¶
AgentVersion returns the proposed version number for the agent tools, and whether it has been set. Once an environment is bootstrapped, this must always be valid.
func (*Config) AptFTPProxy ¶
AptFTPProxy returns the apt ftp proxy for the model. Falls back to the default ftp-proxy if not specified.
func (*Config) AptHTTPProxy ¶
AptHTTPProxy returns the apt http proxy for the model. Falls back to the default http-proxy if not specified.
func (*Config) AptHTTPSProxy ¶
AptHTTPSProxy returns the apt https proxy for the model. Falls back to the default https-proxy if not specified.
func (*Config) AptNoProxy ¶
AptNoProxy returns the 'apt-no-proxy' for the model.
func (*Config) AptProxySettings ¶
AptProxySettings returns all three proxy settings; http, https and ftp.
func (*Config) AuthorizedKeys ¶
AuthorizedKeys returns the content for ssh's authorized_keys file.
func (*Config) AutomaticallyRetryHooks ¶
AutomaticallyRetryHooks returns whether we should automatically retry hooks. By default this should be true.
func (*Config) BackupDir ¶
BackupDir returns the configuration string for the temporary files backup.
func (*Config) CharmHubURL ¶
CharmHubURL returns the URL to use for CharmHub API calls.
func (*Config) CloudInitUserData ¶
CloudInitUserData returns a copy of the raw user data attributes that were specified by the user.
func (*Config) ContainerImageMetadataDefaultsDisabled ¶
ContainerImageMetadataDefaultsDisabled returns whether or not default image metadata sources are disabled for containers. Useful for airgapped installations.
func (*Config) ContainerImageMetadataURL ¶
ContainerImageMetadataURL returns the URL at which the metadata used to locate container OS image ids is located, and whether it has been set.
func (*Config) ContainerImageStream ¶
ContainerImageStream returns the simplestreams stream used to identify which image ids to search when starting a container.
func (*Config) ContainerInheritProperties ¶
ContainerInheritProperties returns a copy of the raw user data keys that were specified by the user.
func (*Config) ContainerNetworkingMethod ¶
func (c *Config) ContainerNetworkingMethod() coremodelconfig.ContainerNetworkingMethod
ContainerNetworkingMethod returns the method with which containers network should be set up.
func (*Config) DefaultBase ¶
DefaultBase returns the configured default base for the model, and whether the default base was explicitly configured on the environment.
func (*Config) DefaultSpace ¶
DefaultSpace returns the name of the space for to be used for endpoint bindings that are not explicitly set.
func (*Config) Development ¶
Development returns whether the environment is in development mode.
func (*Config) DisableNetworkManagement ¶
DisableNetworkManagement reports whether Juju is allowed to configure and manage networking inside the environment.
func (*Config) EgressSubnets ¶
EgressSubnets are the source addresses from which traffic from this model originates if the model is deployed such that NAT or similar is in use.
func (*Config) EnableOSRefreshUpdate ¶
EnableOSRefreshUpdate returns whether or not newly provisioned instances should run their respective OS's update capability.
func (*Config) EnableOSUpgrade ¶
EnableOSUpgrade returns whether or not newly provisioned instances should run their respective OS's upgrade capability.
func (*Config) FirewallMode ¶
FirewallMode returns whether the firewall should manage ports per machine, globally, or not at all. (FwInstance, FwGlobal, or FwNone).
func (*Config) HTTPSProxy ¶
HTTPSProxy returns the legacy https proxy for the model.
func (*Config) HasJujuProxy ¶
HasJujuProxy returns true if there is any proxy set using the new juju-proxy keys.
func (*Config) HasLegacyProxy ¶
HasLegacyProxy returns true if there is any proxy set using the old legacy proxy keys.
func (*Config) IgnoreMachineAddresses ¶
IgnoreMachineAddresses reports whether Juju will discover and store machine addresses on startup.
func (*Config) ImageMetadataDefaultsDisabled ¶
ImageMetadataDefaultsDisabled returns whether or not default image metadata sources are disabled. Useful for airgapped installations.
func (*Config) ImageMetadataURL ¶
ImageMetadataURL returns the URL at which the metadata used to locate image ids is located, and whether it has been set.
func (*Config) ImageStream ¶
ImageStream returns the simplestreams stream used to identify which image ids to search when starting an instance.
func (*Config) JujuFTPProxy ¶
JujuFTPProxy returns the ftp proxy for the model.
func (*Config) JujuHTTPProxy ¶
JujuHTTPProxy returns the http proxy for the model.
func (*Config) JujuHTTPSProxy ¶
JujuHTTPSProxy returns the https proxy for the model.
func (*Config) JujuNoProxy ¶
JujuNoProxy returns the 'no-proxy' for the model. This value can contain CIDR values.
func (*Config) JujuProxySettings ¶
JujuProxySettings returns all four proxy settings that have been set using the juju- prefixed proxy settings. These values determine the current best practice for proxies.
func (*Config) LXDSnapChannel ¶
LXDSnapChannel returns the channel to be used when installing LXD from a snap.
func (*Config) LegacyProxySettings ¶
LegacyProxySettings returns all four proxy settings; http, https, ftp, and no proxy. These are considered legacy as using these values will cause the environment to be updated, which has shown to not work in many cases. It is being kept to avoid breaking environments where it is sufficient.
func (*Config) LoggingConfig ¶
LoggingConfig returns the configuration string for the loggers.
func (*Config) MaxActionResultsAge ¶
func (*Config) MaxActionResultsSizeMB ¶
func (*Config) MaxStatusHistoryAge ¶
MaxStatusHistoryAge is the maximum age of status history entries before being pruned.
func (*Config) MaxStatusHistorySizeMB ¶
MaxStatusHistorySizeMB is the maximum size in MiB which the status history collection can grow to before being pruned.
func (*Config) Mode ¶
Mode returns a set of mode types for the configuration. Only one option exists at the moment ('requires-prompts')
func (*Config) NetBondReconfigureDelay ¶
NetBondReconfigureDelay returns the duration in seconds that should be passed to the bridge script when bridging bonded interfaces.
func (*Config) NumContainerProvisionWorkers ¶
NumContainerProvisionWorkers returns the number of container provisioner workers to use.
func (*Config) NumProvisionWorkers ¶
NumProvisionWorkers returns the number of provisioner workers to use.
func (*Config) ProvisionerHarvestMode ¶
func (c *Config) ProvisionerHarvestMode() HarvestMode
ProvisionerHarvestMode reports the harvesting methodology the provisioner should take.
func (*Config) ProxySSH ¶
ProxySSH returns a flag indicating whether SSH commands should be proxied through the API server.
func (*Config) Remove ¶
Remove returns a new configuration that has the attributes of c minus attrs.
func (*Config) ResourceTags ¶
ResourceTags returns a set of tags to set on environment resources that Juju creates and manages, if the provider supports them. These tags have no special meaning to Juju, but may be used for existing chargeback accounting schemes or other identification purposes.
func (*Config) SAASIngressAllow ¶
SAASIngressAllow returns a slice of CIDRs specifying what ingress can be applied to offers in this model
func (*Config) SSHAllow ¶
SSHAllow returns a slice of CIDRs from which machines in this model will accept connections to the SSH service
func (*Config) SSLHostnameVerification ¶
SSLHostnameVerification returns whether the environment has requested SSL hostname verification to be enabled.
func (*Config) SnapHTTPProxy ¶
SnapHTTPProxy returns the snap http proxy for the model.
func (*Config) SnapHTTPSProxy ¶
SnapHTTPSProxy returns the snap https proxy for the model.
func (*Config) SnapProxySettings ¶
SnapProxySettings returns the two proxy settings; http, and https.
func (*Config) SnapStoreAssertions ¶
SnapStoreAssertions returns the snap store assertions for the model.
func (*Config) SnapStoreProxy ¶
SnapStoreProxy returns the snap store proxy for the model.
func (*Config) SnapStoreProxyURL ¶
SnapStoreProxyURL returns the snap store proxy URL for the model.
func (*Config) StorageDefaultBlockSource ¶
StorageDefaultBlockSource returns the default block storage source for the model.
func (*Config) StorageDefaultFilesystemSource ¶
StorageDefaultFilesystemSource returns the default filesystem storage source for the model.
func (*Config) TransmitVendorMetrics ¶
TransmitVendorMetrics returns whether the controller sends charm-collected metrics in this model for anonymized aggregate analytics. By default this should be true.
func (*Config) UnknownAttrs ¶
UnknownAttrs returns a copy of the raw configuration attributes that are supposedly specific to the environment type. They could also be wrong attributes, though. Only the specific environment implementation can tell.
func (*Config) UpdateStatusHookInterval ¶
UpdateStatusHookInterval is how often to run the charm update-status hook.
func (*Config) ValidateUnknownAttrs ¶
func (c *Config) ValidateUnknownAttrs(extrafields schema.Fields, defaults schema.Defaults) (map[string]any, error)
ValidateUnknownAttrs checks the unknown attributes of the config against the supplied fields and defaults, and returns an error if any fails to validate. Unknown fields are warned about, but preserved, on the basis that they are reasonably likely to have been written by or for a version of juju that does recognise the fields, but that their presence is still anomalous to some degree and should be flagged (and that there is thereby a mechanism for observing fields that really are typos etc).
type ConfigSchemaSource ¶
type ConfigSchemaSource interface { // ConfigSchema returns extra config attributes specific // to this provider only. ConfigSchema() schema.Fields // ConfigDefaults returns the default values for the // provider specific config attributes. ConfigDefaults() schema.Defaults }
ConfigSchemaSource instances provide information on config attributes and the default attribute values.
type ConfigSchemaSourceGetter ¶
type ConfigSchemaSourceGetter func(context.Context, string) (ConfigSchemaSource, error)
ConfigSchemaSourceGetter is a type for getting a ConfigSchemaSource.
type ConfigValue ¶
type ConfigValue struct { // Value is the configuration value. Value interface{} // Source is the name of the inherited config // source from where the value originates. Source string }
ConfigValue encapsulates a configuration value and its source.
type ConfigValues ¶
type ConfigValues map[string]ConfigValue
ConfigValues is a map of configuration values keyed by attribute name.
func (ConfigValues) AllAttrs ¶
func (c ConfigValues) AllAttrs() map[string]interface{}
AllAttrs returns just the attribute values from the config.
type Defaulting ¶
type Defaulting bool
Defaulting is a value that specifies whether a configuration creator should use defaults from the environment.
const ( // UseDefaults defines a constant for indicating of the default should be // used for the configuration. UseDefaults Defaulting = true // NoDefaults defines a constant for indicating that no defaults should be // used for the configuration. NoDefaults Defaulting = false )
type HarvestMode ¶
type HarvestMode uint32
HarvestMode is a bit field which is used to store the harvesting behavior for Juju.
const ( // HarvestNone signifies that Juju should not harvest any // machines. HarvestNone HarvestMode = 1 << iota // HarvestUnknown signifies that Juju should only harvest machines // which exist, but we don't know about. HarvestUnknown // HarvestDestroyed signifies that Juju should only harvest // machines which have been explicitly released by the user // through a destroy of an application/model/unit. HarvestDestroyed // HarvestAll signifies that Juju should harvest both unknown and // destroyed instances. ♫ Don't fear the reaper. ♫ HarvestAll = HarvestUnknown | HarvestDestroyed )
func ParseHarvestMode ¶
func ParseHarvestMode(description string) (HarvestMode, error)
ParseHarvestMode parses description of harvesting method and returns the representation.
func (HarvestMode) HarvestDestroyed ¶
func (method HarvestMode) HarvestDestroyed() bool
HarvestDestroyed returns whether or not the Destroyed harvesting flag is set.
func (HarvestMode) HarvestNone ¶
func (method HarvestMode) HarvestNone() bool
HarvestNone returns whether or not the None harvesting flag is set.
func (HarvestMode) HarvestUnknown ¶
func (method HarvestMode) HarvestUnknown() bool
HarvestUnknown returns whether or not the Unknown harvesting flag is set.
func (HarvestMode) String ¶
func (method HarvestMode) String() string
String returns the description of the harvesting mode.
type HasDefaultBase ¶
HasDefaultBase defines a interface if a type has a default base or not.
type ModelDefaultAttributes ¶
type ModelDefaultAttributes map[string]AttributeDefaultValues
ModelDefaultAttributes is a map of configuration values to a list of possible values.
type RegionDefaultValue ¶
type RegionDefaultValue struct { // Name represents the region name for this specific setting. Name string `json:"name" yaml:"name"` // Value is the value of the setting this represents in the named region. Value interface{} `json:"value" yaml:"value"` }
RegionDefaultValue holds the region information for each region in DefaultSetting.
type ValidationError ¶
type ValidationError struct { // InvalidAttrs is the list of attributes in the config that where invalid. InvalidAttrs []string // Reason is the human readable message for why the attributes are invalid. Reason string }
ValidationError represents a specific error that has occurred were validating Config. It allows for the placement of one or more attributes with a reason as to why either their keys or values are not valid in the current context.
func (*ValidationError) Error ¶
func (v *ValidationError) Error() string
Error implements Error interface.
func (*ValidationError) Is ¶
func (v *ValidationError) Is(err error) bool
Is implements errors.Is interface. We implement is so that the ValidationError also satisfies NotValid.
type Validator ¶
type Validator interface { // Validate ensures that cfg is a valid configuration. // If old is not nil, Validate should use it to determine // whether a configuration change is valid. // // TODO(axw) Validate should just return an error. We should // use a separate mechanism for updating config. Validate(ctx context.Context, cfg, old *Config) (valid *Config, _ error) }
Validator is an interface for validating model configuration.
func ModelValidator ¶
func ModelValidator() Validator
ModelValidator returns a validator that is suitable for validating model config. Any attributes found that are not supported in Model Configuration are returned in a ValidationError.
func NoControllerAttributesValidator ¶
func NoControllerAttributesValidator() Validator
NoControllerAttributesValidator implements a validator that asserts if the supplied config contains any controller specific configuration attributes. A ValidationError is returned if the config contains controller attributes.
type ValidatorFunc ¶
ValidatorFunc is utility type for declaring funcs that implement the Validator interface.