common

package
v0.8.3 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2020 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CALLTYPECREATE = iota
	CALLTYPEDELETE
	CALLTYPEMANAGE
	CALLTYPEMOVE
	CALLTYPEUNDELETE
	CALLTYPEUPDATE
)
View Source
const (
	OBJTYPECROSDEV = iota
	OBJTYPEGROUP
	OBJTYPEGRPSET
	OBJTYPEMEMBER
	OBJTYPEMOBDEV
	OBJTYPEORGUNIT
	OBJTYPEUSER
)
View Source
const (

	// SRVTYPEADMIN is used to request admin service
	SRVTYPEADMIN = iota
	// SRVTYPEGRPSETTING is used to request sheet service
	SRVTYPEGRPSETTING
	// SRVTYPESHEET is used to request sheet service
	SRVTYPESHEET
)
View Source
const (
	// QUIT is used for terminating commands
	QUIT int = 99
	// TIMEFORMAT is used to format timestamp
	TIMEFORMAT string = "2006-01-02T15:04:05Z0700"
)

Variables

Logger passed from logging package

View Source
var ValidFileFormats = []string{
	"csv",
	"gsheet",
	"json",
	"text",
	"txt",
}

ValidFileFormats provides valid file format strings

View Source
var ValidPrimaryShowArgs = []string{
	"cdev",
	"chromeos-device",
	"cros-dev",
	"cros-device",
	"group",
	"grp",
	"group-alias",
	"group-settings",
	"grp-settings",
	"grp-set",
	"gsettings",
	"gset",
	"grp-alias",
	"galias",
	"ga",
	"group-member",
	"grp-member",
	"grp-mem",
	"gmember",
	"gmem",
	"mdev",
	"mob-dev",
	"mob-device",
	"mobile-device",
	"orgunit",
	"ou",
	"schema",
	"sc",
	"ua",
	"ualias",
	"user",
	"user-alias",
	"usr",
}

ValidPrimaryShowArgs holds valid primary arguments for the show command

View Source
var ValidSortOrders = map[string]string{
	"asc":        "ascending",
	"ascending":  "ascending",
	"desc":       "descending",
	"descending": "descending",
}

ValidSortOrders provides valid sort order strings

Functions

func CreateService added in v0.8.0

func CreateService(serviceType int, scope ...string) (interface{}, error)

CreateService function creates and returns a service object

func GminMessage added in v0.7.0

func GminMessage(msgTxt string) string

GminMessage constructs a message for output

func Hostname added in v0.8.0

func Hostname() string

Hostname gets machine hostname if possible

func IPAddress added in v0.8.0

func IPAddress() string

IPAddress gets IP address of machine if possible

func InputFromStdIn added in v0.6.0

func InputFromStdIn(inputFile string) (*bufio.Scanner, error)

InputFromStdIn checks to see if there is stdin data and sets up a scanner for it

func IsErrRetryable added in v0.7.0

func IsErrRetryable(e error) bool

IsErrRetryable checks to see whether Google API error should allow retry

func IsValidAttr

func IsValidAttr(attr string, attrMap map[string]string) (string, error)

IsValidAttr checks to see whether or not an attribute is valid

func ParseForceSend added in v0.5.0

func ParseForceSend(fStr string, attrMap map[string]string) ([]string, error)

ParseForceSend parses force send fields arguments

func ParseInputAttrs added in v0.5.0

func ParseInputAttrs(jsonBytes []byte) ([]string, error)

ParseInputAttrs parses create and update JSON attribute strings

func ProcessHeader added in v0.7.0

func ProcessHeader(hdr []interface{}) map[int]string

ProcessHeader processes header column names

func ShowAttrVals added in v0.8.0

func ShowAttrVals(attrSlice []string, filter string)

ShowAttrVals displays object attribute enumerated values or names of attributes that have them

func ShowAttrs added in v0.6.0

func ShowAttrs(attrSlice []string, attrMap map[string]string, filter string)

ShowAttrs displays object attributes

func ShowFlagValues added in v0.8.0

func ShowFlagValues(flagSlice []string, filter string)

ShowFlagValues displays enumerated flag values

func ShowGlobalFlagValues added in v0.8.0

func ShowGlobalFlagValues(lenArgs int, args []string, filter string) error

ShowGlobalFlagValues displays enumerated global flag values

func ShowQueryableAttrs added in v0.6.0

func ShowQueryableAttrs(filter string, qAttrMap map[string]string)

ShowQueryableAttrs displays user queryable attributes

func SliceContainsStr

func SliceContainsStr(strs []string, s string) bool

SliceContainsStr tells whether a slice contains a particular string

func Timestamp added in v0.7.0

func Timestamp() string

Timestamp gets current formatted time

func UniqueStrSlice added in v0.6.0

func UniqueStrSlice(inSlice []string) []string

UniqueStrSlice takes a slice with duplicate values and returns one with unique values

func Username added in v0.8.0

func Username() string

Username gets username of current user if possible

func ValidateHeader added in v0.7.0

func ValidateHeader(hdr map[int]string, attrMap map[string]string) error

ValidateHeader validated header column names

func ValidateInputAttrs added in v0.5.0

func ValidateInputAttrs(attrs []string, attrMap map[string]string) error

ValidateInputAttrs validates JSON attribute string for create and update calls

func ValidateRecoveryPhone added in v0.7.0

func ValidateRecoveryPhone(phoneNo string) error

ValidateRecoveryPhone validates recovery phone number

Types

type EmptyValues added in v0.7.0

type EmptyValues struct {
	ForceSendFields []string
}

EmptyValues is struct used to extract ForceSendFields from JSON

Jump to

Keyboard shortcuts

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