devops

package module
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: May 20, 2022 License: MIT Imports: 24 Imported by: 1

README

go-devops

This repository exports a package devops that simplifies writing of Go applications as internal tooling "glue".

Why you might want to use this

  1. You spend your time writing shell scripts and are sick of having untestable code (without significant effort)
  2. You are in a DevOps team moving towards a product way of doing things and have picked up Go an want to rewrite your shell scripts using Go

Design principles

  1. All New[.]* functions will return an interface as far as possible, while this could hide data, it also prevents state related errors from modifications after initialisation. This is in turn supported by validation checks that run during the initialisation process
  2. All New[.]* functions will perform a sanity check on provided options and return an error if checks are not successful. While this could be annoying, this encourages lazy-instantiation so that assigned properties do not become stale
  3. Rather than just providing methods to run a function, which would easily solve problems addressed above, we require a constructor for most objects via a method named New[.]* to allow for passing the instance to another controller, which means with this separation you can also separate your data access/creation and controller code by passing an instance to a controller for processing

Usage and Examples

All examples assume the importing of this package using:

// ...
import "gitlab.com/zephinzer/go-devops"
// ...

Commands

Running a command

A working example is available at ./cmd/command

The following runs ls -al:

func main() {
  ls, _ := devops.NewCommand(devops.NewCommandOpts{
    Command: "ls",
    Arguments: []string{"-a", "-l"},
  })
  ls.Run()
}

The following runs go mod vendor and pulls in dependencies for a Go project:

func main() {
  installGoDeps, _ := devops.NewCommand(devops.NewCommandOpts{
    Command: "go",
    Arguments: []string{"mod", "vendor"},
  })
  installGoDeps.Run()
}

The following runs npm install and pulls in dependencies for a Node project:

func main() {
  installNodeDeps, _ := devops.NewCommand(devops.NewCommandOpts{
    Command: "npm",
    Arguments: "install",
  })
  installNodeDeps.Run()
}

Input data

Download files

A working example is available at ./cmd/download

The .DownloadFile method downloads the source code from Google into a specified DestinationPath:

func main() {
	targetURL, err := url.Parse("https://google.com")
  if err != nil {
    panic(err)
  }
	if err = devops.DownloadFile(DownloadFileOpts{
		DestinationPath: "./google.com.src.txt",
		URL:             targetURL,
	}); err != nil {
    panic(err)
  }
}
Get data from a HTTP endpoint

A working example is available at ./cmd/curl

The .SendHTTPRequest method can be used in place of cURL to make a HTTP request:

func main() {
	targetURL, err := url.Parse("https://httpbin.org/uuid")
	if err != nil {
		panic(err)
	}
	response, err := devops.SendHTTPRequest(devops.SendHTTPRequestOpts{
		URL: targetURL,
	})
	responseBody, err := ioutil.ReadAll(response.Body)
	if err != nil {
		panic(err)
	}
	fmt.Printf("uuid: %s", string(responseBody))
}

.SendHTTPRequest supports all common curl flags via the SendHTTPRequestOpts object.

Load configuration

A working example is available at ./cmd/configuration

The .LoadConfiguration method allows you to load from environment variables using your own struct definition:

type configuration struct {
  // CustomEnvString will be read using os.Getenv("USE_THIS_INSTEAD")
  CustomEnvString     string `env:"USE_THIS_INSTEAD"`
  // RequiredStringSlice will be read using os.Getenv("REQUIRED_STRING_SLICE")
	RequiredStringSlice []string  `default:"a,b,c" delimiter:","`
	RequiredString      string    `default:"hello world"`
	RequiredInt         int       `default:"1"`
	RequiredBool        bool      `default:"true"`
	OptionalString      *string   `default:"hola mundo"`
	OptionalStringSlice *[]string `default:"d,e,f" delimiter:","`
	OptionalInt         *int      `default:"2"`
  OptionalBool        *bool     `default:"true"`
}

