cli

package
v0.26.2 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2024 License: Apache-2.0 Imports: 37 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DiffAndConfirm

func DiffAndConfirm(from, dest proto.Message, force bool) (bool, error)

func ExpandConfigPath

func ExpandConfigPath() string

func FileToProto

func FileToProto[T proto.Message](file string) (protoMsg T, loaded bool, err error)

func Fqdn added in v0.3.0

func Fqdn(s string) string

Fqdn return the fully qualified domain name from s. If s is already fully qualified, it behaves as the identity function.

func IsFqdn added in v0.3.0

func IsFqdn(s string) bool

IsFqdn checks if a domain name is fully qualified.

func MakePayloadFromString

func MakePayloadFromString(txt string) (*hcconf.HealthCheckPayload, error)

func MakeTableWriter

func MakeTableWriter(headers []string, writers ...io.Writer) *tablewriter.Table

func NameFromAny

func NameFromAny(anyMsg *anypb.Any) string

func PrintProtoDiff

func PrintProtoDiff(from, dest proto.Message) error

func PrintProtoHuman

func PrintProtoHuman(pMsg proto.Message) error

func PrintProtoJson

func PrintProtoJson(pMsg proto.Message) error

func PrintProtoListJson

func PrintProtoListJson[T proto.Message](msgs []T) error

func ProtoDiffContent

func ProtoDiffContent(from, dest proto.Message) (string, error)

func ProtoDiffReport

func ProtoDiffReport(from, dest proto.Message) (dyff.Report, error)

func ProtoToYaml

func ProtoToYaml(pMsg proto.Message) ([]byte, error)

func Start

func Start(version, commit, date string) (err error)

Types

type DeleteEntry

type DeleteEntry struct {
	FQDN *FQDN `positional-args:"true" positional-arg-name:"'fqdn'" required:"true"`
	// contains filtered or unexported fields
}

func (*DeleteEntry) Execute

func (c *DeleteEntry) Execute([]string) error

func (*DeleteEntry) SetClient

func (c *DeleteEntry) SetClient(client gslbsvc.GSLBClient)

type DeleteMember

type DeleteMember struct {
	FQDN *FQDN  `positional-args:"true" positional-arg-name:"'fqdn'" required:"true"`
	Ip   string `short:"i" long:"ip" description:"IP of the member to delete." required:"true"`
	// contains filtered or unexported fields
}

func (*DeleteMember) Execute

func (c *DeleteMember) Execute([]string) error

func (*DeleteMember) SetClient

func (c *DeleteMember) SetClient(client gslbsvc.GSLBClient)

type FQDN

type FQDN struct {
	// contains filtered or unexported fields
}

func (*FQDN) Complete

func (n *FQDN) Complete(match string) []flags.Completion

func (*FQDN) String

func (n *FQDN) String() string

func (*FQDN) UnmarshalFlag

func (n *FQDN) UnmarshalFlag(value string) error

type GetEntry

type GetEntry struct {
	FQDN *FQDN `positional-args:"true" positional-arg-name:"'fqdn'" required:"true"`
	Json bool  `short:"j" long:"json" description:"Format in json instead of human table readable."`
	// contains filtered or unexported fields
}

func (*GetEntry) Execute

func (c *GetEntry) Execute([]string) error

func (*GetEntry) SetClient

func (c *GetEntry) SetClient(client gslbsvc.GSLBClient)

type GetEntryStatus

type GetEntryStatus struct {
	FQDN *FQDN `positional-args:"true" positional-arg-name:"'fqdn'" required:"true"`
	Json bool  `short:"j" long:"json" description:"Format in json instead of human table readable."`
	// contains filtered or unexported fields
}

func (*GetEntryStatus) Execute

func (c *GetEntryStatus) Execute([]string) error

func (*GetEntryStatus) SetClient

func (c *GetEntryStatus) SetClient(client gslbsvc.GSLBClient)

type GetHealthcheck

type GetHealthcheck struct {
	FQDN *FQDN `positional-args:"true" positional-arg-name:"'fqdn'" required:"true"`
	Json bool  `short:"j" long:"json" description:"Format in json instead of human table readable."`
	// contains filtered or unexported fields
}

func (*GetHealthcheck) Execute

func (c *GetHealthcheck) Execute([]string) error

func (*GetHealthcheck) SetClient

func (c *GetHealthcheck) SetClient(client gslbsvc.GSLBClient)

type GetMember

type GetMember struct {
	FQDN *FQDN  `positional-args:"true" positional-arg-name:"'fqdn'" required:"true"`
	Json bool   `short:"j" long:"json" description:"Format in json instead of human table readable."`
	Ip   string `short:"i" long:"ip" description:"IP of the member to get." required:"true"`
	// contains filtered or unexported fields
}

