utils

package
v0.0.0-...-c407d37 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// FilenameFlag is the name of the file being passed in
	FilenameFlag string = "filename"
	// IDFlag is the UUID of the object being retrieved
	IDFlag string = "id"
	// SinceFlag is the datetime for the `since` filter for fetching moves
	SinceFlag string = "since"
	// ETagFlag is the etag for the mto shipment being updated
	ETagFlag string = "etag"
	// PaymentRequestIDFlag is the payment request ID
	PaymentRequestIDFlag string = "paymentRequestID"
	// CertPathFlag is the path to the certificate to use for TLS
	CertPathFlag string = "certpath"
	// KeyPathFlag is the path to the key to use for TLS
	KeyPathFlag string = "keypath"
	// HostnameFlag is the hostname to connect to
	HostnameFlag string = "hostname"
	// PortFlag is the port to connect to
	PortFlag string = "port"
	// InsecureFlag indicates that TLS verification and validation can be skipped
	InsecureFlag string = "insecure"
	// WaitFlag is how long to wait for the server to respond. The
	// string is parsed by https://pkg.go.dev/time#ParseDuration
	WaitFlag string = "wait"
)

Variables

This section is empty.

Functions

func CheckRootConfig

func CheckRootConfig(v *viper.Viper) error

CheckRootConfig checks the validity of the prime api flags

func ContainsDash

func ContainsDash(args []string) bool

ContainsDash returns true if the original command included an empty dash

func CreatePrimeClient

func CreatePrimeClient(v *viper.Viper) (*primeClient.Mymove, *pksigner.Store, error)

CreatePrimeClient creates the prime api client

func CreatePrimeClientWithCACStoreParam

func CreatePrimeClientWithCACStoreParam(v *viper.Viper, store *pksigner.Store) (*primeClient.Mymove, *pksigner.Store, error)

CreatePrimeClientWithCACStoreParam creates the prime api client

func CreateSupportClient

func CreateSupportClient(v *viper.Viper) (*supportClient.Mymove, *pksigner.Store, error)

CreateSupportClient creates the support api client

func DecodeJSONFileToPayload

func DecodeJSONFileToPayload(filename string, isStdin bool, payload interface{}) error

DecodeJSONFileToPayload takes a filename, or stdin and decodes the file into the supplied json payload. If the filename is not supplied, the isStdin bool should be set to true to use stdin. If the file contains parameters that do not exist in the payload struct, it will fail with an error Otherwise it will populate the payload

func HandleGatewayError

func HandleGatewayError(err error, logger *log.Logger) error

HandleGatewayError handles errors returned by the gateway

func ParseFlags

func ParseFlags(cmd *cobra.Command, v *viper.Viper, args []string) error

ParseFlags parses the command line flags

Types

This section is empty.

Jump to

Keyboard shortcuts

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