utils

package
v0.0.0-...-e560ebb Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2021 License: BSD-3-Clause Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExecuteRequest

func ExecuteRequest(ctx context.Context, hc *http.Client, req *http.Request, value proto.Message) error

func GetHostname

func GetHostname(d *lab.ChromeOSDevice) string

GetHostname returns the hostname of input ChromeOSDevice.

func GetLocation

func GetLocation(input string) (loc *fleet.Location)

GetLocation attempts to parse the input string and return a Location object. Default location is updated with values from the string. This is done because the barcodes do not specify the complete location of the asset

func GetMacHostMappingFromDHCPConf

func GetMacHostMappingFromDHCPConf(ctx context.Context) (map[string]string, error)

GetMacHostMappingFromDHCPConf downloads the dhcp conf from chromeos-admin repo. Parses the file and returns Mac:Hostname mapping

func SanitizeChopsAsset

func SanitizeChopsAsset(a []*ca.ChopsAsset) []*ca.ChopsAsset

SanitizeChopsAsset removes all the trailing and leading whitespaces in all ChopsAsset proto string fields in the input slice

Types

type HTTPError

type HTTPError struct {
	Method     string
	URL        *url.URL
	StatusCode int
	Body       string
}

HTTPError wraps the http response errors.

func (*HTTPError) Error

func (e *HTTPError) Error() string

Jump to

Keyboard shortcuts

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