func main() {
	c := configuration{}
	if err := devops.LoadConfiguration(&c); err != nil {
    // use it like an error
    log.Println(err)

    // consolidated errors
    errs := err.(devops.LoadConfigurationErrors)
    log.Printf("error code   : %v", errs.GetCode())
    log.Printf("error message: %s", errs.GetMessage())

    // individual errors
    log.Println("errors follow")
    for _, errInstance := range err.(devops.LoadConfigurationErrors) {
      log.Printf("code   : %v", errInstance.Code)
      log.Printf("message: %s", errInstance.Message)
    }

		os.Exit(errs.GetCode())
	}
}
Notes on loading configuration
  1. Property names are automagically converted to UPPER_SNAKE_CASE and these are used to load values from the environment using os.Getenv
  2. To define a custom environment key for the property, use the env:"READ_FROM_THIS_INSTEAD" struct tag
  3. To define a default value for the property, use the default:"default value" struct tag
  4. To indiciate a configuration property is REQUIRED, specify the type as a value type. If the environment does not contain the environment key, an error is returned
  5. To indiciate a configuration property is OPTIONAL, specify the type as a *pointer type. If the environment does not contain the environment key, the value is set to nil
  6. When defining a slice of strings, use the delimiter:"," struct tag to define the character sequence used to indicate boundaries between sequential strings
  7. The returned error can be type-asserted into a LoadConfigurationErrors structure which provides both a GetCode() and a GetMessage() method you can use for assessing errors, you could range through it to get individual errors or just call .Error() to get a collated error message

Input validation

Validating applications

The .ValidateApplications function can be used to validate that paths provided are executable or in the system's $PATH variable.

A full example follows:

func main() {
	err := devops.ValidateApplications(ValidateApplicationsOpts{
		Paths: []string{"thisappdoesnotexist"},
	})
  if err != nil {
    if _, ok := err.(devops.ValidateApplicationsErrors); ok {
      panic(fmt.Sprintf("failed to find applications: ['%s']", strings.Join(err.Errors, "', '")))
    }
  }
}
Validating connections

The .ValidateConnection function can be used to validate that a provided hostname and port is reachable and listening for requests.

A full example follows:

func main() {
  err := devops.ValidateConnection(ValidateConnectionOpts{
    Hostname: "google.com",
    Port: 80,
  })
  if err != nil {
    panic(err)
  }
}
Validating the environment

The .ValidateEnvironment can be used to validate that certain keys of interest are defined in the enviornment and returns an error if it doesn't.

A full example follows:

func main() {
	err := ValidateEnvironment(ValidateEnvironmentOpts{
		Keys: EnvironmentKeys{
			{Name: "STRING", Type: TypeString},
			{Name: "INT", Type: TypeInt},
			{Name: "UINT", Type: TypeUint},
			{Name: "FLOAT", Type: TypeFloat},
			{Name: "BOOL", Type: TypeBool},
			{Name: "ANY", Type: TypeAny},
		},
	})
  if err != nil {
    panic(err)
  }
}

If the Type property is not set, it defaults to TypeAny

For custom parsing of error, you can do a type assertion on the error interface to ValidateEnvironmentErrors and retrieve the error keys/types using the .Errors property:

func main() {
  err := devops.ValidateEnvironment(ValidateEnvironmentOpts{
    Keys: EnvironmentKeys{
			{Name: "STRING", Type: TypeString},
			{Name: "INT", Type: TypeInt},
			{Name: "UINT", Type: TypeUint},
			{Name: "FLOAT", Type: TypeFloat},
			{Name: "BOOL", Type: TypeBool},
			{Name: "ANY", Type: TypeAny},
    },
  })
  if err != nil {
    errs, _ := err.(devops.ValidateEnvironmentErrors)
    for _, errInstance := range errs.Errors {
      fmt.Printf(
        "key[%s] errored (expected type: %s, observed value: %s)",
        errInstance.Key,
        errInstance.ExpectedType,
        errInstance.Value,
      )
    }
  }
}
Validating project type