func (*GetMember) Execute

func (c *GetMember) Execute([]string) error

func (*GetMember) SetClient

func (c *GetMember) SetClient(client gslbsvc.GSLBClient)

type Hook

type Hook struct {
	Completion string `short:"c" long:"completion" description:"Give your shell name (zsh or bash) for adding automatic completion"`
}

func (*Hook) Execute

func (c *Hook) Execute(args []string) error

func (*Hook) IsDirectCommand

func (c *Hook) IsDirectCommand() bool

func (*Hook) NoCheckUpdate

func (c *Hook) NoCheckUpdate() bool

type ListDcs

type ListDcs struct {
	Json bool `short:"j" long:"json" description:"Format in json instead of human table readable."`
	// contains filtered or unexported fields
}

func (*ListDcs) Execute

func (c *ListDcs) Execute([]string) error

func (*ListDcs) SetClient

func (c *ListDcs) SetClient(client gslbsvc.GSLBClient)

type ListEntries

type ListEntries struct {
	Json bool `short:"j" long:"json" description:"Format in json instead of human table readable."`

	Tags   []string `short:"t" long:"tag" description:"Filter by tag(s) (can be set multiple times)."`
	Prefix string   `short:"p" long:"prefix" description:"Filter by prefix."`
	// contains filtered or unexported fields
}

func (*ListEntries) Execute

func (c *ListEntries) Execute([]string) error

func (*ListEntries) SetClient

func (c *ListEntries) SetClient(client gslbsvc.GSLBClient)

type ListEntriesStatus

type ListEntriesStatus struct {
	Json bool `short:"j" long:"json" description:"Format in json instead of human table readable."`

	Tags   []string `short:"t" long:"tag" description:"Filter by tag(s) (can be set multiple times)."`
	Prefix string   `short:"p" long:"prefix" description:"Filter by prefix."`
	// contains filtered or unexported fields
}

func (*ListEntriesStatus) Execute

func (c *ListEntriesStatus) Execute([]string) error

func (*ListEntriesStatus) SetClient

func (c *ListEntriesStatus) SetClient(client gslbsvc.GSLBClient)

type ListMembers

type ListMembers struct {
	FQDN *FQDN `positional-args:"true" positional-arg-name:"'fqdn'" required:"true"`
	Json bool  `short:"j" long:"json" description:"Format in json instead of human table readable."`
	// contains filtered or unexported fields
}

func (*ListMembers) Execute

func (c *ListMembers) Execute([]string) error

func (*ListMembers) SetClient

func (c *ListMembers) SetClient(client gslbsvc.GSLBClient)

type ListPlugins added in v0.13.0

type ListPlugins struct {
	Json bool `short:"j" long:"json" description:"Format in json instead of human table readable."`
	// contains filtered or unexported fields
}

func (*ListPlugins) Execute added in v0.13.0

func (c *ListPlugins) Execute([]string) error

func (*ListPlugins) SetClient added in v0.13.0

func (c *ListPlugins) SetClient(client gslbsvc.GSLBClient)

type LoginUser

type LoginUser struct {
	Host              string `short:"t" long:"host" description:"Host of gsloc" env:"GSLOC_HOST"`
	Username          string `short:"u" long:"username" description:"Username" env:"GSLOC_USERNAME"`
	Password          string `short:"p" long:"password" description:"Password" env:"GSLOC_PASSWORD"`
	SkipSslValidation bool   `short:"k" long:"skip-ssl-validation" description:"Skip SSL validation"`
}

func (*LoginUser) Execute

func (c *LoginUser) Execute([]string) error

type MemberMap

type MemberMap struct {
	Ip       string `mapstructure:"ip"`
	Ratio    int    `mapstructure:"ratio"`
	DC       string `mapstructure:"dc"`
	Disabled bool   `mapstructure:"disabled"`
}

type Options

type Options struct {
	ConfigPath string `short:"c" long:"config" description:"Path to config file" default:"~/.gsloc/config.json" env:"GSLOC_CONFIG_PATH"`
	Version    func() `          long:"version" description:"Show version"`
}

type SetClient

type SetClient interface {
	SetClient(client gslbsvc.GSLBClient)
}

type SetEntry

