Documentation ¶
Index ¶
- Constants
- Variables
- func BatchList(ctx context.Context, ic ufsAPI.FleetClient, listFunc listAll, filters []string, ...) ([]proto.Message, error)
- func CSVString(s *[]string) flag.Getter
- func CheckExistsVM(existingVMs []*ufspb.VM, vmName string) bool
- func ChromePlatformExists(ctx context.Context, ic UfleetAPI.FleetClient, name string) bool
- func ConcurrentDelete(ctx context.Context, ic ufsAPI.FleetClient, names []string, ...) ([]string, []string)
- func ConcurrentGet(ctx context.Context, ic ufsAPI.FleetClient, names []string, ...) []proto.Message
- func DoList(ctx context.Context, ic ufsAPI.FleetClient, listFunc listAll, pageSize int32, ...) ([]proto.Message, error)
- func DracExists(ctx context.Context, ic UfleetAPI.FleetClient, name string) bool
- func EntityExists(ctx context.Context, ic UfleetAPI.FleetClient, resource, name string) bool
- func FullMode(full bool) bool
- func GenerateAssetUpdate(hostname, machine, model, board, zone, rack string) (*ufspb.Asset, []string, error)
- func GetAssetsInOrder(logFile string) ([]*fleet.ChopsAsset, error)
- func GetChromePlatformInteractiveInput(ctx context.Context, ic UfleetAPI.FleetClient, cp *fleet.ChromePlatform, ...)
- func GetDracInteractiveInput(ctx context.Context, ic UfleetAPI.FleetClient, drac *fleet.Drac, update bool) string
- func GetInteractiveInput() []string
- func GetKVMInteractiveInput(ctx context.Context, ic UfleetAPI.FleetClient, kvm *fleet.KVM, update bool) string
- func GetLocation(input string) (*ufspb.Location, error)
- func GetMachineInteractiveInput(ctx context.Context, ic UfleetAPI.FleetClient, machine *fleet.Machine, ...)
- func GetMachinelseInteractiveInput(ctx context.Context, ic UfleetAPI.FleetClient, machinelse *fleet.MachineLSE, ...)
- func GetMachinelsePrototypeInteractiveInput(ctx context.Context, ic UfleetAPI.FleetClient, ...)
- func GetNextPage(pageToken string) (bool, error)
- func GetNicInteractiveInput(ctx context.Context, ic UfleetAPI.FleetClient, nic *fleet.Nic, update bool) string
- func GetRPMInteractiveInput(ctx context.Context, ic UfleetAPI.FleetClient, rpm *fleet.RPM)
- func GetRackInteractiveInput(ctx context.Context, ic UfleetAPI.FleetClient, ...)
- func GetRacklsePrototypeInteractiveInput(ctx context.Context, ic UfleetAPI.FleetClient, rlsep *fleet.RackLSEPrototype, ...)
- func GetStringSlice(msg string) []string
- func GetSwitchInteractiveInput(ctx context.Context, ic UfleetAPI.FleetClient, s *fleet.Switch)
- func GetUpdateMask(set *flag.FlagSet, paths map[string]string) *field_mask.FieldMask
- func IsCSVFile(filename string) bool
- func IsDUT(lse *ufspb.MachineLSE) error
- func IsLocation(iput string) bool
- func JoinFilters(old []string, filters ...string) []string
- func KVMExists(ctx context.Context, ic UfleetAPI.FleetClient, name string) bool
- func LooksLikeHeader(rec []string) bool
- func MachineExists(ctx context.Context, ic UfleetAPI.FleetClient, name string) bool
- func MachineLSEExists(ctx context.Context, ic UfleetAPI.FleetClient, name string) bool
- func MachineLSEPrototypeExists(ctx context.Context, ic UfleetAPI.FleetClient, name string) bool
- func NicExists(ctx context.Context, ic UfleetAPI.FleetClient, name string) bool
- func NoEmitMode(noemit bool) bool
- func ParseJSONFile(jsonFile string, pm proto.Message) error
- func ParseMCSVFile(specsFile string) ([][]string, error)
- func PrefixFilters(prefix string, filters []string) []string
- func PrintAllNormal(title []string, res [][]string, keysOnly bool)
- func PrintAllTSVs(res [][]string)
- func PrintAssets(res []proto.Message, keysOnly bool)
- func PrintAssetsJSON(res []proto.Message, emit bool)
- func PrintCachingServices(res []proto.Message, keysOnly bool)
- func PrintCachingServicesJSON(res []proto.Message, emit bool)
- func PrintChromePlatforms(res []proto.Message, keysOnly bool)
- func PrintChromePlatformsJSON(res []proto.Message, emit bool)
- func PrintDracFull(entities []*ufspb.Drac, dhcps map[string]*ufspb.DHCPConfig)
- func PrintDracs(res []proto.Message, keysOnly bool)
- func PrintDracsJSON(res []proto.Message, emit bool)
- func PrintDutsFull(duts []*ufspb.MachineLSE, machineMap map[string]*ufspb.Machine)
- func PrintDutsShort(res []proto.Message, keysOnly bool)
- func PrintEntities(ctx context.Context, ic ufsAPI.FleetClient, res []proto.Message, ...) error
- func PrintExistingAsset(ctx context.Context, ic ufsAPI.FleetClient, name string) (*ufspb.Asset, error)
- func PrintExistingCachingService(ctx context.Context, ic ufsAPI.FleetClient, name string) error
- func PrintExistingDUT(ctx context.Context, ic ufsAPI.FleetClient, name string) error
- func PrintExistingDrac(ctx context.Context, ic ufsAPI.FleetClient, name string) error
- func PrintExistingHost(ctx context.Context, ic ufsAPI.FleetClient, name string) error
- func PrintExistingKVM(ctx context.Context, ic ufsAPI.FleetClient, name string) error
- func PrintExistingLSEDeploymentRecord(ctx context.Context, ic ufsAPI.FleetClient, name string)
- func PrintExistingMachine(ctx context.Context, ic ufsAPI.FleetClient, name string) (*ufspb.Machine, error)
- func PrintExistingMachinePrototype(ctx context.Context, ic ufsAPI.FleetClient, name string) error
- func PrintExistingNic(ctx context.Context, ic ufsAPI.FleetClient, name string) error
- func PrintExistingPlatform(ctx context.Context, ic ufsAPI.FleetClient, name string) error
- func PrintExistingRPM(ctx context.Context, ic ufsAPI.FleetClient, name string) error
- func PrintExistingRack(ctx context.Context, ic ufsAPI.FleetClient, name string) error
- func PrintExistingRackPrototype(ctx context.Context, ic ufsAPI.FleetClient, name string) error
- func PrintExistingSchedulingUnit(ctx context.Context, ic ufsAPI.FleetClient, name string) error
- func PrintExistingSwitch(ctx context.Context, ic ufsAPI.FleetClient, name string) error
- func PrintExistingVM(ctx context.Context, ic ufsAPI.FleetClient, name string) error
- func PrintExistingVlan(ctx context.Context, ic ufsAPI.FleetClient, name string) error
- func PrintJSON(t interface{}) error
- func PrintKVMFull(kvms []*ufspb.KVM, dhcps map[string]*ufspb.DHCPConfig)
- func PrintKVMs(res []proto.Message, keysOnly bool)
- func PrintKVMsJSON(res []proto.Message, emit bool)
- func PrintListJSONFormat(ctx context.Context, ic ufsAPI.FleetClient, f printAll, json bool, ...) error
- func PrintListTableFormat(ctx context.Context, ic ufsAPI.FleetClient, f printAll, json bool, ...) error
- func PrintLogStats(l LogStatsList, limit int, reverse bool)
- func PrintLogStatsAndResult(l *LogStats, index int)
- func PrintMachineLSEDeployments(res []proto.Message, keysOnly bool)
- func PrintMachineLSEDeploymentsJSON(res []proto.Message, emit bool)
- func PrintMachineLSEFull(entities []*ufspb.MachineLSE, dhcps map[string]*ufspb.DHCPConfig)
- func PrintMachineLSEPrototypes(res []proto.Message, keysOnly bool)
- func PrintMachineLSEPrototypesJSON(res []proto.Message, emit bool)
- func PrintMachineLSEs(res []proto.Message, keysOnly bool)
- func PrintMachineLSEsJSON(res []proto.Message, emit bool)
- func PrintMachines(res []proto.Message, keysOnly bool)
- func PrintMachinesJSON(res []proto.Message, emit bool)
- func PrintNics(res []proto.Message, keysOnly bool)
- func PrintNicsJSON(res []proto.Message, emit bool)
- func PrintProtoJSON(pm proto.Message, emit bool)
- func PrintRPMs(res []proto.Message, keysOnly bool)
- func PrintRPMsJSON(res []proto.Message, emit bool)
- func PrintRackLSEPrototypes(res []proto.Message, keysOnly bool)
- func PrintRackLSEPrototypesJSON(res []proto.Message, emit bool)
- func PrintRacks(res []proto.Message, keysOnly bool)
- func PrintRacksJSON(res []proto.Message, emit bool)
- func PrintSchedulingUnits(res []proto.Message, keysOnly bool)
- func PrintSchedulingUnitsJSON(res []proto.Message, emit bool)
- func PrintSwitches(res []proto.Message, keysOnly bool)
- func PrintSwitchesJSON(res []proto.Message, emit bool)
- func PrintTSVAssets(msgs []proto.Message, keysOnly bool)
- func PrintTSVCachingServices(msgs []proto.Message, keysOnly bool)
- func PrintTSVDracFull(drac *ufspb.Drac, dhcp *ufspb.DHCPConfig)
- func PrintTSVDracs(msgs []proto.Message, keysOnly bool)
- func PrintTSVHostFull(lse *ufspb.MachineLSE, dhcp *ufspb.DHCPConfig)
- func PrintTSVKVMFull(kvm *ufspb.KVM, dhcp *ufspb.DHCPConfig)
- func PrintTSVKVMs(res []proto.Message, keysOnly bool)
- func PrintTSVMachineLSEDeployments(msgs []proto.Message, keysOnly bool)
- func PrintTSVMachineLSEPrototypes(msgs []proto.Message, keysOnly bool)
- func PrintTSVMachineLSEs(msgs []proto.Message, keysOnly bool)
- func PrintTSVMachines(msgs []proto.Message, keysOnly bool)
- func PrintTSVNics(msgs []proto.Message, keysOnly bool)
- func PrintTSVPlatforms(msgs []proto.Message, keysOnly bool)
- func PrintTSVRPMs(msgs []proto.Message, keysOnly bool)
- func PrintTSVRackLSEPrototypes(msgs []proto.Message, keysOnly bool)
- func PrintTSVRacks(msgs []proto.Message, keysOnly bool)
- func PrintTSVSchedulingUnits(msgs []proto.Message, keysOnly bool)
- func PrintTSVSwitches(msgs []proto.Message, keysOnly bool)
- func PrintTSVVMs(msgs []proto.Message, keysOnly bool)
- func PrintTSVVlans(msgs []proto.Message, keysOnly bool)
- func PrintTableTitle(title []string, tsv, keysOnly bool)
- func PrintTitle(title []string)
- func PrintVMs(res []proto.Message, keysOnly bool)
- func PrintVMsJSON(res []proto.Message, emit bool)
- func PrintVlans(res []proto.Message, keysOnly bool)
- func PrintVlansJSON(res []proto.Message, emit bool)
- func RPMExists(ctx context.Context, ic UfleetAPI.FleetClient, name string) bool
- func RackExists(ctx context.Context, ic UfleetAPI.FleetClient, name string) bool
- func RackLSEPrototypeExists(ctx context.Context, ic UfleetAPI.FleetClient, name string) bool
- func RemoveVM(existingVMs []*ufspb.VM, vmName string) []*ufspb.VM
- func SetupContext(ctx context.Context, namespace string) context.Context
- func SwitchExists(ctx context.Context, ic UfleetAPI.FleetClient, name string) bool
- func ValidateSameStringArray(expected []string, actual []string) error
- func VlanExists(ctx context.Context, ic UfleetAPI.FleetClient, name string) bool
- type AssetStats
- type CSVStringFlag
- type CSVWriter
- type Input
- type LogStats
- type LogStatsList
- type PromptFunc
- type SummaryResultsTable
- func (sRes *SummaryResultsTable) IsSuccessForAny(operation string) bool
- func (sRes *SummaryResultsTable) PrintResultsTable(out *os.File, fitWidth bool)
- func (sRes *SummaryResultsTable) RecordResult(operation, entity string, res error)
- func (sRes *SummaryResultsTable) RecordSkip(operation, entity, reason string)
- type Updater
Constants ¶
const ( // SummaryResultsLegendPass is the symbol displayed in summary results table for pass. SummaryResultsLegendPass = "✔" // SummaryResultsLegendFail is the symbol displayed in summary results table for fail. SummaryResultsLegendFail = "✗" // SummaryResultsLegendSkip is the symbol displayed in summary results table for skip. SummaryResultsLegendSkip = "-" // SummaryResultsMinCommentSize is the minimum length of the comment string to be displayed. SummaryResultsMinCommentSize = 15 // SummaryResultsTableMinWidth is the min width of a cell including padding in the summary results table. SummaryResultsTableMinWidth = 2 // SummaryResultsTableTabWidth is the tab width to be used in the summary results table. SummaryResultsTableTabWidth = 2 // SummaryResultsTablePadding is the padding added to the cell before computing its width. SummaryResultsTablePadding = 4 // SummaryResultsTablePadChar is the char used for padding a cell in the table. SummaryResultsTablePadChar = ' ' )
const ( SummaryResultsSkipped = iota // To represent that the operation was skipped. SummaryResultsPass // To represent that the operation was a success. SummaryResultsFail // To represent that the operation failed. )
Enum to represent states of SummaryResults
const ( InputDetails string = "Please enter the details: " RequiredField string = "is a required field. It cannot be blank/empty." WrongInput string = "\n WRONG INPUT!!\n" ChooseOption string = "\n Choose an option\n" ChooseChromePlatform string = "\n Choose a ChromePlatform\n" ChooseMachineLSEPrototype string = "\n Choose a MachineLSE Prototype\n" ChooseChameleonType string = "\n Choose a ChameleonType \n" ChooseCameraType string = "\n Choose a CameraType \n" ChooseAntennaConnection string = "\n Choose an AntennaConnection \n" ChooseRouter string = "\n Choose a Router \n" ChooseCableType string = "\n Choose a Cable \n" ChooseCameraboxFacing string = "\n Choose a Facing for CameraBox \n" ChoosePheripheralType string = "\n Choose a PheripheralType \n" ChooseVirtualType string = "\n Choose a VirtualType \n" OptionToEnter string = "\nDo you want to enter a " OptionToEnterMore string = "\nDo you want to enter one more " ChooseLab string = "\n Choose a Lab\n" ChooseZone string = "\n Choose a Zone\n" BroswerOrOSLab string = "1=\"Browser Lab\"\n2=\"OS Lab\"\n" BrowserOrATLOrACSLab string = "1=\"Browser Lab\"\n2=\"ATL Lab\"\n3=\"ACS Lab\"\n" DutOrLabstationOrServer string = "1=\"DUT\"\n2=\"Labstation\"\n3=\"Server\"\n" DoesNotExist string = " doesnt not exist in the system. Please check and enter again." AlreadyExists string = " already exists in the system. Please check and enter again." ATL string = "ATL" ACS string = "ACS" Browser string = "Browser" Unknown string = "Unknown" YesNo string = " (y/n)" ATLLab string = "atl:" ACSLab string = "acs:" BrowserLab string = "browser:" MinMaxError string = "Maximum value must be greater than or equal to Minimum value." )
Interactive mode messages for user input
Variables ¶
var ( SwitchTitle = []string{"Switch Name", "CapacityPort", "Zone", "Rack", "State", "UpdateTime"} KvmTitle = []string{"KVM Name", "MAC Address", "ChromePlatform", "CapacityPort", "Zone", "Rack", "State", "UpdateTime"} KvmFullTitle = []string{"KVM Name", "MAC Address", "ChromePlatform", "CapacityPort", "IP", "Vlan", "State", "Zone", "Rack", "UpdateTime"} RpmTitle = []string{"RPM Name", "MAC Address", "CapacityPort", "Zone", "Rack", "State", "UpdateTime"} DracTitle = []string{"Drac Name", "Display name", "MAC Address", "Switch", "Switch Port", "Password", "Zone", "Rack", "Machine", "UpdateTime"} DracFullTitle = []string{"Drac Name", "MAC Address", "Switch", "Switch Port", "Attached Host", "IP", "Vlan", "Zone", "Rack", "Machine", "UpdateTime"} NicTitle = []string{"Nic Name", "MAC Address", "Switch", "Switch Port", "Zone", "Rack", "Machine", "UpdateTime"} BrowserMachineTitle = []string{"Machine Name", "Serial Number", "Zone", "Rack", "KVM", "KVM Port", "ChromePlatform", "DeploymentTicket", "Description", "State", "Realm", "UpdateTime"} OSMachineTitle = []string{"Machine Name", "Zone", "Rack", "Barcode", "Hardware ID", "Model", "DeviceType", "MacAddress", "SKU", "Phase", "Build Target", "State", "Realm", "UpdateTime"} MachinelseprototypeTitle = []string{"Machine Prototype Name", "Occupied Capacity", "PeripheralTypes", "VirtualTypes", "Tags", "UpdateTime"} RacklseprototypeTitle = []string{"Rack Prototype Name", "PeripheralTypes", "Tags", "UpdateTime"} ChromePlatformTitle = []string{"Platform Name", "Manufacturer", "Description", "UpdateTime"} VlanTitle = []string{"Vlan Name", "CIDR Block", "IP Capacity", "DHCP range", "Description", "State", "Zones", "Reserved IPs", "UpdateTime"} VMTitle = []string{"VM Name", "OS Version", "MAC Address", "Zone", "Host", "Vlan", "IP", "State", "DeploymentTicket", "Description", "UpdateTime"} RackTitle = []string{"Rack Name", "Zone", "Capacity", "State", "Realm", "UpdateTime"} MachineLSETitle = []string{"Host", "OS Version", "Zone", "Virtual Datacenter", "Rack", "Machine(s)", "Nic", "Vlan", "IP", "State", "VM capacity", "DeploymentTicket", "Description", "UpdateTime"} MachineLSEFullTitle = []string{"Host", "OS Version", "Manufacturer", "Machine", "Zone", "Virtual Datacenter", "Rack", "Nic", "IP", "Vlan", "MAC Address", "State", "VM capacity", "Description", "UpdateTime"} MachineLSEDeploymentTitle = []string{"Serial Number", "Hostname", "Deployment Identifier", "Deployment Env", "UpdateTime"} VMFreeSlotTitle = []string{"Host", "OS Version", "Zone", "Virtual Datacenter", "Rack", "Machine(s)", "Nic", "Vlan", "IP", "State", "Free slots", "DeploymentTicket", "Description", "UpdateTime"} VMFreeSlotFullTitle = []string{"Host", "OS Version", "Manufacturer", "Machine", "Zone", "Virtual Datacenter", "Rack", "Nic", "IP", "Vlan", "MAC Address", "State", "Free slots", "Description", "UpdateTime"} ZoneTitle = []string{"Name", "EnumName", "Department"} StateTitle = []string{"Name", "EnumName", "Description"} AssetTitle = []string{"Asset Name", "Zone", "Rack", "Barcode", "Serial Number", "Hardware ID", "Model", "AssetType", "MacAddress", "SKU", "Phase", "Build Target", "Realm", "UpdateTime"} CachingServiceTitle = []string{"CachingService Name", "Port", "Subnets", "Primary", "Secondary", "State", "Description", "UpdateTime"} SchedulingUnitTitle = []string{"SchedulingUnit Name", "DUTs", "Pools", "Type", "Description", "UpdateTime"} )
Titles for printing table format list
var ClearFieldValue string = "-"
ClearFieldValue specifying this value in update command will send empty value while doing partial updates using update field mask.
Functions ¶
func BatchList ¶
func BatchList(ctx context.Context, ic ufsAPI.FleetClient, listFunc listAll, filters []string, pageSize int, keysOnly, full bool) ([]proto.Message, error)
BatchList returns the all listed entities by filters
func CheckExistsVM ¶
CheckExistsVM checks if the given vm already exists in the slice
func ChromePlatformExists ¶
ChromePlatformExists checks if the given ChromePlatform exists in the system
func ConcurrentDelete ¶
func ConcurrentDelete(ctx context.Context, ic ufsAPI.FleetClient, names []string, deleteSingle deleteSingleFunc) ([]string, []string)
ConcurrentDelete runs multiple goroutines making Delete calls to UFS
func ConcurrentGet ¶
func ConcurrentGet(ctx context.Context, ic ufsAPI.FleetClient, names []string, getSingle getSingleFunc) []proto.Message
ConcurrentGet runs multiple goroutines making Get calls to UFS
func DoList ¶
func DoList(ctx context.Context, ic ufsAPI.FleetClient, listFunc listAll, pageSize int32, filter string, keysOnly, full bool) ([]proto.Message, error)
DoList lists the outputs
func DracExists ¶
DracExists checks if the given Drac exists in the system
func EntityExists ¶
EntityExists checks if the given resource exists in the system
func GenerateAssetUpdate ¶
func GenerateAssetUpdate(hostname, machine, model, board, zone, rack string) (*ufspb.Asset, []string, error)
GenerateAssetUpdate generates an AssetUpdate request for location, model and board updates
func GetAssetsInOrder ¶
func GetAssetsInOrder(logFile string) ([]*fleet.ChopsAsset, error)
GetAssetsInOrder reads a group of assets from log file.
func GetChromePlatformInteractiveInput ¶
func GetChromePlatformInteractiveInput(ctx context.Context, ic UfleetAPI.FleetClient, cp *fleet.ChromePlatform, update bool)
GetChromePlatformInteractiveInput gets ChromePlatform input in interactive mode
Name(string) -> Manufacturer(string) -> Description(string)
func GetDracInteractiveInput ¶
func GetDracInteractiveInput(ctx context.Context, ic UfleetAPI.FleetClient, drac *fleet.Drac, update bool) string
GetDracInteractiveInput get drac input in interactive mode
Name(string) -> Display name(string) -> MAC Address(string) -> -> SwitchInterface[Switch(string, resource) -> Switch Port(int)] -> -> Password(string)
func GetInteractiveInput ¶
func GetInteractiveInput() []string
GetInteractiveInput collects the scanned string list.
func GetKVMInteractiveInput ¶
func GetKVMInteractiveInput(ctx context.Context, ic UfleetAPI.FleetClient, kvm *fleet.KVM, update bool) string
GetKVMInteractiveInput get kvm input in interactive mode
Name(string) -> MAC Address(string) -> ChromePlatform(string, resource) -> -> CapacityPort(int) -> Rack name(string)
func GetLocation ¶
GetLocation returns Location proto from barcode name
func GetMachineInteractiveInput ¶
func GetMachineInteractiveInput(ctx context.Context, ic UfleetAPI.FleetClient, machine *fleet.Machine, update bool)
GetMachineInteractiveInput get Machine input in interactive mode
Name(string) -> Lab(enum) -> Browser/OS LAB(choice to branch) -> -> getBrowserMachine()/getOSMachine() -> Realm(string)
func GetMachinelseInteractiveInput ¶
func GetMachinelseInteractiveInput(ctx context.Context, ic UfleetAPI.FleetClient, machinelse *fleet.MachineLSE, update bool)
GetMachinelseInteractiveInput get MachineLSE input in interactive mode
Name(string) -> Broswer/ATL/ACS LAB(choice to branch) -> -> getBrowserMachineLse()/getOSMachineLse() -> -> Machine(repeated string, resource)
func GetMachinelsePrototypeInteractiveInput ¶
func GetMachinelsePrototypeInteractiveInput(ctx context.Context, ic UfleetAPI.FleetClient, mlsep *fleet.MachineLSEPrototype, update bool)
GetMachinelsePrototypeInteractiveInput gets MachineLSEPrototype input in interactive mode
Name(string) -> Broswer/ATL/ACS LAB(choice) -> Occupied Capacity(int) -> -> getPeripheralRequirements() -> getVirtualRequirements()
func GetNextPage ¶
GetNextPage gets user input for to get next page of items
func GetNicInteractiveInput ¶
func GetNicInteractiveInput(ctx context.Context, ic UfleetAPI.FleetClient, nic *fleet.Nic, update bool) string
GetNicInteractiveInput get nic input in interactive mode
Name(string) -> MAC Address(string) -> -> SwitchInterface[Switch(string, resource) -> Switch Port(int)] -> -> Machine name(string)
func GetRPMInteractiveInput ¶
GetRPMInteractiveInput get rpm input in interactive mode
Name(string) -> Rack name(string) -> MAC Address(string) -> CapacityPort(int)
func GetRackInteractiveInput ¶
func GetRackInteractiveInput(ctx context.Context, ic UfleetAPI.FleetClient, req *UfleetAPI.RackRegistrationRequest)
GetRackInteractiveInput get rack input in interactive mode
Name(string) -> Rack name(string) -> CapacityPort(int)
func GetRacklsePrototypeInteractiveInput ¶
func GetRacklsePrototypeInteractiveInput(ctx context.Context, ic UfleetAPI.FleetClient, rlsep *fleet.RackLSEPrototype, update bool)
GetRacklsePrototypeInteractiveInput gets RackLSEPrototype input in interactive mode
Name(string) -> Broswer/ATL/ACS LAB(choice) -> getPeripheralRequirements()
func GetStringSlice ¶
GetStringSlice converts the comma separated string to a slice of strings
func GetSwitchInteractiveInput ¶
GetSwitchInteractiveInput get switch input in interactive mode
Name(string) -> Rack name(string) -> CapacityPort(int)
func GetUpdateMask ¶
GetUpdateMask returns a *field_mask.FieldMask containing paths based on which flags have been set.
paths is a map of cmd line option flags to field names of the object.
func IsDUT ¶
func IsDUT(lse *ufspb.MachineLSE) error
IsDUT returns nil if lse represents DUT or returns error with a reason
func IsLocation ¶
IsLocation determines if a string describes a ChromeOS lab location
func JoinFilters ¶
JoinFilters joins several filters together
func LooksLikeHeader ¶
LooksLikeHeader heuristically determines whether a CSV line looks like a CSV header for the MCSV format.
func MachineExists ¶
MachineExists checks if the given Machine exists in the system
func MachineLSEExists ¶
MachineLSEExists checks if the given MachineLSE exists in the system
func MachineLSEPrototypeExists ¶
MachineLSEPrototypeExists checks if the given MachineLSEPrototype exists in the system
func NoEmitMode ¶
NoEmitMode checks if emit mode is enabled for json output
func ParseJSONFile ¶
ParseJSONFile parses json input from the user provided file.
func ParseMCSVFile ¶
ParseMCSVFile parse a mcsv file and return the records as 2D string slice
func PrefixFilters ¶
PrefixFilters returns a group of filter strings with prefix
func PrintAllNormal ¶
PrintAllNormal prints a 2D slice with tabwriter
func PrintAllTSVs ¶
func PrintAllTSVs(res [][]string)
PrintAllTSVs prints all in tsv format of the input
func PrintAssets ¶
PrintAssets prints the all assets in table form.
func PrintAssetsJSON ¶
PrintAssetsJSON prints the asset details in json format.
func PrintCachingServices ¶
PrintCachingServices prints the all CachingServices in table form.
func PrintCachingServicesJSON ¶
PrintCachingServicesJSON prints the CachingService details in json format.
func PrintChromePlatforms ¶
PrintChromePlatforms prints the all msleps in table form.
func PrintChromePlatformsJSON ¶
PrintChromePlatformsJSON prints the mslep details in json format.
func PrintDracFull ¶
func PrintDracFull(entities []*ufspb.Drac, dhcps map[string]*ufspb.DHCPConfig)
PrintDracFull prints the full related msg for drac
func PrintDracs ¶
PrintDracs prints the all dracs in table form.
func PrintDracsJSON ¶
PrintDracsJSON prints the drac details in json format.
func PrintDutsFull ¶
func PrintDutsFull(duts []*ufspb.MachineLSE, machineMap map[string]*ufspb.Machine)
PrintDutsFull prints the most commonly used dut information in a human-readable format along with Machine information.
TODO(xixuan): remove the similar function for skylab tooling package
func PrintDutsShort ¶
PrintDutsShort prints only the dut info from MachineLSE
func PrintEntities ¶
func PrintEntities(ctx context.Context, ic ufsAPI.FleetClient, res []proto.Message, printJSON printJSONFunc, printFull printFullFunc, printNormal printNormalFunc, json, emit, full, tsv, keysOnly bool) error
PrintEntities a batch of entities based on user parameters
func PrintExistingAsset ¶
func PrintExistingAsset(ctx context.Context, ic ufsAPI.FleetClient, name string) (*ufspb.Asset, error)
PrintExistingAsset prints the old asset in update/delete operations.
func PrintExistingCachingService ¶
PrintExistingCachingService prints the old CachingService in update/delete operations
func PrintExistingDUT ¶
PrintExistingDUT prints the old host in update/delete operations
func PrintExistingDrac ¶
PrintExistingDrac prints the old drac in update/delete operations
func PrintExistingHost ¶
PrintExistingHost prints the old host in update/delete operations
func PrintExistingKVM ¶
PrintExistingKVM prints the old kvm in update/delete operations
func PrintExistingLSEDeploymentRecord ¶
func PrintExistingLSEDeploymentRecord(ctx context.Context, ic ufsAPI.FleetClient, name string)
PrintExistingLSEDeploymentRecord prints the old deployment record in update/delete operations
func PrintExistingMachine ¶
func PrintExistingMachine(ctx context.Context, ic ufsAPI.FleetClient, name string) (*ufspb.Machine, error)
PrintExistingMachine prints the old machine in update/delete operations.
func PrintExistingMachinePrototype ¶
PrintExistingMachinePrototype prints the old machine prototype in update/delete operations
func PrintExistingNic ¶
PrintExistingNic prints the old nic in update/delete operations
func PrintExistingPlatform ¶
PrintExistingPlatform prints the old platform in update/delete operations
func PrintExistingRPM ¶
PrintExistingRPM prints the old rpm in update/delete operations
func PrintExistingRack ¶
PrintExistingRack prints the old rack in update/delete operations
func PrintExistingRackPrototype ¶
PrintExistingRackPrototype prints the old rack prototype in update/delete operations
func PrintExistingSchedulingUnit ¶
PrintExistingSchedulingUnit prints the old SchedulingUnit in update/delete operations
func PrintExistingSwitch ¶
PrintExistingSwitch prints the old switch in update/delete operations
func PrintExistingVM ¶
PrintExistingVM prints the old vm in update/delete operations
func PrintExistingVlan ¶
PrintExistingVlan prints the old vlan update/delete operations
func PrintKVMFull ¶
func PrintKVMFull(kvms []*ufspb.KVM, dhcps map[string]*ufspb.DHCPConfig)
PrintKVMFull prints the full info for kvm
func PrintKVMsJSON ¶
PrintKVMsJSON prints the kvm details in json format.
func PrintListJSONFormat ¶
func PrintListJSONFormat(ctx context.Context, ic ufsAPI.FleetClient, f printAll, json bool, pageSize int32, filter string, keysOnly, emit bool) error
PrintListJSONFormat prints the list output in JSON format
func PrintListTableFormat ¶
func PrintListTableFormat(ctx context.Context, ic ufsAPI.FleetClient, f printAll, json bool, pageSize int32, filter string, keysOnly bool, title []string, tsv bool) error
PrintListTableFormat prints list output in Table format
func PrintLogStats ¶
func PrintLogStats(l LogStatsList, limit int, reverse bool)
PrintLogStats prints infos for a batch of audit scan runs.
func PrintLogStatsAndResult ¶
PrintLogStatsAndResult prints the stats and results for a specified audit scan run.
func PrintMachineLSEDeployments ¶
PrintMachineLSEDeployments prints a list of machine lse deployment records
func PrintMachineLSEDeploymentsJSON ¶
PrintMachineLSEDeploymentsJSON prints the machine lse deployment records details in json format.
func PrintMachineLSEFull ¶
func PrintMachineLSEFull(entities []*ufspb.MachineLSE, dhcps map[string]*ufspb.DHCPConfig)
PrintMachineLSEFull prints the full info for a host
func PrintMachineLSEPrototypes ¶
PrintMachineLSEPrototypes prints the all msleps in table form.
func PrintMachineLSEPrototypesJSON ¶
PrintMachineLSEPrototypesJSON prints the mslep details in json format.
func PrintMachineLSEs ¶
PrintMachineLSEs prints the all machinelses in table form.
func PrintMachineLSEsJSON ¶
PrintMachineLSEsJSON prints the machinelse details in json format.
func PrintMachines ¶
PrintMachines prints the all machines in table form.
func PrintMachinesJSON ¶
PrintMachinesJSON prints the machine details in json format.
func PrintNicsJSON ¶
PrintNicsJSON prints the nic details in json format.
func PrintProtoJSON ¶
PrintProtoJSON prints the output as json
func PrintRPMsJSON ¶
PrintRPMsJSON prints the rpm details in json format.
func PrintRackLSEPrototypes ¶
PrintRackLSEPrototypes prints the all msleps in table form.
func PrintRackLSEPrototypesJSON ¶
PrintRackLSEPrototypesJSON prints the mslep details in json format.
func PrintRacks ¶
PrintRacks prints the all racks in table form.
func PrintRacksJSON ¶
PrintRacksJSON prints the rack details in json format.
func PrintSchedulingUnits ¶
PrintSchedulingUnits prints the all SchedulingUnits in table form.
func PrintSchedulingUnitsJSON ¶
PrintSchedulingUnitsJSON prints the SchedulingUnit details in json format.
func PrintSwitches ¶
PrintSwitches prints the all switches in table form.
func PrintSwitchesJSON ¶
PrintSwitchesJSON prints the switch details in json format.
func PrintTSVAssets ¶
PrintTSVAssets prints the tsv format of assets
func PrintTSVCachingServices ¶
PrintTSVCachingServices prints the tsv format of CachingServices
func PrintTSVDracFull ¶
func PrintTSVDracFull(drac *ufspb.Drac, dhcp *ufspb.DHCPConfig)
PrintTSVDracFull prints the full related msg for drac in tsv mode
func PrintTSVDracs ¶
PrintTSVDracs prints the tsv format of dracs
func PrintTSVHostFull ¶
func PrintTSVHostFull(lse *ufspb.MachineLSE, dhcp *ufspb.DHCPConfig)
PrintTSVHostFull prints the full related msg for host in tsv mode
func PrintTSVKVMFull ¶
func PrintTSVKVMFull(kvm *ufspb.KVM, dhcp *ufspb.DHCPConfig)
PrintTSVKVMFull prints the full related msg for kvm in tsv mode
func PrintTSVKVMs ¶
PrintTSVKVMs prints the tsv format of kvms
func PrintTSVMachineLSEDeployments ¶
PrintTSVHostFull prints the full related msg for host in tsv mode
func PrintTSVMachineLSEPrototypes ¶
PrintTSVMachineLSEPrototypes prints the tsv format of machine lse prototypes
func PrintTSVMachineLSEs ¶
PrintTSVMachineLSEs prints the tsv format of machine lses
func PrintTSVMachines ¶
PrintTSVMachines prints the tsv format of machines
func PrintTSVNics ¶
PrintTSVNics prints the tsv format of nics
func PrintTSVPlatforms ¶
PrintTSVPlatforms prints the tsv format of chrome platforms
func PrintTSVRPMs ¶
PrintTSVRPMs prints the tsv format of rpms
func PrintTSVRackLSEPrototypes ¶
PrintTSVRackLSEPrototypes prints the tsv format of rack lse prototypes
func PrintTSVRacks ¶
PrintTSVRacks prints the tsv format of racks
func PrintTSVSchedulingUnits ¶
PrintTSVSchedulingUnits prints the tsv format of SchedulingUnits
func PrintTSVSwitches ¶
PrintTSVSwitches prints the tsv format of switches
func PrintTSVVMs ¶
PrintTSVVMs prints the tsv format of vms
func PrintTSVVlans ¶
PrintTSVVlans prints the tsv format of vlans
func PrintTableTitle ¶
PrintTableTitle prints the table title with parameters
func PrintVMsJSON ¶
PrintVMsJSON prints the vm details in json format.
func PrintVlans ¶
PrintVlans prints the all vlans in table form.
func PrintVlansJSON ¶
PrintVlansJSON prints the vlan details in json format.
func RackExists ¶
RackExists checks if the given Rack exists in the system
func RackLSEPrototypeExists ¶
RackLSEPrototypeExists checks if the given RackLSEPrototype exists in the system
func SetupContext ¶
SetupContext sets up context with namespace
func SwitchExists ¶
SwitchExists checks if the given Switch exists in the system
func ValidateSameStringArray ¶
ValidateSameStringArray validates if 2 strings slice are same
func VlanExists ¶
VlanExists checks if the given Vlan exists in the system
Types ¶
type AssetStats ¶
type AssetStats struct { Asset *fleet.ChopsAsset Action string ErrorMsg string }
AssetStats to store the statistics of a chops asset
type CSVStringFlag ¶
type CSVStringFlag []string
CSVStringFlag is a flag.Getter implementation representing a []string.
func (*CSVStringFlag) Set ¶
func (f *CSVStringFlag) Set(val string) error
Set records seeing a flag value.
func (CSVStringFlag) String ¶
func (f CSVStringFlag) String() string
String returns a comma-separated string representation of the flag values.
type Input ¶
Input deatils for the input variable
Key - input variable name Desc - description of the variable Required - if the variable is a required field
type LogStats ¶
type LogStats struct { LogPath string ResPath string Tstamp time.Time // The times that we scan an asset in the run ScannedAssetCount int // The times that we scan a location in the run ScannedLocationCount int SuccessfulAssetScan int FailedAssetScan int ScannedAssets map[string]*AssetStats ScannedLocations map[string]bool MismatchedAssets map[string]*AssetStats // The failure when generating the stats FailureMsg []string }
LogStats to store the statistics of any given run
type LogStatsList ¶
type LogStatsList []*LogStats
LogStatsList refers to a list of log stats.
func ListLogs ¶
func ListLogs(dir string) (LogStatsList, error)
ListLogs lists the logs and return the stats for each of the audit runs.
func (LogStatsList) Len ¶
func (l LogStatsList) Len() int
func (LogStatsList) Swap ¶
func (l LogStatsList) Swap(i, j int)
type PromptFunc ¶
PromptFunc obtains consent from the user for the given request string.
This function is used to provide the user some context through the provided string and then obtain a yes/no answer from the user.
func CLIPrompt ¶
CLIPrompt returns a PromptFunc to prompt user on CLI.
If user set environment NO_PROMPT=true, it will returns a nil PromptFunc In case of erroneous input from user, the returned PromptFunc prompts the user again. defaultResponse is returned on empty response from the user. In case of other system errors, the returned promptFunc returns false.
type SummaryResultsTable ¶
type SummaryResultsTable struct {
// contains filtered or unexported fields
}
SummaryResultsTable is used to print the summary of operations.
func NewSummaryResultsTable ¶
func NewSummaryResultsTable(cols []string) *SummaryResultsTable
NewSummaryResultsTable constructs a new SummaryResultsTable.
func (*SummaryResultsTable) IsSuccessForAny ¶
func (sRes *SummaryResultsTable) IsSuccessForAny(operation string) bool
IsSuccessForAny returns true if the operation succeeded for any of the entities.
func (*SummaryResultsTable) PrintResultsTable ¶
func (sRes *SummaryResultsTable) PrintResultsTable(out *os.File, fitWidth bool)
PrintResultsTable prints a summary table of the results of operations. Comments are truncated to fit terminal width if fitWidth is true. Doesn't truncate anything, if it results in comment becoming smaller than SummaryResultsMinCommentSize.
func (*SummaryResultsTable) RecordResult ¶
func (sRes *SummaryResultsTable) RecordResult(operation, entity string, res error)
RecordResult records the res for operation on entity.
func (*SummaryResultsTable) RecordSkip ¶
func (sRes *SummaryResultsTable) RecordSkip(operation, entity, reason string)
RecordSkip records an operation that was skipped.
type Updater ¶
type Updater struct {
// contains filtered or unexported fields
}
Updater is used to asynchronously update to datastore and write logs while doing so. This helps to save work and restart the application in case an update fails
func NewUpdater ¶
func NewUpdater(ctx context.Context, c fleetAPI.InventoryClient, gsc gs.Client, logDir, username string) (u *Updater, err error)
NewUpdater create a new updater
func (*Updater) AddAsset ¶
func (u *Updater) AddAsset(assetList []*fleet.ChopsAsset)
AddAsset asynchronously adds asset