The .IsProjectType method allows you to test if a provided directory contains a project of the specified type.

A full example follows which tests for a Go project:

func main() {
  yes, err := devops.IsProjectType("./path/to/dir", devops.TypeGo)
  if err != nil {
    panic(err)
  }
  fmt.Printf("directory contains a go project: %v", yes)
}
Implementation notes for project type validation
  • Determination of project type is by detecting the presence of signature files commonly present in projects of that type

Security

Generating an SSH keypair

To generate an SSH keypair, you can use the .NewSSHKeypair function.

func main() {
  keypair, err := NewSSHKeypair(NewSSHKeypairOpts{
    Bytes: 4096,
  })
  if err != nil {
    panic(err)
  }
  // this prints the keys, you can write it to a file instead
  fmt.Printf("private key: %s\n", string(keypair.Private))
  fmt.Printf("public key : %s\n", string(keypair.Public))
}
Retrieving the SSH key fingerprint
func main() {
  keyPath := "./tests/sshkeys/id_rsa_1024.pub"
  fingerprint, err := devops.GetSshKeyFingerprint(devops.GetSshKeyFingerprintOpts{
    IsPublicKey: true,
    Path:        keyPath,
  })

  fmt.Printf("md5 hash   : %s\n", fingerprint.GetMD5())
  // above outputs 'aa:bb:cc:dd ...'

  fmt.Printf("sha256 hash: %s\n", fingerprint.GetSHA256())
  // above outputs 'sha256 hash: SHA256:AbCdEf ...'
}

To run this on a private key, set the IsPublicKey to false (or leave it unset) and set IsPrivateKey property to true.

To specify a password, set the Passphrase property of the GetSshKeyFingerprintOpts instance.

User interactions

Confirmation dialog

To trigger a confirmation dialog in the terminal with the user, use the .Confirm method.

A working example is available at ./cmd/confirm

func main() {
  yes, err := devops.Confirm(devops.ConfirmOpts{
    Question:   "exact match",
    MatchExact: "yes",
  })
  if err != nil {
    log.Fatalf("failed to get user input: %s", err)
  }
  log.Printf("user confirmed: %v\n", yes)
}

Changelog

Version Changes
v0.2.6 Refined issue with NewCommand that prevented it from dumping the derived path when exec.LookPath failed
v0.2.5 Fixed issue with NewCommand that prevented it from dumping the derived path when exec.LookPath failed
v0.2.4 Added .IsProjectType
v0.2.3 Added .SendHTTPRequest, improved inline documentation
v0.2.2 Added .NewSSHKeypair
v0.2.1 Fixed issues coming from gosec
v0.2.0 Updated error return of .LoadConfiguration to return LoadConfigurationErrors instead so that all errors can be made known at once
v0.1.0 Removed .LoadEnvironment and added .LoadConfiguration which is a better and cleaner way of doing things
v0.0.13 Formatting fixes
v0.0.12 Added .LoadEnvironment
v0.0.11 Renamed module for being able to import it via its Gitlab URL
v0.0.10 Added .ValidateConnection
v0.0.9 Added .ValidateApplications
v0.0.8 Added .DownloadFile
v0.0.7 Added custom error parsing for .ValidateEnvironment
v0.0.6 Added .ValidateEnvironment
v0.0.5 Added .Confirm
v0.0.4 Added inline code comments for documentation
v0.0.3 Added .GetSshKeyFingerprint. Also started changelog

License

Code is licensed under the MIT license. See full license here.

Documentation

Index

Constants