type SetEntry struct {
	File flags.Filename `short:"f" long:"file" description:"Path to a json or yml file definition of entry" required:"true" default:"entry.yml"`

	FQDN              *FQDN    `positional-args:"true" positional-arg-name:"'fqdn'" required:"true"`
	LBAlgoPreferred   string   `` /* 158-byte string literal not displayed */
	LBAlgoAlternate   string   `` /* 158-byte string literal not displayed */
	LBAlgoFallback    string   `` /* 156-byte string literal not displayed */
	MaxAnswerReturned uint32   `short:"m" long:"max-answer-returned" description:"Max answer returned" default:"0"`
	TTL               uint32   `long:"ttl" description:"TTL" default:"30"`
	Tags              []string `short:"T" long:"tag" description:"Tag (can be set multiple time)"`

	HcTimeout       string         `short:"o" long:"hc-timeout" description:"Healthcheck timeout" default:"10s"`
	HcInterval      string         `short:"i" long:"hc-interval" description:"Healthcheck interval" default:"30s"`
	HcPort          uint32         `short:"P" long:"hc-port" description:"Healthcheck port" default:"80"`
	HcType          string         `` /* 188-byte string literal not displayed */
	HcEnableTls     bool           `long:"hc-enable-tls" description:"Enable tls during healthcheck"`
	HcTlsServerName string         `long:"hc-tls-server-name" description:"Set TLS server name during healthcheck (default: fqdn without trailing dot)"`
	HcTlsCa         flags.Filename `long:"hc-tls-ca" description:"Set TLS CA during healthcheck, this must be a file path"`

	HttpHost            string            `short:"H" long:"http-host" description:"HTTP healthcheck host"`
	HttpPath            string            `long:"http-path" description:"HTTP healthcheck path"`
	HttpCode            int               `short:"C" long:"http-code" description:"HTTP healthcheck code"`
	HttpCodeRange       string            `long:"http-code-range" description:"HTTP healthcheck range code (e.g.: 200-299)"`
	HttpSendPayload     string            `short:"S" long:"http-send-payload" description:"HTTP healthcheck send payload, start with @ to read from file path"`
	HttpReceivePayload  string            `short:"R" long:"http-receive-payload" description:"HTTP healthcheck receive payload, start with @ to read from file path"`
	HttpHeaders         map[string]string `short:"d" long:"http-headers" description:"HTTP healthcheck header (e.g.: 'X-Header:foo,X-Header2:bar')"`
	HttpMethod          string            `` /* 197-byte string literal not displayed */
	HttpCodecClientType string            `` /* 147-byte string literal not displayed */

	TcpSendPayload     string   `long:"tcp-send-payload" description:"TCP healthcheck send payload, start with @ to read from file path"`
	TcpReceivePayloads []string `` /* 138-byte string literal not displayed */

	GRPCServiceName string `long:"grpc-service-name" description:"gRPC healthcheck service name"`
	GRPCAuthority   string `long:"grpc-authority" description:"gRPC healthcheck authority"`

	IcmpDelay string `long:"icmp-delay" description:"ICMP healthcheck delay" default:"1s"`

	UdpSendPayload     string   `long:"udp-send-payload" description:"UDP healthcheck send payload, start with @ to read from file path"`
	UdpReceivePayloads []string `` /* 138-byte string literal not displayed */
	UdpDelay           string   `long:"udp-delay" description:"UDP healthcheck delay" default:"1s"`
	UdpPingTimeout     string   `long:"udp-ping-timeout" description:"UDP healthcheck ping timeout" default:"5s"`

	PluginName     string         `long:"plugin-name" description:"Plugin healthcheck name"`
	PluginJsonOpts flags.Filename `long:"plugin-opts" description:"Plugin healthcheck options targeting a file json format"`

	Strategy string `` /* 174-byte string literal not displayed */

	Force bool `long:"force" description:"Force create entry without confirmation"`
	// contains filtered or unexported fields
}

func (*SetEntry) Execute

func (c *SetEntry) Execute([]string) error

func (*SetEntry) SetClient

func (c *SetEntry) SetClient(client gslbsvc.GSLBClient)

type SetHealthcheck

