Documentation
¶
Index ¶
- Constants
- func ArchString() string
- func CheckConnectivity(host string) error
- func ConvertToMB(value string, unit string) (uint64, error)
- func CopyMap(m1 map[string]interface{}, m2 map[string]interface{})
- func FirstN(n int, ss []string) []string
- func FormDockerImageName(domain, path, tag, digest string) string
- func FormOrgSpecUrl(url string, org string) string
- func FormattedTime() string
- func GenerateAgreementId() (string, error)
- func GetAllHostIPv4Addresses(interfaceFilters []NetFilter) ([]string, error)
- func GetCPUCount(cpuinfo_file string) (int, error)
- func GetMemInfo(meminfo_file string) (uint64, uint64, error)
- func IsIPv4(address string) bool
- func MakeMSInstanceKey(specRef string, org string, v string, id string) string
- func Maxuint64(first uint64, second uint64) uint64
- func Min(first int, second int) int
- func Minuint64(first uint64, second uint64) uint64
- func NativeToEnvVariableMap(envMap map[string]string, varName string, varValue interface{}) error
- func NormalizeURL(specRef string) string
- func OmitDown(i net.Interface) bool
- func OmitLoopback(i net.Interface) bool
- func OmitUp(i net.Interface) bool
- func ParseDockerImagePath(imagePath string) (domain, path, tag, digest string)
- func SecureRandomString() (string, error)
- func SetPlatformEnvvars(envAdds map[string]string, prefix string, agreementId string, deviceId string, ...)
- func SetSystemEnvvars(envAdds map[string]string, prefix string, lat string, lon string, cpus string, ...)
- func SliceContains(a []string, s string) bool
- func SplitOrgSpecUrl(org_url string) (string, string)
- func TimeInSeconds(timestamp string, format string) int64
- func TruncateDisplayString(s string, n int) string
- func VerifyWorkloadVarTypes(varValue interface{}, expectedType string) error
- type NetFilter
Constants ¶
const ( // Please do not change // they are used as error strings in api/path_service_config.go // they also used as templates for parsing the error strings in cli/register.go ANAX_SVC_MISSING_VARIABLE = "variable %v for service %v is missing from mappings." ANAX_SVC_MISSING_CONFIG = "service config for version %v of %v is missing." ANAX_SVC_WRONG_TYPE = "variable %v for service %v is " )
const ExchangeTimeFormat = "2006-01-02T15:04:05.999Z[MST]"
Exchange time format. Golang requires the format string to be in reference to the specific time as shown. This is so that the formatter and parser can figure out what goes where in the string.
Variables ¶
This section is empty.
Functions ¶
func ArchString ¶
func ArchString() string
func CheckConnectivity ¶
Check if the device has internect connection to the given host or not.
func ConvertToMB ¶
Converts the given number (in string) to mega bytes. The unit can be MB, KB, GB, or B.
func FormDockerImageName ¶
for the image from the items parsed from ParseDockerImagePath function
func FormOrgSpecUrl ¶
it returns the org/url form for an api spec
func FormattedTime ¶
func FormattedTime() string
func GenerateAgreementId ¶
func GetAllHostIPv4Addresses ¶
Interface filter functions return false if the interface should be filtered out.
func GetCPUCount ¶
Get the number of cpus on local node. If cpuinfo_file is an empty string, this function will get /proc/cpuinfo for Linux.
func GetMemInfo ¶
Get the total memory size and available memory size in MegaBytes If meminfo_file is an empty string, this function will get /proc/meminfo for Linux.
func MakeMSInstanceKey ¶
This is also used as the container name The container name must start with an alphanumeric character and can then use _ . or - in addition to alphanumeric. [a-zA-Z0-9][a-zA-Z0-9_.-]+
func NativeToEnvVariableMap ¶
Convert a native typed user input variable to a string so that the value can be passed as an environment variable to a container. This function modifies the input env var map and it will modify map keys that already exist in the map.
func NormalizeURL ¶
func OmitLoopback ¶
func ParseDockerImagePath ¶
This function parsed the given image name to disfferent parts. The image name has the following format: [[repo][:port]/][somedir/]image[:tag][@digest] If the image path as an improper form (we could not parse it), path will be empty. image names can be domain.com/dir/dir:tag or domain.com/dir/dir@sha256:ac88f4... or domain.com/dir/dir:tag@sha256:ac88f4...
func SecureRandomString ¶
func SetPlatformEnvvars ¶
func SetPlatformEnvvars(envAdds map[string]string, prefix string, agreementId string, deviceId string, org string, workloadPW string, exchangeURL string, pattern string, fssProtocol string, fssAddress string, fssPort string)
This function may seem simple but since it is shared with the hzn dev CLI, an update to it will cause a compile error in the CLI code. This will prevent us from adding a new platform env var but forgetting to update the CLI.
func SetSystemEnvvars ¶
func SetSystemEnvvars(envAdds map[string]string, prefix string, lat string, lon string, cpus string, ram string, arch string)
This function is similar to the above, for env vars that are system related. It is only used by workloads.
func SliceContains ¶
check if a slice contains a string
func SplitOrgSpecUrl ¶
The input is org/url, output is (org, url). assume no `/` in the org
func TimeInSeconds ¶
func TruncateDisplayString ¶
It will return the first n characters of the string and the rest will be as "..."
func VerifyWorkloadVarTypes ¶
This function checks the input variable value against the expected exchange variable type and returns an error if there is no match. This function assumes the varValue was parsed with json decoder set to UseNumber().