View Source
const (
	ZeroValueBool    = false
	ZeroValueString  = ""
	ZeroValueFloat32 = float32(0)
	ZeroValueFloat64 = float64(0)
	ZeroValueInt     = int(0)
	ZeroValueInt64   = int64(0)
	ZeroValueUint    = uint(0)
	ZeroValueUint64  = uint64(0)
)
View Source
const (
	DefaultStringSliceDelimiter        = ","
	ErrorLoadConfigurationPrereqs      = 1 << iota
	ErrorLoadConfigurationNotFound     = 1 << iota
	ErrorLoadConfigurationInvalidType  = 1 << iota
	ErrorLoadConfigurationInvalidValue = 1 << iota
)
View Source
const (
	DefaultConfirmInputHint = " (only '%s' will be accepted) "
)
View Source
const (
	DefaultSSHKeyLength = 8192
)
View Source
const (
	DefaultTimeout = 3 * time.Second
)

Variables

This section is empty.

Functions

func Confirm

func Confirm(opts ConfirmOpts) (bool, error)

Confirm performs a user-terminal-input based confirmation. This can be used in situations where it could be useful for a user to manually verify a string such as a command to be run

func DownloadFile

func DownloadFile(opts DownloadFileOpts) (err error)

DownloadFile downloads a file as directed by the configuration set in the options object `opts`

func IsProjectType added in v0.2.4

func IsProjectType(pathToDirectory string, projectType ProjectType) (bool, error)

func LoadConfiguration added in v0.1.0

func LoadConfiguration(config interface{}) error

func NormalizeLocalPath

func NormalizeLocalPath(userInputPath string) (string, error)

func SendHTTPRequest added in v0.2.3

func SendHTTPRequest(opts SendHTTPRequestOpts) (*http.Response, error)

SendHTTPRequest performs a HTTP request as configured by the provided options object instance `opts`.

func ValidateApplications

func ValidateApplications(opts ValidateApplicationsOpts) error

func ValidateConnection

func ValidateConnection(opts ValidateConnectionOpts) (bool, error)

func ValidateEnvironment

func ValidateEnvironment(opts ValidateEnvironmentOpts) error

Types

type BasicAuth added in v0.2.3

type BasicAuth struct {
	// Username represents the username section of
	// the credential
	Username string

	// Password represents the password section of
	// the credential
	Password string
}

BasicAuth provides credentials for basic access authentication

Reference link: https://en.wikipedia.org/wiki/Basic_access_authentication

type Command

type Command interface {
	// Bytes returns the full terminal invocation represented
	// by this instance of a Command as a slice of bytes
	Bytes() []byte

	// GetEnvironment returns a key-value dictionary of
	// environment variables to be injected into the process
	// created via the invocation this Command represents
	GetEnvironment() map[string]string

	// GetStderr returns the output to the stderr stream
	// (only available after the Command has completed its
	// execution)
	GetStderr() []byte

	// GetStdout returns the output to the stdout stream
	// (only available after the Command has completed its
	// execution)
	GetStdout() []byte

	// Run triggers the invocation represented by this
	// Command instance
	Run() error

	// String returns the full terminal invocation represented
	// by this instance of a Command as a string
	String() string
}

Command interface defines a command object's methods

func NewCommand

func NewCommand(opts NewCommandOpts) (Command, error)

NewCommand initialises a new Command interface and returns it

type CommandFlagset

type CommandFlagset struct {
	// HideStdout indicates whether STDOUT should be printed to the terminal
	HideStdout bool

	// HideStderr indicates whether STDERR should be printed to the terminal
	HideStderr bool

	// UseGlobalEnvironment indicates whether the child process should
	// inherit the parent's environment
	UseGlobalEnvironment bool

	// UseTTY enables use of STDIN
	UseTTY bool
}

CommandFlagSet defines a set of boolean configuration flags for the Command class

type ConfirmOpts

