config

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2021 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	GlobalFlags `mapstructure:",squash"`
	LocalFlags  `mapstructure:",squash"`
	FileConfig  *viper.Viper `mapstructure:"-" json:"-" yaml:"-" `
	// contains filtered or unexported fields
}

func New

func New() *Config

func (*Config) GetTargets

func (c *Config) GetTargets() (map[string]*TargetConfig, error)

func (*Config) Load

func (c *Config) Load() error

func (*Config) LogOutput

func (c *Config) LogOutput() io.Writer

func (*Config) SetLocalFlagsFromFile

func (c *Config) SetLocalFlagsFromFile(cmd *cobra.Command)

func (*Config) SetLogger

func (c *Config) SetLogger()

func (*Config) SetPersistantFlagsFromFile

func (c *Config) SetPersistantFlagsFromFile(cmd *cobra.Command)

type GlobalFlags

type GlobalFlags struct {
	CfgFile       string
	Address       []string      `mapstructure:"address,omitempty" json:"address,omitempty" yaml:"address,omitempty"`
	Username      string        `mapstructure:"username,omitempty" json:"username,omitempty" yaml:"username,omitempty"`
	Password      string        `mapstructure:"password,omitempty" json:"password,omitempty" yaml:"password,omitempty"`
	Port          string        `mapstructure:"port,omitempty" json:"port,omitempty" yaml:"port,omitempty"`
	Encoding      string        `mapstructure:"encoding,omitempty" json:"encoding,omitempty" yaml:"encoding,omitempty"`
	Insecure      bool          `mapstructure:"insecure,omitempty" json:"insecure,omitempty" yaml:"insecure,omitempty"`
	TLSCa         string        `mapstructure:"tls-ca,omitempty" json:"tls-ca,omitempty" yaml:"tls-ca,omitempty"`
	TLSCert       string        `mapstructure:"tls-cert,omitempty" json:"tls-cert,omitempty" yaml:"tls-cert,omitempty"`
	TLSKey        string        `mapstructure:"tls-key,omitempty" json:"tls-key,omitempty" yaml:"tls-key,omitempty"`
	TLSMinVersion string        `mapstructure:"tls-min-version,omitempty" json:"tls-min-version,omitempty" yaml:"tls-min-version,omitempty"`
	TLSMaxVersion string        `mapstructure:"tls-max-version,omitempty" json:"tls-max-version,omitempty" yaml:"tls-max-version,omitempty"`
	TLSVersion    string        `mapstructure:"tls-version,omitempty" json:"tls-version,omitempty" yaml:"tls-version,omitempty"`
	Timeout       time.Duration `mapstructure:"timeout,omitempty" json:"timeout,omitempty" yaml:"timeout,omitempty"`
	Debug         bool          `mapstructure:"debug,omitempty" json:"debug,omitempty" yaml:"debug,omitempty"`
	SkipVerify    bool          `mapstructure:"skip-verify,omitempty" json:"skip-verify,omitempty" yaml:"skip-verify,omitempty"`
	ProxyFromEnv  bool          `mapstructure:"proxy-from-env,omitempty" json:"proxy-from-env,omitempty" yaml:"proxy-from-env,omitempty"`
	PrintRequest  bool          `mapstructure:"print-request,omitempty" json:"print-request,omitempty" yaml:"print-request,omitempty"`
	Gzip          bool          `mapstructure:"gzip,omitempty" json:"gzip,omitempty" yaml:"gzip,omitempty"`
	Format        string        `mapstructure:"format,omitempty" json:"format,omitempty" yaml:"format,omitempty"`
}

type LocalFlags