type SetHealthcheck struct {
	FQDN            *FQDN          `positional-args:"true" positional-arg-name:"'fqdn'" required:"true"`
	HcTimeout       string         `short:"o" long:"hc-timeout" description:"Healthcheck timeout" default:"10s"`
	HcInterval      string         `short:"i" long:"hc-interval" description:"Healthcheck interval" default:"30s"`
	HcPort          uint32         `short:"P" long:"hc-port" description:"Healthcheck port" default:"80"`
	HcType          string         `` /* 188-byte string literal not displayed */
	HcEnableTls     bool           `long:"hc-enable-tls" description:"Enable tls during healthcheck"`
	HcTlsServerName string         `long:"hc-tls-server-name" description:"Set TLS server name during healthcheck (default: fqdn without trailing dot)"`
	HcTlsCa         flags.Filename `long:"hc-tls-ca" description:"Set TLS CA during healthcheck, this must be a file path"`

	HttpHost            string            `short:"H" long:"http-host" description:"HTTP healthcheck host"`
	HttpPath            string            `long:"http-path" description:"HTTP healthcheck path"`
	HttpCode            int               `short:"C" long:"http-code" description:"HTTP healthcheck code"`
	HttpCodeRange       string            `long:"http-code-range" description:"HTTP healthcheck range code (e.g.: 200-299)"`
	HttpSendPayload     string            `short:"S" long:"http-send-payload" description:"HTTP healthcheck send payload, start with @ to read from file path"`
	HttpReceivePayload  string            `short:"R" long:"http-receive-payload" description:"HTTP healthcheck receive payload, start with @ to read from file path"`
	HttpHeaders         map[string]string `short:"d" long:"http-headers" description:"HTTP healthcheck header (e.g.: 'X-Header:foo,X-Header2:bar')"`
	HttpMethod          string            `` /* 197-byte string literal not displayed */
	HttpCodecClientType string            `` /* 147-byte string literal not displayed */

	TcpSendPayload     string   `long:"tcp-send-payload" description:"TCP healthcheck send payload, start with @ to read from file path"`
	TcpReceivePayloads []string `` /* 138-byte string literal not displayed */

	GRPCServiceName string `long:"grpc-service-name" description:"gRPC healthcheck service name"`
	GRPCAuthority   string `long:"grpc-authority" description:"gRPC healthcheck authority"`

	IcmpDelay string `long:"icmp-delay" description:"ICMP healthcheck delay" default:"1s"`

	UdpSendPayload     string   `long:"udp-send-payload" description:"UDP healthcheck send payload, start with @ to read from file path"`
	UdpReceivePayloads []string `` /* 138-byte string literal not displayed */
	UdpDelay           string   `long:"udp-delay" description:"UDP healthcheck delay" default:"1s"`
	UdpPingTimeout     string   `long:"udp-ping-timeout" description:"UDP healthcheck ping timeout" default:"5s"`

	PluginName     string         `long:"plugin-name" description:"Plugin healthcheck name"`
	PluginJsonOpts flags.Filename `long:"plugin-opts" description:"Plugin healthcheck options targeting a file json format"`

	Strategy string `` /* 174-byte string literal not displayed */

	Force bool `long:"force" description:"Force create entry without confirmation"`
	// contains filtered or unexported fields
}

func (*SetHealthcheck) Execute

func (c *SetHealthcheck) Execute([]string) error

func (*SetHealthcheck) SetClient

func (c *SetHealthcheck) SetClient(client gslbsvc.GSLBClient)

type SetMember

type SetMember struct {
	FQDN     *FQDN   `positional-args:"true" positional-arg-name:"'fqdn'" required:"true"`
	Ip       string  `short:"i" long:"ip" description:"IP of the member to add." required:"true"`
	DC       string  `short:"d" long:"dc" description:"Datacenter of the member to add." required:"true"`
	Ratio    *uint32 `short:"r" long:"ratio" description:"Ratio of the member to add."`
	Disabled *bool   `short:"D" long:"disabled" description:"Disable the member to add."`

	Force bool `long:"force" description:"Force create entry without confirmation"`
	// contains filtered or unexported fields
}

func (*SetMember) Execute

func (c *SetMember) Execute([]string) error

func (*SetMember) SetClient

func (c *SetMember) SetClient(client gslbsvc.GSLBClient)

type SetMemberStatus

type SetMemberStatus struct {
	FQDN *FQDN  `short:"f" long:"fqdn" description:"FQDN of the entry fd."`
	Ip   string `short:"i" long:"ip" description:"IP of the member to disable."`

	DC     string   `short:"d" long:"dc" description:"Datacenter of the member to add."`
	Tags   []string `short:"t" long:"tag" description:"Filter by tag(s) (can be set multiple times)."`
	Prefix string   `short:"p" long:"prefix" description:"Filter by prefix/fqdn."`
	DryRun bool     `long:"dry-run" description:"Do not apply changes, just show what would be done."`
	State  string   `short:"s" long:"state" description:"State to set." choice:"enable" choice:"disable" required:"true"`
	Force  bool     `long:"force" description:"Force create entry without confirmation"`
	Json   bool     `short:"j" long:"json" description:"Format in json instead of human table readable."`
	// contains filtered or unexported fields
}

func (*SetMemberStatus) Execute

func (c *SetMemberStatus) Execute([]string) error

func (*SetMemberStatus) SetClient

func (c *SetMemberStatus) SetClient(client gslbsvc.GSLBClient)

Jump to

Keyboard shortcuts

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