type ConfirmOpts struct {
	// Question can optionally be specified for the .Confirm method to
	// print a string before requesting for confirmation. A space will
	// be added at the end of the provided .Question before the
	// string defined in .InputHint is added
	Question string

	// Input defines the input stream to read the input from
	//
	// Defaults to os.Stdin if not specified
	Input io.Reader

	// InputHint is a format string containing a single %s denoting
	// a string that needs to be matched for the confirmation to succeed.
	// Example. " (enter '%s' to continue)", the .Confirm method will
	// populate the %s with the correct matcher value based on
	// .MatchExact or .MatchRegexp
	//
	// Defaults to DefaultConfirmInputHint if not specified
	InputHint string

	// MatchExact defines an exact string match for the confirmation
	// to succeed.
	//
	// When this is defined, MatchRegexp CANNOT be defined
	MatchExact string

	// MatchRegexp defines a regular expression match for the
	// confirmation to succeed.
	//
	// When this is defined, MatchExact CANNOT be defined
	MatchRegexp *regexp.Regexp

	// Output defines the output stream to write output to
	//
	// Defaults to os.Stdin if not specified
	Output io.Writer
}

func (*ConfirmOpts) SetDefaults

func (o *ConfirmOpts) SetDefaults()

SetDefaults checks for unspecified properties which have defaults and adds them

func (ConfirmOpts) Validate

func (o ConfirmOpts) Validate() error

Validate runs validation checks against the provided options

type ConnectionProtocol

type ConnectionProtocol string
const (
	ConnectionTCP             ConnectionProtocol = "tcp"
	ConnectionUDP             ConnectionProtocol = "udp"
	DefaultConnectionProtocol                    = ConnectionTCP
)

type DownloadFileOpts

type DownloadFileOpts struct {
	BasicAuth       *BasicAuth
	Client          *http.Client
	Headers         map[string][]string
	DestinationPath string
	Overwrite       bool
	URL             *url.URL
}

DownloadFileOpts presents configuration for the DownloadFile method

func (*DownloadFileOpts) SetDefaults

func (o *DownloadFileOpts) SetDefaults()

SetDefaults sets defaults for this object instance

func (DownloadFileOpts) Validate

func (o DownloadFileOpts) Validate() error

Validate verifies that this object instance is usable by the DownloadFile method

type EnvType

type EnvType string
const (
	TypeAny          EnvType = "any"
	TypeNil          EnvType = "nil"
	TypeString       EnvType = "string"
	TypeInt          EnvType = "int"
	TypeUint         EnvType = "uint"
	TypeFloat        EnvType = "float"
	TypeBool         EnvType = "bool"
	TypeErrorMissing EnvType = "__missing"
	TypeErrorUnknown EnvType = "__unknown"
)

type EnvironmentKey

type EnvironmentKey struct {
	Name string
	Type EnvType
}

type EnvironmentKeys

type EnvironmentKeys []EnvironmentKey

type GetSshKeyFingerprintOpts

type GetSshKeyFingerprintOpts struct {
	// IsPrivateKey if set to true indicates that we are
	// targetting a private key. If both this and .IsPublicKey
	// are not set, .IsPublicKey will be set to true
	IsPrivateKey bool

	// IsPublicKey if set to true indicates that we are
	// targetting a public key. If both this and .IsPrivateKey
	// are not set, .IsPublicKey will be set to true
	IsPublicKey bool

	// Passphrase defines a passphrase for the private key if
	// applicable
	Passphrase string

	// Path defines the file directory path to the key file
	// of interest
	Path string
}

GetSshKeyFingerprintOpts provides the configuration values for identifying the key whose fingerprint we want

func (*GetSshKeyFingerprintOpts) SetDefaults

func (o *GetSshKeyFingerprintOpts) SetDefaults()

SetDefaults sets defaults for this object instance

func (GetSshKeyFingerprintOpts) Validate

func (o GetSshKeyFingerprintOpts) Validate() error

Validate checks if this object instance has sufficient parameters to be used by GetSshKeyFingerprint

type InputHook

type InputHook struct {
	// On defines a byte matcher that when matched, should trigger a
	// write to the input stream using the byte sequence defined in
	// .Send
	On []byte

	// Send defines a sequence of bytes to send to the input when .On
	// is detected
	Send []byte
}