type LocalFlags struct {
	// tree
	TreeFlat    bool `json:"tree-flat,omitempty" mapstructure:"tree-flat,omitempty" yaml:"tree-flat,omitempty"`
	TreeDetails bool `json:"tree-details,omitempty" mapstructure:"tree-details,omitempty" yaml:"tree-details,omitempty"`
	// Cert
	CertCACert string `json:"cert-ca-cert,omitempty" mapstructure:"cert-ca-cert,omitempty" yaml:"cert-ca-cert,omitempty"`
	CertCAKey  string `json:"cert-ca-key,omitempty" mapstructure:"cert-ca-key,omitempty" yaml:"cert-ca-key,omitempty"`
	// Cert CreateCA
	CertCreateCaOrg           string        `json:"cert-create-ca-org,omitempty" mapstructure:"cert-create-ca-org,omitempty" yaml:"cert-create-ca-org,omitempty"`
	CertCreateCaOrgUnit       string        `` /* 130-byte string literal not displayed */
	CertCreateCaCountry       string        `` /* 127-byte string literal not displayed */
	CertCreateCaState         string        `json:"cert-create-ca-state,omitempty" mapstructure:"cert-create-ca-state,omitempty" yaml:"cert-create-ca-state,omitempty"`
	CertCreateCaLocality      string        `` /* 130-byte string literal not displayed */
	CertCreateCaStreetAddress string        `` /* 148-byte string literal not displayed */
	CertCreateCaPostalCode    string        `` /* 139-byte string literal not displayed */
	CertCreateCaValidity      time.Duration `` /* 130-byte string literal not displayed */
	CertCreateCaKeySize       int           `` /* 130-byte string literal not displayed */
	CertCreateCaEmailID       string        `` /* 130-byte string literal not displayed */
	CertCreateCaCommonName    string        `` /* 139-byte string literal not displayed */
	CertCreateCaKeyOut        string        `` /* 127-byte string literal not displayed */
	CertCreateCaCertOut       string        `` /* 130-byte string literal not displayed */
	// Cert Rotate
	CertRotateCertificateID   string        `` /* 139-byte string literal not displayed */
	CertRotateKeyType         string        `json:"cert-rotate-key-type,omitempty" mapstructure:"cert-rotate-key-type,omitempty" yaml:"cert-rotate-key-type,omitempty"`
	CertRotateCertificateType string        `` /* 145-byte string literal not displayed */
	CertRotateMinKeySize      uint32        `` /* 133-byte string literal not displayed */
	CertRotateCommonName      string        `` /* 130-byte string literal not displayed */
	CertRotateCountry         string        `json:"cert-rotate-country,omitempty" mapstructure:"cert-rotate-country,omitempty" yaml:"cert-rotate-country,omitempty"`
	CertRotateState           string        `json:"cert-rotate-state,omitempty" mapstructure:"cert-rotate-state,omitempty" yaml:"cert-rotate-state,omitempty"`
	CertRotateCity            string        `json:"cert-rotate-city,omitempty" mapstructure:"cert-rotate-city,omitempty" yaml:"cert-rotate-city,omitempty"`
	CertRotateOrg             string        `json:"cert-rotate-org,omitempty" mapstructure:"cert-rotate-org,omitempty" yaml:"cert-rotate-org,omitempty"`
	CertRotateOrgUnit         string        `json:"cert-rotate-org-unit,omitempty" mapstructure:"cert-rotate-org-unit,omitempty" yaml:"cert-rotate-org-unit,omitempty"`
	CertRotateIPAddress       string        `` /* 127-byte string literal not displayed */
	CertRotateEmailID         string        `json:"cert-rotate-email-id,omitempty" mapstructure:"cert-rotate-email-id,omitempty" yaml:"cert-rotate-email-id,omitempty"`
	CertRotateValidity        time.Duration `json:"cert-rotate-validity,omitempty" mapstructure:"cert-rotate-validity,omitempty" yaml:"cert-rotate-validity,omitempty"`
	CertRotatePrintCSR        bool          `json:"cert-rotate-print-csr,omitempty" mapstructure:"cert-rotate-print-csr,omitempty" yaml:"cert-rotate-print-csr,omitempty"`
	CertRotateGenCSR          bool          `json:"cert-rotate-gen-csr,omitempty" mapstructure:"cert-rotate-gen-csr,omitempty" yaml:"cert-rotate-gen-csr,omitempty"`
	// Cert Install
	CertInstallCertificateID   string        `` /* 142-byte string literal not displayed */
	CertInstallKeyType         string        `json:"cert-install-key-type,omitempty" mapstructure:"cert-install-key-type,omitempty" yaml:"cert-install-key-type,omitempty"`
	CertInstallCertificateType string        `` /* 148-byte string literal not displayed */
	CertInstallMinKeySize      uint32        `` /* 136-byte string literal not displayed */
	CertInstallCommonName      string        `` /* 133-byte string literal not displayed */
	CertInstallCountry         string        `json:"cert-install-country,omitempty" mapstructure:"cert-install-country,omitempty" yaml:"cert-install-country,omitempty"`
	CertInstallState           string        `json:"cert-install-state,omitempty" mapstructure:"cert-install-state,omitempty" yaml:"cert-install-state,omitempty"`
	CertInstallCity            string        `json:"cert-install-city,omitempty" mapstructure:"cert-install-city,omitempty" yaml:"cert-install-city,omitempty"`
	CertInstallOrg             string        `json:"cert-install-org,omitempty" mapstructure:"cert-install-org,omitempty" yaml:"cert-install-org,omitempty"`
	CertInstallOrgUnit         string        `json:"cert-install-org-unit,omitempty" mapstructure:"cert-install-org-unit,omitempty" yaml:"cert-install-org-unit,omitempty"`
	CertInstallIPAddress       string        `` /* 130-byte string literal not displayed */
	CertInstallEmailID         string        `json:"cert-install-email-id,omitempty" mapstructure:"cert-install-email-id,omitempty" yaml:"cert-install-email-id,omitempty"`
	CertInstallValidity        time.Duration `json:"cert-install-validity,omitempty" mapstructure:"cert-install-validity,omitempty" yaml:"cert-install-validity,omitempty"`
	CertInstallPrintCSR        bool          `` /* 127-byte string literal not displayed */
	CertInstallGenCSR          bool          `json:"cert-install-gen-csr,omitempty" mapstructure:"cert-install-gen-csr,omitempty" yaml:"cert-install-gen-csr,omitempty"`
	// Cert GenerateCSR
	CertGenerateCSRCertificateID   string `` /* 157-byte string literal not displayed */
	CertGenerateCSRKeyType         string `` /* 139-byte string literal not displayed */
	CertGenerateCSRCertificateType string `` /* 163-byte string literal not displayed */
	CertGenerateCSRMinKeySize      uint32 `` /* 151-byte string literal not displayed */
	CertGenerateCSRCommonName      string `` /* 148-byte string literal not displayed */
	CertGenerateCSRCountry         string `` /* 136-byte string literal not displayed */
	CertGenerateCSRState           string `` /* 130-byte string literal not displayed */
	CertGenerateCSRCity            string `` /* 127-byte string literal not displayed */
	CertGenerateCSROrg             string `json:"cert-generate-csr-org,omitempty" mapstructure:"cert-generate-csr-org,omitempty" yaml:"cert-generate-csr-org,omitempty"`
	CertGenerateCSROrgUnit         string `` /* 139-byte string literal not displayed */
	CertGenerateCSRIPAddress       string `` /* 145-byte string literal not displayed */
	CertGenerateCSREmailID         string `` /* 139-byte string literal not displayed */
	// Cert CanGenerateCSR
	CertCanGenerateCSRKeyType         string `` /* 151-byte string literal not displayed */
	CertCanGenerateCSRCertificateType string `` /* 175-byte string literal not displayed */
	CertCanGenerateCSRKeySize         uint32 `` /* 151-byte string literal not displayed */
	// Cert LoadCertificate
	CertLoadCertificateCertificateID   string   `` /* 169-byte string literal not displayed */
	CertLoadCertificateCertificateType string   `` /* 175-byte string literal not displayed */
	CertLoadCertificatePrivateKey      string   `` /* 160-byte string literal not displayed */
	CertLoadCertificatePublicKey       string   `` /* 157-byte string literal not displayed */
	CertLoadCertificateCaCertificates  []string `` /* 172-byte string literal not displayed */
	// Cert LoadCertificateCanBundle
	CertLoadCertificateCaBundleCaCertificates []string `` /* 202-byte string literal not displayed */
	// Cert RevokeCertificate
	CertRevokeCertificatesCertificateID []string `` /* 178-byte string literal not displayed */
	CertRevokeCertificatesAll           bool     `` /* 145-byte string literal not displayed */
	// Cert GetCertificates
	CertGetCertificatesDetails bool     `` /* 148-byte string literal not displayed */
	CertGetCertificatesID      []string `` /* 133-byte string literal not displayed */
	CertGetCertificatesSave    bool     `` /* 139-byte string literal not displayed */
	// File
	// File Get
	FileGetFile         []string `json:"file-get-file,omitempty" mapstructure:"file-get-file,omitempty" yaml:"file-get-file,omitempty"`
	FileGetDst          string   `json:"file-get-dst,omitempty" mapstructure:"file-get-dst,omitempty" yaml:"file-get-dst,omitempty"`
	FileGetTargetPrefix bool     `` /* 127-byte string literal not displayed */
	// File Stat
	FileStatPath      []string `json:"file-stat-path,omitempty" mapstructure:"file-stat-path,omitempty" yaml:"file-stat-path,omitempty"`
	FileStatHumanize  bool     `json:"file-stat-humanize,omitempty" mapstructure:"file-stat-humanize,omitempty" yaml:"file-stat-humanize,omitempty"`
	FileStatRecursive bool     `json:"file-stat-recursive,omitempty" mapstructure:"file-stat-recursive,omitempty" yaml:"file-stat-recursive,omitempty"`
	// File Put
	FilePutFile        []string `json:"file-put-file,omitempty" mapstructure:"file-put-file,omitempty" yaml:"file-put-file,omitempty"`
	FilePutDst         string   `json:"file-put-dst,omitempty" mapstructure:"file-put-dst,omitempty" yaml:"file-put-dst,omitempty"`
	FilePutPermissions uint32   `json:"file-put-permissions,omitempty" mapstructure:"file-put-permissions,omitempty" yaml:"file-put-permissions,omitempty"`
	FilePutChunkSize   uint64   `json:"file-put-chunk-size,omitempty" mapstructure:"file-put-chunk-size,omitempty" yaml:"file-put-chunk-size,omitempty"`
	FilePutHashMethod  string   `json:"file-put-hash-method,omitempty" mapstructure:"file-put-hash-method,omitempty" yaml:"file-put-hash-method,omitempty"`
	// File Remove
	FileRemovePath []string `json:"file-remove-path,omitempty" mapstructure:"file-remove-path,omitempty" yaml:"file-remove-path,omitempty"`
	// System
	// System Ping
	SystemPingDestination   string        `` /* 130-byte string literal not displayed */
	SystemPingSource        string        `json:"system-ping-source,omitempty" mapstructure:"system-ping-source,omitempty" yaml:"system-ping-source,omitempty"`
	SystemPingCount         int32         `json:"system-ping-count,omitempty" mapstructure:"system-ping-count,omitempty" yaml:"system-ping-count,omitempty"`
	SystemPingInterval      time.Duration `json:"system-ping-interval,omitempty" mapstructure:"system-ping-interval,omitempty" yaml:"system-ping-interval,omitempty"`
	SystemPingWait          time.Duration `json:"system-ping-wait,omitempty" mapstructure:"system-ping-wait,omitempty" yaml:"system-ping-wait,omitempty"`
	SystemPingSize          int32         `json:"system-ping-size,omitempty" mapstructure:"system-ping-size,omitempty" yaml:"system-ping-size,omitempty"`
	SystemPingDoNotFragment bool          `` /* 142-byte string literal not displayed */
	SystemPingDoNotResolve  bool          `` /* 139-byte string literal not displayed */
	SystemPingProtocol      string        `json:"system-ping-protocol,omitempty" mapstructure:"system-ping-protocol,omitempty" yaml:"system-ping-protocol,omitempty"`
	// System Traceroute
	SystemTracerouteDestination   string        `` /* 148-byte string literal not displayed */
	SystemTracerouteSource        string        `` /* 133-byte string literal not displayed */
	SystemTracerouteInterval      time.Duration `` /* 139-byte string literal not displayed */
	SystemTracerouteWait          time.Duration `` /* 127-byte string literal not displayed */
	SystemTracerouteInitialTTL    uint32        `` /* 148-byte string literal not displayed */
	SystemTracerouteMaxTTL        int32         `` /* 136-byte string literal not displayed */
	SystemTracerouteSize          int32         `` /* 127-byte string literal not displayed */
	SystemTracerouteDoNotFragment bool          `` /* 160-byte string literal not displayed */
	SystemTracerouteDoNotResolve  bool          `` /* 157-byte string literal not displayed */
	SystemTracerouteL3Protocol    string        `` /* 151-byte string literal not displayed */
	SystemTracerouteL4Protocol    string        `` /* 151-byte string literal not displayed */
	// System Reboot
	SystemRebootMethod         string        `json:"system-reboot-method,omitempty" mapstructure:"system-reboot-method,omitempty" yaml:"system-reboot-method,omitempty"`
	SystemRebootDelay          time.Duration `json:"system-reboot-delay,omitempty" mapstructure:"system-reboot-delay,omitempty" yaml:"system-reboot-delay,omitempty"`
	SystemRebootMessage        string        `json:"system-reboot-message,omitempty" mapstructure:"system-reboot-message,omitempty" yaml:"system-reboot-message,omitempty"`
	SystemRebootSubscomponents []string      `` /* 145-byte string literal not displayed */
	SystemRebootForce          bool          `json:"system-reboot-force,omitempty" mapstructure:"system-reboot-force,omitempty" yaml:"system-reboot-force,omitempty"`
	// System RebootStatus
	SystemRebootStatusSubscomponents []string `` /* 166-byte string literal not displayed */
	// System CancelReboot
	SystemCancelRebootMessage       string   `` /* 145-byte string literal not displayed */
	SystemCancelRebootSubcomponents []string `` /* 163-byte string literal not displayed */
	// System SwitchControlProcessor
	SystemSwitchControlProcessorPath string `` /* 169-byte string literal not displayed */
	// System SetPackage
	SystemSetPackageFile        string `` /* 130-byte string literal not displayed */
	SystemSetPackageVersion     string `` /* 139-byte string literal not displayed */
	SystemSetPackageActivate    bool   `` /* 142-byte string literal not displayed */
	SystemSetPackageRemoteFile  string `` /* 151-byte string literal not displayed */
	SystemSetPackageCredentials string `` /* 151-byte string literal not displayed */
	SystemSetPackageChunkSize   uint64 `` /* 148-byte string literal not displayed */

	// System UpfRestart
	SystemRestartUpfgNBMacAddr string `` /* 154-byte string literal not displayed */
	SystemRestartUpfDNMacAddr  string `` /* 151-byte string literal not displayed */
}

