Documentation ¶
Index ¶
- Constants
- Variables
- func CommandExecute(command string, arguments []string, options ...CommandOption) ([]byte, error)
- func CommandExecuteUnmarshal(command string, arguments []string, unmarshaler Unmarshaler, ...) error
- func DefaultAddressFilter() (interface{}, error)
- func DefaultAddressPriority() (interface{}, error)
- func DefaultSshConfig() (interface{}, error)
- func HashAny(v interface{}) int
- func New() *schema.Provider
- func Readln(r *bufio.Reader) ([]byte, error)
- func SchemaMapExtend(original, extension map[string]*schema.Schema) map[string]*schema.Schema
- func SchemaWithDefaultFuncCtr(ctr SchemaDefaultFuncCtr, s *schema.Schema) *schema.Schema
- func SshSerializeConfig(ps SshConfigPairs) string
- type CIDR
- type Cmd
- type Command
- type CommandOption
- type CommandResult
- type Derivation
- type Derivations
- type Enclave
- type Environment
- func (e Environment) Add(key string, value ...string) Environment
- func (e Environment) Copy() Environment
- func (e Environment) Del(key string) Environment
- func (e Environment) Set(key string, value ...string) Environment
- func (e Environment) Slice() []string
- func (e Environment) With(ee Environment) Environment
- type File
- type IP
- type IPNet
- type Instance
- func (i Instance) Create(ctx context.Context, resource *schema.ResourceData, meta interface{}) diag.Diagnostics
- func (i Instance) Delete(ctx context.Context, resource *schema.ResourceData, meta interface{}) diag.Diagnostics
- func (i Instance) Diff(ctx context.Context, resource *schema.ResourceDiff, meta interface{}) error
- func (i Instance) Read(ctx context.Context, resource *schema.ResourceData, meta interface{}) diag.Diagnostics
- func (i Instance) Update(ctx context.Context, resource *schema.ResourceData, meta interface{}) diag.Diagnostics
- type LockedBuffer
- type LogWriter
- type Memo
- type Nix
- func (n *Nix) Build(options ...NixBuildCommandOption) *NixBuildCommand
- func (n *Nix) Close() error
- func (n *Nix) Command() (string, []string, []CommandOption)
- func (n *Nix) Copy(options ...NixCopyCommandOption) *NixCopyCommand
- func (n *Nix) Execute(result interface{}) error
- func (n *Nix) Profile(options ...NixProfileCommandOption) *NixProfileCommand
- func (n *Nix) With(options ...NixOption) *Nix
- type NixActivationAction
- type NixBuildCommand
- type NixBuildCommandOption
- func NixBuildCommandOptionArg(name string, expr string) NixBuildCommandOption
- func NixBuildCommandOptionArgStr(name string, value string) NixBuildCommandOption
- func NixBuildCommandOptionFile(fd File) NixBuildCommandOption
- func NixBuildCommandOptionJSON() NixBuildCommandOption
- func NixBuildCommandOptionMemoize(key string) NixBuildCommandOption
- func NixBuildCommandOptionNoLink() NixBuildCommandOption
- type NixCopyCommand
- type NixCopyCommandOption
- func NixCopyCommandOptionFrom(protocol NixCopyProtocol, from string) NixCopyCommandOption
- func NixCopyCommandOptionPath(path string) NixCopyCommandOption
- func NixCopyCommandOptionTo(protocol NixCopyProtocol, to string) NixCopyCommandOption
- func NixCopyCommandOptionUseSubstitutes() NixCopyCommandOption
- type NixCopyProtocol
- type NixFeature
- type NixMode
- type NixOption
- func NixOptionCores(num int) NixOption
- func NixOptionExperimentalFeatures(feature ...NixFeature) NixOption
- func NixOptionMode(mode NixMode) NixOption
- func NixOptionShowTrace() NixOption
- func NixOptionSsh(s *Ssh) NixOption
- func NixOptionSshOpts(opts ...string) NixOption
- func NixOptionUseSubstitutes() NixOption
- func NixOptionWithCommandOptions(options ...CommandOption) NixOption
- type NixProfileCommand
- type NixProfileCommandOption
- type NixProfileInstallCommand
- type NixProfileInstallCommandOption
- type Provider
- func (p *Provider) Address(rawAddrs interface{}) (IP, error)
- func (p *Provider) BastionSettings(resource ResourceBox) map[string]interface{}
- func (p *Provider) Build(ctx context.Context, resource ResourceBox) (Derivations, error)
- func (p *Provider) Close() error
- func (p *Provider) CopySecrets(ctx context.Context, resource ResourceBox, secrets *Secrets) error
- func (p *Provider) NewNix(ctx context.Context, resource ResourceBox) *Nix
- func (p *Provider) NewSecrets(resource ResourceBox) (*Secrets, error)
- func (p *Provider) NewSsh(resource ResourceBox) *Ssh
- func (p *Provider) NixSettings(resource ResourceBox) map[string]interface{}
- func (p *Provider) Push(ctx context.Context, resource ResourceBox, drvs Derivations) error
- func (p *Provider) SecretsSet(resource ResourceBox) []map[string]interface{}
- func (p *Provider) SecretsSettings(resource ResourceBox) map[string]interface{}
- func (p *Provider) SshConfigMap(settings map[string]interface{}) *SshConfigMap
- func (p *Provider) SshSettings(resource ResourceBox) map[string]interface{}
- func (p *Provider) Switch(ctx context.Context, resource ResourceBox, drvs Derivations) error
- type RemoteCommand
- type ResourceBox
- type ResourceData
- type SchemaDefaultFunc
- type SchemaDefaultFuncCtr
- type SecretData
- type SecretDescription
- type Secrets
- type SecretsCopy
- type SecretsCopyOption
- type SecretsData
- type SecretsDescriptions
- type SecretsProvider
- type SecretsProviderCommand
- type SecretsProviderFilesystem
- type SecretsProviderGopass
- type SecretsProviderName
- type Ssh
- type SshConfigKeyValue
- type SshConfigMap
- type SshConfigPairs
- type SshFinalizer
- type SshOption
- func SshOptionCommand(cmd string) SshOption
- func SshOptionConfig(path string) SshOption
- func SshOptionConfigFile(fd File) SshOption
- func SshOptionConfigMap(m *SshConfigMap) SshOption
- func SshOptionHost(host string) SshOption
- func SshOptionIORedirection(host, port string) SshOption
- func SshOptionNonInteractive() SshOption
- type StringCommand
- type Tar
- type TarOption
- type TempFile
- type Unmarshaler
- type UnmarshalerJSON
- type UnmarshalerPassthrough
Constants ¶
View Source
const ( KeyAddressFilter = "address_filter" KeyAddressPriority = "address_priority" KeyNixosInstance = "nixos_instance" KeyAddress = "address" KeySystem = "system" KeySettings = "settings" KeyConfiguration = "configuration" KeyRetry = "retry" KeyRetryWait = "retry_wait" KeyNix = "nix" KeyNixMode = "mode" KeyNixBuildWrapper = "build_wrapper" KeyNixProfile = "profile" KeyNixOutputName = "output" KeyNixActivationScript = "activation_script" KeyNixActivationAction = "activation_action" KeyNixShowTrace = "show_trace" KeyNixCores = "cores" KeyNixUseSubstitutes = "use_substitutes" KeySsh = "ssh" KeySshHost = "host" KeySshUser = "user" KeySshPort = "port" KeySshConfig = "config" KeyBastion = "bastion" KeySecrets = "secrets" KeySecretFingerprint = "secret_fingerprint" KeySecretFingerprintSum = "sum" KeySecretFingerprintSalt = "salt" KeySecretFingerprintKdfIterations = "kdf_iterations" KeySecretsProvider = "provider" KeySecretsProviderFilesystem = "filesystem" KeySecretsProviderCommand = "command" KeySecretsProviderCommandName = "name" KeySecretsProviderCommandArguments = "arguments" KeySecretsProviderCommandEnvironment = "environment" KeySecretsProviderGopass = "gopass" KeySecretsProviderGopassStore = "store" KeySecret = "secret" KeySecretSource = "source" KeySecretDestination = "destination" KeySecretOwner = "owner" KeySecretGroup = "group" KeySecretPermissions = "permissions" KeyDerivations = "derivations" KeyDerivationPath = "path" KeyDerivationOutputs = "outputs" )
View Source
const ( SshConfigKeyHost = "host" SshConfigKeyUser = "user" SshConfigKeyPort = "port" SshConfigKeyProxyCommand = "proxyCommand" )
View Source
const (
DefaultUser = "root"
)
View Source
const (
NixEnvironmentSshOpts = "NIX_SSHOPTS"
)
View Source
const SecretDataKeyLen = 32
Variables ¶
View Source
var ( ProviderSchemaSshMap = map[string]*schema.Schema{ KeySshUser: { Description: "SSH remote user name", Type: schema.TypeString, Optional: true, Default: DefaultUser, }, KeySshPort: { Description: "SSH remote port", Type: schema.TypeInt, Optional: true, }, KeySshConfig: { Description: "SSH configuration map", Type: schema.TypeMap, Elem: &schema.Schema{Type: schema.TypeString}, Optional: true, DefaultFunc: DefaultSshConfig, }, } ProviderSchemaSsh = SchemaWithDefaultFuncCtr(DefaultMapFromSchema, &schema.Schema{ Description: "SSH protocol settings", Type: schema.TypeSet, MaxItems: 1, Elem: &schema.Resource{ Schema: ProviderSchemaSshMap, }, Optional: true, }) ProviderSchemaBastionMap = SchemaMapExtend( ProviderSchemaSshMap, map[string]*schema.Schema{ KeySshHost: { Description: "SSH bastion remote hostname", Type: schema.TypeString, Optional: true, }, }, ) ProviderSchemaBastion = SchemaWithDefaultFuncCtr(DefaultMapFromSchema, &schema.Schema{ Description: "SSH configuration for bastion server", Type: schema.TypeSet, MaxItems: 1, Elem: &schema.Resource{ Schema: ProviderSchemaBastionMap, }, Optional: true, }) ProviderSchemaSecretsProviderFilesystem = SchemaWithDefaultFuncCtr(DefaultMapFromSchema, &schema.Schema{ Description: "Filesystem secrets provider settings", Type: schema.TypeSet, MinItems: 0, MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{}, }, Optional: true, }) ProviderSchemaSecretsProviderCommand = SchemaWithDefaultFuncCtr(DefaultMapFromSchema, &schema.Schema{ Description: "Command secrets provider settings", Type: schema.TypeSet, MinItems: 0, MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ KeySecretsProviderCommandName: { Description: "Provider command name (will be looked up in PATH) to use to retrieve secret", Type: schema.TypeString, Required: true, }, KeySecretsProviderCommandArguments: { Description: "Provider command arguments to prepend to secret source", Type: schema.TypeList, Elem: &schema.Schema{Type: schema.TypeString}, Optional: true, }, KeySecretsProviderCommandEnvironment: { Description: "Provider command environment variables", Type: schema.TypeMap, Elem: &schema.Schema{Type: schema.TypeString}, Optional: true, }, }, }, Optional: true, }) ProviderSchemaSecretsProviderGopass = SchemaWithDefaultFuncCtr(DefaultMapFromSchema, &schema.Schema{ Description: "GoPass secrets provider settings", Type: schema.TypeSet, MinItems: 0, MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ KeySecretsProviderGopassStore: { Description: "Password store directory location", Type: schema.TypeString, Optional: true, }, }, }, Optional: true, }) ProviderSchemaSecretsMap = map[string]*schema.Schema{ KeySecretsProvider: { Description: fmt.Sprintf("Secrets provider to use, available: %v", SecretsProviders), Type: schema.TypeString, Optional: true, Default: string(SecretsProviderNameFilesystem), }, KeySecretsProviderFilesystem: ProviderSchemaSecretsProviderFilesystem, KeySecretsProviderCommand: ProviderSchemaSecretsProviderCommand, KeySecretsProviderGopass: ProviderSchemaSecretsProviderGopass, } ProviderSchemaSecrets = SchemaWithDefaultFuncCtr(DefaultMapFromSchema, &schema.Schema{ Description: "Describes secrets settings", Type: schema.TypeSet, MinItems: 0, MaxItems: 1, Elem: &schema.Resource{ Schema: ProviderSchemaSecretsMap, }, Optional: true, }) ProviderSchemaSecretFingerprint = &schema.Schema{ Description: "Secrets state fingerprint information which is used to maintain state", Type: schema.TypeMap, Elem: &schema.Schema{Type: schema.TypeString}, Computed: true, } ProviderSchemaSecret = SchemaWithDefaultFuncCtr(DefaultMapFromSchema, &schema.Schema{ Description: "Describes secret which should be transfered to host", Type: schema.TypeSet, MinItems: 0, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ KeySecretSource: { Description: "Secret file on the host which should be transfered to destination", Type: schema.TypeString, Required: true, }, KeySecretDestination: { Description: "Secret file destination on the target host", Type: schema.TypeString, Required: true, }, KeySecretOwner: { Description: "Secret file owner username", Type: schema.TypeString, Optional: true, Default: "root", }, KeySecretGroup: { Description: "Secret file owner groupname", Type: schema.TypeString, Optional: true, Default: "root", }, KeySecretPermissions: { Description: "Secret file destination permissions (in octal)", Type: schema.TypeInt, Optional: true, Default: 600, }, }, }, Optional: true, }) ProviderSchemaDerivationsComputedMap = map[string]*schema.Schema{ KeyDerivationPath: { Description: "Path to the derivation in Nix store", Type: schema.TypeString, Optional: true, Computed: true, }, KeyDerivationOutputs: { Description: "Derivation outputs paths in the Nix store", Type: schema.TypeMap, Elem: &schema.Schema{Type: schema.TypeString}, Optional: true, Computed: true, }, } ProviderSchemaNix = SchemaWithDefaultFuncCtr(DefaultMapFromSchema, &schema.Schema{ Description: "Nix package manager configuration options", Type: schema.TypeSet, MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ KeyNixMode: { Description: "Nix mode (0 - compat, 1 - default)", Type: schema.TypeInt, Optional: true, Default: int(NixModeCompat), }, KeyNixBuildWrapper: { Description: "Path to the configuration wrapper in Nix language (function which returns drv_path & out_path)", Type: schema.TypeString, Optional: true, }, KeyNixProfile: { Description: "Path to the current system profile", Type: schema.TypeString, Optional: true, Default: "/nix/var/nix/profiles/system", }, KeyNixOutputName: { Description: "System derivation output name", Type: schema.TypeString, Optional: true, Default: "out", }, KeyNixActivationScript: { Description: "Path to the system profile activation script", Type: schema.TypeString, Optional: true, Default: "/nix/var/nix/profiles/system/bin/switch-to-configuration", }, KeyNixActivationAction: { Description: "Activation script action, one of: switch|boot|test|dry-activate", Type: schema.TypeString, Optional: true, Default: "switch", }, KeyNixShowTrace: { Description: "Show Nix package manager trace on error", Type: schema.TypeBool, Optional: true, Default: true, }, KeyNixCores: { Description: "Number of CPU cores which Nix should use to perform builds", Type: schema.TypeInt, Optional: true, }, KeyNixUseSubstitutes: { Description: "Whether or not should Nix use substitutes", Type: schema.TypeBool, Optional: true, Default: true, }, }, }, Optional: true, }) ProviderSchemaMap = map[string]*schema.Schema{ KeyRetry: { Description: "Amount of retries for retryable operations", Type: schema.TypeInt, Optional: true, Default: 5, }, KeyRetryWait: { Description: "Amount of seconds to wait between retries", Type: schema.TypeInt, Optional: true, Default: 5, }, KeyAddressFilter: { Description: "List of network cidr's to filter addresses used to connect to nixos_instance resources", Type: schema.TypeList, Elem: &schema.Schema{Type: schema.TypeString}, Optional: true, DefaultFunc: DefaultAddressFilter, }, KeyAddressPriority: { Description: "Map of network cidr's with associated weight which will affect address ordering for nixos_isntance resource", Type: schema.TypeMap, Elem: &schema.Schema{Type: schema.TypeInt}, Optional: true, DefaultFunc: DefaultAddressPriority, }, KeyNix: ProviderSchemaNix, KeySsh: ProviderSchemaSsh, KeyBastion: ProviderSchemaBastion, KeySecrets: ProviderSchemaSecrets, KeySecret: ProviderSchemaSecret, } ProviderResourceMap = map[string]*schema.Resource{ KeyNixosInstance: { Description: "NixOS instance", CustomizeDiff: instance.Diff, CreateContext: instance.Create, ReadContext: instance.Read, UpdateContext: instance.Update, DeleteContext: instance.Delete, Schema: map[string]*schema.Schema{ KeyAddress: { Description: "List of server addresses", Type: schema.TypeList, Elem: &schema.Schema{Type: schema.TypeString}, Required: true, }, KeySystem: { Description: "Nix arch & target to build for (defaults to x86_64-linux)", Type: schema.TypeString, Optional: true, Default: "x86_64-linux", }, KeySettings: { Description: "Optional settings (encoded with HCL function jsonencode()) to pass into Nix configuration derivation as attribute set (any configuration key could be specified)", Type: schema.TypeString, Optional: true, Default: "{}", }, KeyConfiguration: { Description: "Path to Nix derivation", Type: schema.TypeString, Required: true, }, KeyNix: ProviderSchemaNix, KeySsh: ProviderSchemaSsh, KeyBastion: ProviderSchemaBastion, KeySecrets: ProviderSchemaSecrets, KeySecret: ProviderSchemaSecret, KeySecretFingerprint: ProviderSchemaSecretFingerprint, KeyDerivations: { Description: "List of derivations which is built during apply", Type: schema.TypeList, Elem: &schema.Resource{Schema: ProviderSchemaDerivationsComputedMap}, Optional: true, Computed: true, }, }, }, } ProviderSchema = schema.Provider{ Schema: ProviderSchemaMap, ResourcesMap: ProviderResourceMap, } )
View Source
var NixWrapper []byte
View Source
var ( SecretsProviders = []string{ string(SecretsProviderNameFilesystem), string(SecretsProviderNameCommand), string(SecretsProviderNameGopass), } )
Functions ¶
func CommandExecute ¶
func CommandExecute(command string, arguments []string, options ...CommandOption) ([]byte, error)
func CommandExecuteUnmarshal ¶
func CommandExecuteUnmarshal(command string, arguments []string, unmarshaler Unmarshaler, result interface{}, options ...CommandOption) error
func DefaultAddressFilter ¶
func DefaultAddressFilter() (interface{}, error)
func DefaultAddressPriority ¶
func DefaultAddressPriority() (interface{}, error)
func DefaultSshConfig ¶
func DefaultSshConfig() (interface{}, error)
func SchemaMapExtend ¶
func SchemaWithDefaultFuncCtr ¶
func SchemaWithDefaultFuncCtr(ctr SchemaDefaultFuncCtr, s *schema.Schema) *schema.Schema
func SshSerializeConfig ¶
func SshSerializeConfig(ps SshConfigPairs) string
Types ¶
type Cmd ¶
type Command ¶
type Command interface { Command() (string, []string, []CommandOption) Execute(result CommandResult) error Close() error }
type CommandOption ¶
type CommandOption func(*Cmd)
func CommandOptionEnv ¶
func CommandOptionEnv(env Environment) CommandOption
func CommandOptionStdin ¶
func CommandOptionStdin(stdin io.Reader) CommandOption
func CommandOptionTflogTee ¶
func CommandOptionTflogTee(ctx context.Context) CommandOption
type CommandResult ¶
type CommandResult = interface{}
type Derivation ¶
type Derivation struct { Path string `json:"drvPath" mapstructure:"path"` Outputs map[string]string `json:"outputs" mapstructure:"outputs"` }
func (Derivation) Hash ¶
func (d Derivation) Hash() string
type Derivations ¶
type Derivations []Derivation
func (Derivations) Hash ¶
func (ds Derivations) Hash() string
type Environment ¶
func NewEnvironment ¶
func NewEnvironment(vars ...map[string][]string) Environment
func (Environment) Add ¶
func (e Environment) Add(key string, value ...string) Environment
func (Environment) Copy ¶
func (e Environment) Copy() Environment
func (Environment) Del ¶
func (e Environment) Del(key string) Environment
func (Environment) Set ¶
func (e Environment) Set(key string, value ...string) Environment
func (Environment) Slice ¶
func (e Environment) Slice() []string
func (Environment) With ¶
func (e Environment) With(ee Environment) Environment
TODO: by default we expect "Add" semantics but at some point in time we may need "Set" semantics so it probably should be injectable
type File ¶
type File interface { Name() string Seek(offset int64, whence int) (ret int64, err error) Read(b []byte) (n int, err error) Write(b []byte) (n int, err error) Close() error }
func NewNixWrapperFile ¶
type IP ¶
func FilterIPAddress ¶
type Instance ¶
type Instance struct{}
func (Instance) Create ¶
func (i Instance) Create(ctx context.Context, resource *schema.ResourceData, meta interface{}) diag.Diagnostics
func (Instance) Delete ¶
func (i Instance) Delete(ctx context.Context, resource *schema.ResourceData, meta interface{}) diag.Diagnostics
func (Instance) Read ¶
func (i Instance) Read(ctx context.Context, resource *schema.ResourceData, meta interface{}) diag.Diagnostics
func (Instance) Update ¶
func (i Instance) Update(ctx context.Context, resource *schema.ResourceData, meta interface{}) diag.Diagnostics
type LockedBuffer ¶
type LockedBuffer = memguard.LockedBuffer
func NewLockedBuffer ¶
func NewLockedBuffer(buf []byte) *LockedBuffer
type LogWriter ¶
func NewLogWriter ¶
type Nix ¶
type Nix struct { Mode NixMode Arguments []string CommandOptions []CommandOption Environment Environment Ssh *Ssh }
func (*Nix) Build ¶
func (n *Nix) Build(options ...NixBuildCommandOption) *NixBuildCommand
func (*Nix) Copy ¶
func (n *Nix) Copy(options ...NixCopyCommandOption) *NixCopyCommand
func (*Nix) Profile ¶
func (n *Nix) Profile(options ...NixProfileCommandOption) *NixProfileCommand
type NixActivationAction ¶
type NixActivationAction = string
const ( NixActivationActionNone NixActivationAction = "" NixActivationActionSwitch NixActivationAction = "switch" NixActivationActionBoot NixActivationAction = "boot" NixActivationActionTest NixActivationAction = "test" NixActivationActionDryActivate NixActivationAction = "dry-activate" )
type NixBuildCommand ¶
type NixBuildCommand struct { Nix *Nix Arguments []string Memoize bool MemoKey string Unmarshaler }
func (*NixBuildCommand) Close ¶
func (n *NixBuildCommand) Close() error
func (*NixBuildCommand) Command ¶
func (n *NixBuildCommand) Command() (string, []string, []CommandOption)
func (*NixBuildCommand) Execute ¶
func (n *NixBuildCommand) Execute(result interface{}) error
type NixBuildCommandOption ¶
type NixBuildCommandOption func(*NixBuildCommand)
func NixBuildCommandOptionArg ¶
func NixBuildCommandOptionArg(name string, expr string) NixBuildCommandOption
func NixBuildCommandOptionArgStr ¶
func NixBuildCommandOptionArgStr(name string, value string) NixBuildCommandOption
func NixBuildCommandOptionFile ¶
func NixBuildCommandOptionFile(fd File) NixBuildCommandOption
func NixBuildCommandOptionJSON ¶
func NixBuildCommandOptionJSON() NixBuildCommandOption
func NixBuildCommandOptionMemoize ¶
func NixBuildCommandOptionMemoize(key string) NixBuildCommandOption
func NixBuildCommandOptionNoLink ¶
func NixBuildCommandOptionNoLink() NixBuildCommandOption
type NixCopyCommand ¶
func (*NixCopyCommand) Close ¶
func (n *NixCopyCommand) Close() error
func (*NixCopyCommand) Command ¶
func (n *NixCopyCommand) Command() (string, []string, []CommandOption)
func (*NixCopyCommand) Execute ¶
func (n *NixCopyCommand) Execute(result interface{}) error
type NixCopyCommandOption ¶
type NixCopyCommandOption func(*NixCopyCommand)
func NixCopyCommandOptionFrom ¶
func NixCopyCommandOptionFrom(protocol NixCopyProtocol, from string) NixCopyCommandOption
func NixCopyCommandOptionPath ¶
func NixCopyCommandOptionPath(path string) NixCopyCommandOption
func NixCopyCommandOptionTo ¶
func NixCopyCommandOptionTo(protocol NixCopyProtocol, to string) NixCopyCommandOption
func NixCopyCommandOptionUseSubstitutes ¶
func NixCopyCommandOptionUseSubstitutes() NixCopyCommandOption
type NixCopyProtocol ¶
type NixCopyProtocol string
const ( NixCopyProtocolNone NixCopyProtocol = "" NixCopyProtocolSSH NixCopyProtocol = "ssh" NixCopyProtocolS3 NixCopyProtocol = "s3" NixCopyProtocolFile NixCopyProtocol = "file" )
func (NixCopyProtocol) Path ¶
func (n NixCopyProtocol) Path(path string) string
type NixOption ¶
type NixOption func(*Nix)
func NixOptionCores ¶
func NixOptionExperimentalFeatures ¶
func NixOptionExperimentalFeatures(feature ...NixFeature) NixOption
func NixOptionMode ¶
func NixOptionShowTrace ¶
func NixOptionShowTrace() NixOption
func NixOptionSsh ¶
func NixOptionSshOpts ¶
func NixOptionUseSubstitutes ¶
func NixOptionUseSubstitutes() NixOption
func NixOptionWithCommandOptions ¶
func NixOptionWithCommandOptions(options ...CommandOption) NixOption
type NixProfileCommand ¶
func (*NixProfileCommand) Close ¶
func (n *NixProfileCommand) Close() error
func (*NixProfileCommand) Command ¶
func (n *NixProfileCommand) Command() (string, []string, []CommandOption)
func (*NixProfileCommand) Execute ¶
func (n *NixProfileCommand) Execute(result interface{}) error
func (*NixProfileCommand) Install ¶
func (n *NixProfileCommand) Install(options ...NixProfileInstallCommandOption) *NixProfileInstallCommand
type NixProfileCommandOption ¶
type NixProfileCommandOption func(*NixProfileCommand)
type NixProfileInstallCommand ¶
type NixProfileInstallCommand struct { Profile *NixProfileCommand Arguments []string }
func (*NixProfileInstallCommand) Close ¶
func (n *NixProfileInstallCommand) Close() error
func (*NixProfileInstallCommand) Command ¶
func (n *NixProfileInstallCommand) Command() (string, []string, []CommandOption)
func (*NixProfileInstallCommand) Execute ¶
func (n *NixProfileInstallCommand) Execute(result interface{}) error
type NixProfileInstallCommandOption ¶
type NixProfileInstallCommandOption func(*NixProfileInstallCommand)
func NixProfileInstallCommandOptionDerivation ¶
func NixProfileInstallCommandOptionDerivation(path string) NixProfileInstallCommandOption
func NixProfileInstallCommandOptionProfile ¶
func NixProfileInstallCommandOptionProfile(location string) NixProfileInstallCommandOption
type Provider ¶
type Provider struct { ResourceBox // contains filtered or unexported fields }
func NewProvider ¶
func NewProvider(d ResourceBox) (*Provider, error)
func (*Provider) BastionSettings ¶
func (p *Provider) BastionSettings(resource ResourceBox) map[string]interface{}
func (*Provider) Build ¶
func (p *Provider) Build(ctx context.Context, resource ResourceBox) (Derivations, error)
func (*Provider) CopySecrets ¶
func (*Provider) NewSecrets ¶
func (p *Provider) NewSecrets(resource ResourceBox) (*Secrets, error)
func (*Provider) NewSsh ¶
func (p *Provider) NewSsh(resource ResourceBox) *Ssh
func (*Provider) NixSettings ¶
func (p *Provider) NixSettings(resource ResourceBox) map[string]interface{}
func (*Provider) Push ¶
func (p *Provider) Push(ctx context.Context, resource ResourceBox, drvs Derivations) error
func (*Provider) SecretsSet ¶
func (p *Provider) SecretsSet(resource ResourceBox) []map[string]interface{}
func (*Provider) SecretsSettings ¶
func (p *Provider) SecretsSettings(resource ResourceBox) map[string]interface{}
func (*Provider) SshConfigMap ¶
func (p *Provider) SshConfigMap(settings map[string]interface{}) *SshConfigMap
func (*Provider) SshSettings ¶
func (p *Provider) SshSettings(resource ResourceBox) map[string]interface{}
func (*Provider) Switch ¶
func (p *Provider) Switch(ctx context.Context, resource ResourceBox, drvs Derivations) error
type RemoteCommand ¶
func NewRemoteCommand ¶
func NewRemoteCommand(s *Ssh, c Command) *RemoteCommand
func (*RemoteCommand) Close ¶
func (c *RemoteCommand) Close() error
func (*RemoteCommand) Command ¶
func (c *RemoteCommand) Command() (string, []string, []CommandOption)
func (*RemoteCommand) Execute ¶
func (c *RemoteCommand) Execute(v interface{}) error
type ResourceBox ¶
type ResourceBox interface {
Get(string) interface{}
}
type ResourceData ¶
type ResourceData struct { ResourceBox Schema map[string]*schema.Schema }
func (*ResourceData) Get ¶
func (rd *ResourceData) Get(key string) interface{}
type SchemaDefaultFunc ¶
type SchemaDefaultFunc = schema.SchemaDefaultFunc
func DefaultMapFromSchema ¶
func DefaultMapFromSchema(s *schema.Schema) SchemaDefaultFunc
type SchemaDefaultFuncCtr ¶
type SchemaDefaultFuncCtr = func(*schema.Schema) SchemaDefaultFunc
type SecretData ¶
type SecretData struct { *LockedBuffer *SecretDescription }
func (*SecretData) HashString ¶
func (s *SecretData) HashString(salt []byte, iter int) string
type SecretDescription ¶
type Secrets ¶
type Secrets struct { Provider SecretsProvider Secrets SecretsDescriptions // contains filtered or unexported fields }
func NewSecrets ¶
func NewSecrets(p SecretsProvider, s SecretsDescriptions) *Secrets
func (*Secrets) Data ¶
func (s *Secrets) Data() (SecretsData, error)
type SecretsCopy ¶
type SecretsCopy struct { *RemoteCommand Secrets *Secrets }
type SecretsCopyOption ¶
type SecretsCopyOption func(*SecretsCopy)
type SecretsData ¶
type SecretsData []*SecretData
func (SecretsData) Destroy ¶
func (s SecretsData) Destroy()
func (SecretsData) HashString ¶
func (s SecretsData) HashString(salt []byte, iter int) string
type SecretsDescriptions ¶
type SecretsDescriptions []*SecretDescription
type SecretsProvider ¶
type SecretsProviderCommand ¶
type SecretsProviderCommand struct { Command string Arguments []string Environment Environment }
func NewSecretsProviderCommand ¶
func NewSecretsProviderCommand(command string, arguments []string, environment map[string]string) *SecretsProviderCommand
func (*SecretsProviderCommand) Get ¶
func (p *SecretsProviderCommand) Get(source string) ([]byte, error)
func (*SecretsProviderCommand) Name ¶
func (p *SecretsProviderCommand) Name() string
type SecretsProviderFilesystem ¶
type SecretsProviderFilesystem struct{}
func NewSecretsProviderFilesystem ¶
func NewSecretsProviderFilesystem() *SecretsProviderFilesystem
func (*SecretsProviderFilesystem) Get ¶
func (p *SecretsProviderFilesystem) Get(source string) ([]byte, error)
func (*SecretsProviderFilesystem) Name ¶
func (p *SecretsProviderFilesystem) Name() string
type SecretsProviderGopass ¶
type SecretsProviderGopass struct {
*SecretsProviderCommand
}
func NewSecretsProviderGopass ¶
func NewSecretsProviderGopass(store string) *SecretsProviderGopass
type SecretsProviderName ¶
type SecretsProviderName string
const ( SecretsProviderNameFilesystem SecretsProviderName = "filesystem" SecretsProviderNameCommand SecretsProviderName = "command" SecretsProviderNameGopass SecretsProviderName = "gopass" )
type SshConfigKeyValue ¶
type SshConfigMap ¶
type SshConfigMap struct {
// contains filtered or unexported fields
}
func NewSshConfigMap ¶
func NewSshConfigMap() *SshConfigMap
func (*SshConfigMap) Copy ¶
func (m *SshConfigMap) Copy() *SshConfigMap
func (*SshConfigMap) Extend ¶
func (m *SshConfigMap) Extend(em *SshConfigMap)
func (*SshConfigMap) Len ¶
func (m *SshConfigMap) Len() int
func (*SshConfigMap) Pairs ¶
func (m *SshConfigMap) Pairs() SshConfigPairs
func (*SshConfigMap) Set ¶
func (m *SshConfigMap) Set(key, value string)
type SshConfigPairs ¶
type SshConfigPairs = []SshConfigKeyValue
type SshFinalizer ¶
type SshFinalizer func(*Ssh)
func SshFinalizerFile ¶
func SshFinalizerFile(fd File) SshFinalizer
type SshOption ¶
type SshOption func(*Ssh)
func SshOptionCommand ¶
func SshOptionConfig ¶
func SshOptionConfigFile ¶
func SshOptionConfigMap ¶
func SshOptionConfigMap(m *SshConfigMap) SshOption
func SshOptionHost ¶
func SshOptionIORedirection ¶
func SshOptionNonInteractive ¶
func SshOptionNonInteractive() SshOption
type StringCommand ¶
type StringCommand struct { Cmd string Arguments []string Options []CommandOption }
func CommandFromString ¶
func CommandFromString(command string, arguments ...string) *StringCommand
func (*StringCommand) Close ¶
func (c *StringCommand) Close() error
func (*StringCommand) Command ¶
func (c *StringCommand) Command() (string, []string, []CommandOption)
func (*StringCommand) Execute ¶
func (c *StringCommand) Execute(v interface{}) error
type Tar ¶
type Tar struct { CommandOptions []CommandOption Arguments []string }
type TarOption ¶
type TarOption func(t *Tar)
func TarOptionChDir ¶
func TarOptionCommandOptions ¶
func TarOptionCommandOptions(option ...CommandOption) TarOption
func TarOptionCreate ¶
func TarOptionCreate() TarOption
func TarOptionExtract ¶
func TarOptionExtract() TarOption
func TarOptionFile ¶
func TarOptionGzip ¶
func TarOptionGzip() TarOption
func TarOptionPaths ¶
type TempFile ¶
func CreateTemp ¶
type Unmarshaler ¶
type UnmarshalerJSON ¶
type UnmarshalerJSON struct{}
func NewUnmarshalerJSON ¶
func NewUnmarshalerJSON() *UnmarshalerJSON
func (*UnmarshalerJSON) Unmarshal ¶
func (*UnmarshalerJSON) Unmarshal(buf []byte, v interface{}) error
type UnmarshalerPassthrough ¶
type UnmarshalerPassthrough struct{}
func NewUnmarshalerPassthrough ¶
func NewUnmarshalerPassthrough() *UnmarshalerPassthrough
func (*UnmarshalerPassthrough) Unmarshal ¶
func (*UnmarshalerPassthrough) Unmarshal(buf []byte, v interface{}) error
Click to show internal directories.
Click to hide internal directories.