InputHook defines a structure for responding to a byte sequence of `.On` using the byte sequence .Send. Receiver and signaller is left to the controller to implement

type InputHooks

type InputHooks []InputHook

InputHooks is a convenience reference for a slice of InputHook instances

type LoadConfigurationError added in v0.1.0

type LoadConfigurationError struct {
	Code    int
	Message string
}

func (LoadConfigurationError) Error added in v0.1.0

func (e LoadConfigurationError) Error() string

type LoadConfigurationErrors added in v0.2.0

type LoadConfigurationErrors []LoadConfigurationError

func (LoadConfigurationErrors) Error added in v0.2.0

func (e LoadConfigurationErrors) Error() string

func (LoadConfigurationErrors) GetCode added in v0.2.0

func (e LoadConfigurationErrors) GetCode() int

func (LoadConfigurationErrors) GetMessage added in v0.2.0

func (e LoadConfigurationErrors) GetMessage() string

type NewCommandOpts

type NewCommandOpts struct {
	// Arguments lists the parameters to pass to the `.Command`
	Arguments []string

	// Command is an invocation that is in the $PATH OR a path to the
	// binary to execute (relative paths will be resolved to absolute)
	Command string

	// Environment is a mapping of key=value that will be injected into
	// the child process's environment. Use the `.Flag.UseGlobalEnvironment`
	// configuration flag to inject the parent environment into the child's
	Environment map[string]string

	// WorkingDir indicates the working directory of the child process.
	// If not an absolute path, this will be resolved to its absolute
	// one before the process begins
	WorkingDir string

	// StdoutHooks allows you to send a []byte data structure to STDIN
	// when receiving a predefined string from STDOUT. The `.Flag.UseTTY`
	// has to be enabled for this to work
	//
	// NOTE: If you have defined any `StdanyHooks`, those take execution
	// precedence
	StdoutHooks InputHooks

	// StderrHooks allows you to send a []byte data structure to STDIN
	// when receiving a predefined string from STDERR. The `.Flag.UseTTY`
	// has to be enabled for this to work
	//
	// NOTE: If you have defined any `StdanyHooks`, those take execution
	// precedence
	StderrHooks InputHooks

	// StdanyHooks allows you to send a []byte data structure to STDIN
	// when receiving a predefined string from both STDOUT and STDERR.
	// The `.Flag.UseTTY` has to be enabled for this to work
	//
	// NOTE: If you have defined any `StdoutHooks` or `StderrHooks` that
	// overlap with hooks defined in `StdanyHooks`, the hooks from
	// `StdanyHooks` will be executed first
	StdanyHooks InputHooks

	// Flag defines a boolean configuration flagset
	Flag CommandFlagset
}

NewCommandOpts defines a set of options for use with the `NewCommand()` intiializer method

func (NewCommandOpts) Validate

func (nco NewCommandOpts) Validate() error

Validate returns an error if a combination of the provided options will cause problems during execution or just plain invalid

type NewSSHKeypairOpts added in v0.2.2

type NewSSHKeypairOpts struct {
	Bytes    int
	Password string
}

func (*NewSSHKeypairOpts) SetDefaults added in v0.2.2

func (o *NewSSHKeypairOpts) SetDefaults()

func (NewSSHKeypairOpts) Validate added in v0.2.2

func (o NewSSHKeypairOpts) Validate() error

type ProjectType added in v0.2.4

type ProjectType string
const (
	TypeC          ProjectType = "c"
	TypeGo         ProjectType = "go"
	TypeHaskell    ProjectType = "hs"
	TypeJava       ProjectType = "java"
	TypeJavascript ProjectType = "js"
	TypePython     ProjectType = "py"
	TypeRuby       ProjectType = "rb"
	TypeRust       ProjectType = "rs"
	TypeTypescript ProjectType = "ts"
)

type SSHKeypair added in v0.2.2