type TargetConfig

type TargetConfig struct {
	Name          string        `json:"name,omitempty" mapstructure:"name,omitempty"`
	Address       string        `json:"address,omitempty" mapstructure:"address,omitempty"`
	Insecure      *bool         `json:"insecure,omitempty" mapstructure:"insecure,omitempty"`
	SkipVerify    *bool         `json:"skip-verify,omitempty" mapstructure:"skip-verify,omitempty"`
	Username      *string       `json:"username,omitempty" mapstructure:"username,omitempty"`
	Password      *string       `json:"password,omitempty" mapstructure:"password,omitempty"`
	Timeout       time.Duration `json:"timeout,omitempty" mapstructure:"timeout,omitempty"`
	TLSCert       *string       `json:"tls-cert,omitempty" mapstructure:"tls-cert,omitempty"`
	TLSKey        *string       `json:"tls-key,omitempty" mapstructure:"tls-key,omitempty"`
	TLSCA         *string       `json:"tlsca,omitempty" mapstructure:"tlsca,omitempty"`
	TLSMinVersion string        `json:"tls-min-version,omitempty" mapstructure:"tls-min-version,omitempty"`
	TLSMaxVersion string        `json:"tls-max-version,omitempty" mapstructure:"tls-max-version,omitempty"`
	TLSVersion    string        `json:"tls-version,omitempty" mapstructure:"tls-version,omitempty"`
	Gzip          *bool         `json:"gzip,omitempty" mapstructure:"gzip,omitempty"`
	//
	CommonName string `json:"common-name,omitempty"`
	ResolvedIP string `json:"resolved-ip,omitempty"`
}

func (*TargetConfig) DialOpts

func (tc *TargetConfig) DialOpts() ([]grpc.DialOption, error)

func (*TargetConfig) String

func (tc *TargetConfig) String() string

Jump to

Keyboard shortcuts

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