type SSHKeypair struct {
	Private []byte
	Public  []byte
}

func NewSSHKeypair added in v0.2.2

func NewSSHKeypair(opts NewSSHKeypairOpts) (*SSHKeypair, error)

type SendHTTPRequestOpts added in v0.2.3

type SendHTTPRequestOpts struct {
	// BasicAuth defines user credentials for use with the
	// request similar to curl's --basic flag. If left nil,
	// basic auth will not be used
	BasicAuth *BasicAuth

	// Body defines the body data to be sent with the request.
	// If left nil, a request without a body will be sent
	Body []byte

	// Client defines the HTTP client to use. If left nil,
	// defaults to http.DefaultClient
	Client *http.Client

	// Headers defines the headers to be sent along with this
	// request. If left nil, no headers will be sent
	Headers map[string][]string

	// Method defines the HTTP method to make the request with
	Method string

	// URL defines the endpoint to call
	URL *url.URL
}

SendHTTPRequestOpts presents options for the SendHTTPRequest method

func (*SendHTTPRequestOpts) SetDefaults added in v0.2.3

func (o *SendHTTPRequestOpts) SetDefaults()

SetDefaults sets defaults for the options object instance

func (SendHTTPRequestOpts) Validate added in v0.2.3

func (o SendHTTPRequestOpts) Validate() error

Validate validates the options to check if this object instance is usable by SendHTTPRequest

type SshKeyFingerprint

type SshKeyFingerprint interface {
	// GetSHA256 returns a SHA256 fingerprint as a string
	// that looks like 'SHA256:aBcDeF ...'
	GetSHA256() string

	// GetMD5 returns a MD5 fingerprint (legacy) as a string
	// that looks like 'aa:bb:cc:dd ...'
	GetMD5() string
}

SshKeyFingerprint holds the key's fingerprint

func GetSshKeyFingerprint

func GetSshKeyFingerprint(opts GetSshKeyFingerprintOpts) (SshKeyFingerprint, error)

GetSshKeyFingerprint returns the fingerprints for the provided key as specified in the GetSshKeyFingerprintOpts parameter

type ValidateApplicationsErrors

type ValidateApplicationsErrors struct {
	Errors []string
}

func (ValidateApplicationsErrors) Error

func (ValidateApplicationsErrors) Len

func (*ValidateApplicationsErrors) Push

func (e *ValidateApplicationsErrors) Push(err string)

type ValidateApplicationsOpts

type ValidateApplicationsOpts struct {
	Paths []string
}

type ValidateConnectionOpts

type ValidateConnectionOpts struct {
	Hostname      string
	IsIpV6        bool
	Port          uint16
	Protocol      ConnectionProtocol
	RetryInterval time.Duration
	RetryLimit    uint
	Timeout       time.Duration
}

func (*ValidateConnectionOpts) SetDefaults

func (o *ValidateConnectionOpts) SetDefaults()

func (ValidateConnectionOpts) Validate

func (o ValidateConnectionOpts) Validate() error

type ValidateEnvironmentError

type ValidateEnvironmentError struct {
	Key          string
	ExpectedType EnvType
	Value        string
}

type ValidateEnvironmentErrors

type ValidateEnvironmentErrors struct {
	Errors []ValidateEnvironmentError
}

func (ValidateEnvironmentErrors) Error

func (ValidateEnvironmentErrors) Len

func (*ValidateEnvironmentErrors) Push

type ValidateEnvironmentOpts

type ValidateEnvironmentOpts struct {
	Keys EnvironmentKeys
}

func (*ValidateEnvironmentOpts) SetDefaults

func (o *ValidateEnvironmentOpts) SetDefaults()

Directories

Path Synopsis
cmd
security
gpg
Package gpg provides data structures and constants relevant to creation of a GPG key using batch mode.
Package gpg provides data structures and constants relevant to creation of a GPG key using batch mode.

Jump to

Keyboard shortcuts

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