repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
list
docstring
stringlengths
6
2.61k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
85
252
partition
stringclasses
1 value
muesli/beehive
bees/options.go
Bind
func (opts BeeOptions) Bind(name string, dst interface{}) error { v := opts.Value(name) if v == nil { return errors.New("Option with name " + name + " not found") } return ConvertValue(v, dst) }
go
func (opts BeeOptions) Bind(name string, dst interface{}) error { v := opts.Value(name) if v == nil { return errors.New("Option with name " + name + " not found") } return ConvertValue(v, dst) }
[ "func", "(", "opts", "BeeOptions", ")", "Bind", "(", "name", "string", ",", "dst", "interface", "{", "}", ")", "error", "{", "v", ":=", "opts", ".", "Value", "(", "name", ")", "\n", "if", "v", "==", "nil", "{", "return", "errors", ".", "New", "("...
// Bind a value from a BeeOptions slice.
[ "Bind", "a", "value", "from", "a", "BeeOptions", "slice", "." ]
4bfd4852e0b4bdcbc711323775cc7144ccd81b7e
https://github.com/muesli/beehive/blob/4bfd4852e0b4bdcbc711323775cc7144ccd81b7e/bees/options.go#L57-L64
train
muesli/beehive
bees/telegrambee/telegrambee.go
getAPIKey
func getAPIKey(options *bees.BeeOptions) string { var apiKey string options.Bind("api_key", &apiKey) if strings.HasPrefix(apiKey, "file://") { buf, err := ioutil.ReadFile(strings.TrimPrefix(apiKey, "file://")) if err != nil { panic("Error reading API key file " + apiKey) } apiKey = string(buf) } if st...
go
func getAPIKey(options *bees.BeeOptions) string { var apiKey string options.Bind("api_key", &apiKey) if strings.HasPrefix(apiKey, "file://") { buf, err := ioutil.ReadFile(strings.TrimPrefix(apiKey, "file://")) if err != nil { panic("Error reading API key file " + apiKey) } apiKey = string(buf) } if st...
[ "func", "getAPIKey", "(", "options", "*", "bees", ".", "BeeOptions", ")", "string", "{", "var", "apiKey", "string", "\n", "options", ".", "Bind", "(", "\"", "\"", ",", "&", "apiKey", ")", "\n\n", "if", "strings", ".", "HasPrefix", "(", "apiKey", ",", ...
// Gets the Bot's API key from a file, the recipe config or the // TELEGRAM_API_KEY environment variable.
[ "Gets", "the", "Bot", "s", "API", "key", "from", "a", "file", "the", "recipe", "config", "or", "the", "TELEGRAM_API_KEY", "environment", "variable", "." ]
4bfd4852e0b4bdcbc711323775cc7144ccd81b7e
https://github.com/muesli/beehive/blob/4bfd4852e0b4bdcbc711323775cc7144ccd81b7e/bees/telegrambee/telegrambee.go#L136-L154
train
muesli/beehive
bees/config.go
NewBeeConfig
func NewBeeConfig(name, class, description string, options BeeOptions) (BeeConfig, error) { if len(name) == 0 { return BeeConfig{}, errors.New("A Bee's name can't be empty") } b := GetBee(name) if b != nil { return BeeConfig{}, errors.New("A Bee with that name already exists") } f := GetFactory(class) if f...
go
func NewBeeConfig(name, class, description string, options BeeOptions) (BeeConfig, error) { if len(name) == 0 { return BeeConfig{}, errors.New("A Bee's name can't be empty") } b := GetBee(name) if b != nil { return BeeConfig{}, errors.New("A Bee with that name already exists") } f := GetFactory(class) if f...
[ "func", "NewBeeConfig", "(", "name", ",", "class", ",", "description", "string", ",", "options", "BeeOptions", ")", "(", "BeeConfig", ",", "error", ")", "{", "if", "len", "(", "name", ")", "==", "0", "{", "return", "BeeConfig", "{", "}", ",", "errors",...
// NewBeeConfig validates a configuration and sets up a new BeeConfig
[ "NewBeeConfig", "validates", "a", "configuration", "and", "sets", "up", "a", "new", "BeeConfig" ]
4bfd4852e0b4bdcbc711323775cc7144ccd81b7e
https://github.com/muesli/beehive/blob/4bfd4852e0b4bdcbc711323775cc7144ccd81b7e/bees/config.go#L35-L56
train
muesli/beehive
bees/config.go
BeeConfigs
func BeeConfigs() []BeeConfig { bs := []BeeConfig{} for _, b := range bees { bs = append(bs, (*b).Config()) } return bs }
go
func BeeConfigs() []BeeConfig { bs := []BeeConfig{} for _, b := range bees { bs = append(bs, (*b).Config()) } return bs }
[ "func", "BeeConfigs", "(", ")", "[", "]", "BeeConfig", "{", "bs", ":=", "[", "]", "BeeConfig", "{", "}", "\n", "for", "_", ",", "b", ":=", "range", "bees", "{", "bs", "=", "append", "(", "bs", ",", "(", "*", "b", ")", ".", "Config", "(", ")",...
// BeeConfigs returns configs for all Bees.
[ "BeeConfigs", "returns", "configs", "for", "all", "Bees", "." ]
4bfd4852e0b4bdcbc711323775cc7144ccd81b7e
https://github.com/muesli/beehive/blob/4bfd4852e0b4bdcbc711323775cc7144ccd81b7e/bees/config.go#L59-L66
train
muesli/beehive
bees/filters.go
execFilter
func execFilter(filter string, opts map[string]interface{}) bool { f := *filters.GetFilter("template") log.Println("\tExecuting filter:", filter) defer func() { if e := recover(); e != nil { log.Println("Fatal filter event:", e) } }() return f.Passes(opts, filter) }
go
func execFilter(filter string, opts map[string]interface{}) bool { f := *filters.GetFilter("template") log.Println("\tExecuting filter:", filter) defer func() { if e := recover(); e != nil { log.Println("Fatal filter event:", e) } }() return f.Passes(opts, filter) }
[ "func", "execFilter", "(", "filter", "string", ",", "opts", "map", "[", "string", "]", "interface", "{", "}", ")", "bool", "{", "f", ":=", "*", "filters", ".", "GetFilter", "(", "\"", "\"", ")", "\n", "log", ".", "Println", "(", "\"", "\\t", "\"", ...
// execFilter executes a filter. Returns whether the filter passed or not.
[ "execFilter", "executes", "a", "filter", ".", "Returns", "whether", "the", "filter", "passed", "or", "not", "." ]
4bfd4852e0b4bdcbc711323775cc7144ccd81b7e
https://github.com/muesli/beehive/blob/4bfd4852e0b4bdcbc711323775cc7144ccd81b7e/bees/filters.go#L38-L49
train
muesli/beehive
bees/openweathermapbee/event.go
TriggerWeatherInformationEvent
func (mod *OpenweathermapBee) TriggerWeatherInformationEvent(v *owm.Weather) { weather := bees.Event{ Bee: mod.Name(), Name: "main_weather", Options: []bees.Placeholder{ { Name: "id", Type: "int", Value: v.ID, }, { Name: "main", Type: "string", Value: v.Main, }, { ...
go
func (mod *OpenweathermapBee) TriggerWeatherInformationEvent(v *owm.Weather) { weather := bees.Event{ Bee: mod.Name(), Name: "main_weather", Options: []bees.Placeholder{ { Name: "id", Type: "int", Value: v.ID, }, { Name: "main", Type: "string", Value: v.Main, }, { ...
[ "func", "(", "mod", "*", "OpenweathermapBee", ")", "TriggerWeatherInformationEvent", "(", "v", "*", "owm", ".", "Weather", ")", "{", "weather", ":=", "bees", ".", "Event", "{", "Bee", ":", "mod", ".", "Name", "(", ")", ",", "Name", ":", "\"", "\"", "...
// WeatherInformationEvent triggers a weather event
[ "WeatherInformationEvent", "triggers", "a", "weather", "event" ]
4bfd4852e0b4bdcbc711323775cc7144ccd81b7e
https://github.com/muesli/beehive/blob/4bfd4852e0b4bdcbc711323775cc7144ccd81b7e/bees/openweathermapbee/event.go#L186-L214
train
muesli/beehive
filters/template/templatefilter.go
Passes
func (filter *TemplateFilter) Passes(data interface{}, value interface{}) bool { switch v := value.(type) { case string: var res bytes.Buffer if strings.Index(v, "{{test") >= 0 { v = strings.Replace(v, "{{test", "{{if", -1) v += "true{{end}}" } tmpl, err := template.New("_" + v).Funcs(templatehelper.F...
go
func (filter *TemplateFilter) Passes(data interface{}, value interface{}) bool { switch v := value.(type) { case string: var res bytes.Buffer if strings.Index(v, "{{test") >= 0 { v = strings.Replace(v, "{{test", "{{if", -1) v += "true{{end}}" } tmpl, err := template.New("_" + v).Funcs(templatehelper.F...
[ "func", "(", "filter", "*", "TemplateFilter", ")", "Passes", "(", "data", "interface", "{", "}", ",", "value", "interface", "{", "}", ")", "bool", "{", "switch", "v", ":=", "value", ".", "(", "type", ")", "{", "case", "string", ":", "var", "res", "...
// Passes returns true when the Filter matched the data.
[ "Passes", "returns", "true", "when", "the", "Filter", "matched", "the", "data", "." ]
4bfd4852e0b4bdcbc711323775cc7144ccd81b7e
https://github.com/muesli/beehive/blob/4bfd4852e0b4bdcbc711323775cc7144ccd81b7e/filters/template/templatefilter.go#L48-L70
train
muesli/beehive
api/resources/hives/hives_response.go
AddHive
func (r *HiveResponse) AddHive(hive *bees.BeeFactoryInterface) { r.hives[(*hive).Name()] = hive }
go
func (r *HiveResponse) AddHive(hive *bees.BeeFactoryInterface) { r.hives[(*hive).Name()] = hive }
[ "func", "(", "r", "*", "HiveResponse", ")", "AddHive", "(", "hive", "*", "bees", ".", "BeeFactoryInterface", ")", "{", "r", ".", "hives", "[", "(", "*", "hive", ")", ".", "Name", "(", ")", "]", "=", "hive", "\n", "}" ]
// AddHive adds a hive to the response
[ "AddHive", "adds", "a", "hive", "to", "the", "response" ]
4bfd4852e0b4bdcbc711323775cc7144ccd81b7e
https://github.com/muesli/beehive/blob/4bfd4852e0b4bdcbc711323775cc7144ccd81b7e/api/resources/hives/hives_response.go#L64-L66
train
muesli/beehive
api/resources/bees/bees_response.go
AddBee
func (r *BeeResponse) AddBee(bee *bees.BeeInterface) { r.bees[(*bee).Name()] = bee hive := bees.GetFactory((*bee).Namespace()) if hive == nil { panic("Hive for Bee not found") } r.hives[(*hive).Name()] = hive r.Hives = append(r.Hives, hives.PrepareHiveResponse(r.Context, hive)) }
go
func (r *BeeResponse) AddBee(bee *bees.BeeInterface) { r.bees[(*bee).Name()] = bee hive := bees.GetFactory((*bee).Namespace()) if hive == nil { panic("Hive for Bee not found") } r.hives[(*hive).Name()] = hive r.Hives = append(r.Hives, hives.PrepareHiveResponse(r.Context, hive)) }
[ "func", "(", "r", "*", "BeeResponse", ")", "AddBee", "(", "bee", "*", "bees", ".", "BeeInterface", ")", "{", "r", ".", "bees", "[", "(", "*", "bee", ")", ".", "Name", "(", ")", "]", "=", "bee", "\n\n", "hive", ":=", "bees", ".", "GetFactory", "...
// AddBee adds a bee to the response
[ "AddBee", "adds", "a", "bee", "to", "the", "response" ]
4bfd4852e0b4bdcbc711323775cc7144ccd81b7e
https://github.com/muesli/beehive/blob/4bfd4852e0b4bdcbc711323775cc7144ccd81b7e/api/resources/bees/bees_response.go#L66-L76
train
muesli/beehive
api/api.go
Run
func Run() { // to see what happens in the package, uncomment the following //restful.TraceLogger(log.New(os.Stdout, "[restful] ", log.LstdFlags|log.Lshortfile)) // Setup web-service smolderConfig := smolder.APIConfig{ BaseURL: canonicalURL, PathPrefix: "v1/", } context := &context.APIContext{ Config: s...
go
func Run() { // to see what happens in the package, uncomment the following //restful.TraceLogger(log.New(os.Stdout, "[restful] ", log.LstdFlags|log.Lshortfile)) // Setup web-service smolderConfig := smolder.APIConfig{ BaseURL: canonicalURL, PathPrefix: "v1/", } context := &context.APIContext{ Config: s...
[ "func", "Run", "(", ")", "{", "// to see what happens in the package, uncomment the following", "//restful.TraceLogger(log.New(os.Stdout, \"[restful] \", log.LstdFlags|log.Lshortfile))", "// Setup web-service", "smolderConfig", ":=", "smolder", ".", "APIConfig", "{", "BaseURL", ":", ...
// Run sets up the restful API container and an HTTP server go-routine
[ "Run", "sets", "up", "the", "restful", "API", "container", "and", "an", "HTTP", "server", "go", "-", "routine" ]
4bfd4852e0b4bdcbc711323775cc7144ccd81b7e
https://github.com/muesli/beehive/blob/4bfd4852e0b4bdcbc711323775cc7144ccd81b7e/api/api.go#L164-L202
train
muesli/beehive
bees/cronbee/cron/crontime.go
DurationUntilNextEvent
func (c *crontime) DurationUntilNextEvent() time.Duration { return c.nextEvent().Sub(time.Now()) }
go
func (c *crontime) DurationUntilNextEvent() time.Duration { return c.nextEvent().Sub(time.Now()) }
[ "func", "(", "c", "*", "crontime", ")", "DurationUntilNextEvent", "(", ")", "time", ".", "Duration", "{", "return", "c", ".", "nextEvent", "(", ")", ".", "Sub", "(", "time", ".", "Now", "(", ")", ")", "\n", "}" ]
// Returns the time.Duration until the next event.
[ "Returns", "the", "time", ".", "Duration", "until", "the", "next", "event", "." ]
4bfd4852e0b4bdcbc711323775cc7144ccd81b7e
https://github.com/muesli/beehive/blob/4bfd4852e0b4bdcbc711323775cc7144ccd81b7e/bees/cronbee/cron/crontime.go#L52-L54
train
muesli/beehive
bees/cronbee/cron/crontime.go
calculateEvent
func (c *crontime) calculateEvent(baseTime time.Time) time.Time { c.calculationInProgress = true defer c.setCalculationInProgress(false) baseTime = setNanoecond(baseTime, 10000) c.calculatedTime = baseTime // Ignore all Events in the Past & initial 'result' //c.calculatedTime = setNanoecond(c.calculatedTime, 10000...
go
func (c *crontime) calculateEvent(baseTime time.Time) time.Time { c.calculationInProgress = true defer c.setCalculationInProgress(false) baseTime = setNanoecond(baseTime, 10000) c.calculatedTime = baseTime // Ignore all Events in the Past & initial 'result' //c.calculatedTime = setNanoecond(c.calculatedTime, 10000...
[ "func", "(", "c", "*", "crontime", ")", "calculateEvent", "(", "baseTime", "time", ".", "Time", ")", "time", ".", "Time", "{", "c", ".", "calculationInProgress", "=", "true", "\n", "defer", "c", ".", "setCalculationInProgress", "(", "false", ")", "\n", "...
// This functions calculates the next event
[ "This", "functions", "calculates", "the", "next", "event" ]
4bfd4852e0b4bdcbc711323775cc7144ccd81b7e
https://github.com/muesli/beehive/blob/4bfd4852e0b4bdcbc711323775cc7144ccd81b7e/bees/cronbee/cron/crontime.go#L93-L106
train
muesli/beehive
bees/cronbee/cron/crontime.go
nextValidMonth
func (c *crontime) nextValidMonth(baseTime time.Time) { for _, mon := range c.month { if mon >= int(c.calculatedTime.Month()) { //log.Print("Inside Month", mon, c.calculatedTime) c.calculatedTime = setMonth(c.calculatedTime, mon) //log.Println(" :: and out", c.calculatedTime) return } } // If no resu...
go
func (c *crontime) nextValidMonth(baseTime time.Time) { for _, mon := range c.month { if mon >= int(c.calculatedTime.Month()) { //log.Print("Inside Month", mon, c.calculatedTime) c.calculatedTime = setMonth(c.calculatedTime, mon) //log.Println(" :: and out", c.calculatedTime) return } } // If no resu...
[ "func", "(", "c", "*", "crontime", ")", "nextValidMonth", "(", "baseTime", "time", ".", "Time", ")", "{", "for", "_", ",", "mon", ":=", "range", "c", ".", "month", "{", "if", "mon", ">=", "int", "(", "c", ".", "calculatedTime", ".", "Month", "(", ...
// Calculates the next valid Month based upon the previous results.
[ "Calculates", "the", "next", "valid", "Month", "based", "upon", "the", "previous", "results", "." ]
4bfd4852e0b4bdcbc711323775cc7144ccd81b7e
https://github.com/muesli/beehive/blob/4bfd4852e0b4bdcbc711323775cc7144ccd81b7e/bees/cronbee/cron/crontime.go#L109-L123
train
muesli/beehive
bees/cronbee/cron/crontime.go
nextValidDay
func (c *crontime) nextValidDay(baseTime time.Time) { for _, dom := range c.dom { if dom >= c.calculatedTime.Day() { for _, dow := range c.dow { if monthHasDow(dow, dom, int(c.calculatedTime.Month()), c.calculatedTime.Year()) { c.calculatedTime = setDay(c.calculatedTime, dom) //log.Println("Cronbee:...
go
func (c *crontime) nextValidDay(baseTime time.Time) { for _, dom := range c.dom { if dom >= c.calculatedTime.Day() { for _, dow := range c.dow { if monthHasDow(dow, dom, int(c.calculatedTime.Month()), c.calculatedTime.Year()) { c.calculatedTime = setDay(c.calculatedTime, dom) //log.Println("Cronbee:...
[ "func", "(", "c", "*", "crontime", ")", "nextValidDay", "(", "baseTime", "time", ".", "Time", ")", "{", "for", "_", ",", "dom", ":=", "range", "c", ".", "dom", "{", "if", "dom", ">=", "c", ".", "calculatedTime", ".", "Day", "(", ")", "{", "for", ...
// Calculates the next valid Day based upon the previous results.
[ "Calculates", "the", "next", "valid", "Day", "based", "upon", "the", "previous", "results", "." ]
4bfd4852e0b4bdcbc711323775cc7144ccd81b7e
https://github.com/muesli/beehive/blob/4bfd4852e0b4bdcbc711323775cc7144ccd81b7e/bees/cronbee/cron/crontime.go#L126-L152
train
muesli/beehive
bees/cronbee/cron/crontime.go
nextValidHour
func (c *crontime) nextValidHour(baseTime time.Time) { for _, hour := range c.hour { if c.calculatedTime.Day() == baseTime.Day() { if !hasPassed(hour, c.calculatedTime.Hour()) { c.calculatedTime = setHour(c.calculatedTime, hour) return } } else { c.calculatedTime = setHour(c.calculatedTime, hour) ...
go
func (c *crontime) nextValidHour(baseTime time.Time) { for _, hour := range c.hour { if c.calculatedTime.Day() == baseTime.Day() { if !hasPassed(hour, c.calculatedTime.Hour()) { c.calculatedTime = setHour(c.calculatedTime, hour) return } } else { c.calculatedTime = setHour(c.calculatedTime, hour) ...
[ "func", "(", "c", "*", "crontime", ")", "nextValidHour", "(", "baseTime", "time", ".", "Time", ")", "{", "for", "_", ",", "hour", ":=", "range", "c", ".", "hour", "{", "if", "c", ".", "calculatedTime", ".", "Day", "(", ")", "==", "baseTime", ".", ...
// Calculates the next valid Hour based upon the previous results.
[ "Calculates", "the", "next", "valid", "Hour", "based", "upon", "the", "previous", "results", "." ]
4bfd4852e0b4bdcbc711323775cc7144ccd81b7e
https://github.com/muesli/beehive/blob/4bfd4852e0b4bdcbc711323775cc7144ccd81b7e/bees/cronbee/cron/crontime.go#L155-L174
train
muesli/beehive
bees/cronbee/cron/crontime.go
nextValidMinute
func (c *crontime) nextValidMinute(baseTime time.Time) { for _, min := range c.minute { if c.calculatedTime.Hour() == baseTime.Hour() { if !hasPassed(min, c.calculatedTime.Minute()) { c.calculatedTime = setMinute(c.calculatedTime, min) return } } else { c.calculatedTime = setMinute(c.calculatedTim...
go
func (c *crontime) nextValidMinute(baseTime time.Time) { for _, min := range c.minute { if c.calculatedTime.Hour() == baseTime.Hour() { if !hasPassed(min, c.calculatedTime.Minute()) { c.calculatedTime = setMinute(c.calculatedTime, min) return } } else { c.calculatedTime = setMinute(c.calculatedTim...
[ "func", "(", "c", "*", "crontime", ")", "nextValidMinute", "(", "baseTime", "time", ".", "Time", ")", "{", "for", "_", ",", "min", ":=", "range", "c", ".", "minute", "{", "if", "c", ".", "calculatedTime", ".", "Hour", "(", ")", "==", "baseTime", "....
// Calculates the next valid Minute based upon the previous results.
[ "Calculates", "the", "next", "valid", "Minute", "based", "upon", "the", "previous", "results", "." ]
4bfd4852e0b4bdcbc711323775cc7144ccd81b7e
https://github.com/muesli/beehive/blob/4bfd4852e0b4bdcbc711323775cc7144ccd81b7e/bees/cronbee/cron/crontime.go#L177-L194
train
muesli/beehive
bees/cronbee/cron/crontime.go
nextValidSecond
func (c *crontime) nextValidSecond(baseTime time.Time) { for _, sec := range c.second { if !c.minuteHasPassed(baseTime) { // check if sec is in the past. <= prevents triggering the same event twice if sec > c.calculatedTime.Second() { c.calculatedTime = setSecond(c.calculatedTime, sec) return } } ...
go
func (c *crontime) nextValidSecond(baseTime time.Time) { for _, sec := range c.second { if !c.minuteHasPassed(baseTime) { // check if sec is in the past. <= prevents triggering the same event twice if sec > c.calculatedTime.Second() { c.calculatedTime = setSecond(c.calculatedTime, sec) return } } ...
[ "func", "(", "c", "*", "crontime", ")", "nextValidSecond", "(", "baseTime", "time", ".", "Time", ")", "{", "for", "_", ",", "sec", ":=", "range", "c", ".", "second", "{", "if", "!", "c", ".", "minuteHasPassed", "(", "baseTime", ")", "{", "// check if...
// Calculates the next valid Second based upon the previous results.
[ "Calculates", "the", "next", "valid", "Second", "based", "upon", "the", "previous", "results", "." ]
4bfd4852e0b4bdcbc711323775cc7144ccd81b7e
https://github.com/muesli/beehive/blob/4bfd4852e0b4bdcbc711323775cc7144ccd81b7e/bees/cronbee/cron/crontime.go#L197-L215
train
muesli/beehive
bees/factories.go
GetFactory
func GetFactory(identifier string) *BeeFactoryInterface { factory, ok := factories[identifier] if ok { return factory } return nil }
go
func GetFactory(identifier string) *BeeFactoryInterface { factory, ok := factories[identifier] if ok { return factory } return nil }
[ "func", "GetFactory", "(", "identifier", "string", ")", "*", "BeeFactoryInterface", "{", "factory", ",", "ok", ":=", "factories", "[", "identifier", "]", "\n", "if", "ok", "{", "return", "factory", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
// GetFactory returns the factory with a specific name.
[ "GetFactory", "returns", "the", "factory", "with", "a", "specific", "name", "." ]
4bfd4852e0b4bdcbc711323775cc7144ccd81b7e
https://github.com/muesli/beehive/blob/4bfd4852e0b4bdcbc711323775cc7144ccd81b7e/bees/factories.go#L118-L125
train
muesli/beehive
bees/factories.go
GetFactories
func GetFactories() []*BeeFactoryInterface { r := []*BeeFactoryInterface{} for _, factory := range factories { r = append(r, factory) } return r }
go
func GetFactories() []*BeeFactoryInterface { r := []*BeeFactoryInterface{} for _, factory := range factories { r = append(r, factory) } return r }
[ "func", "GetFactories", "(", ")", "[", "]", "*", "BeeFactoryInterface", "{", "r", ":=", "[", "]", "*", "BeeFactoryInterface", "{", "}", "\n", "for", "_", ",", "factory", ":=", "range", "factories", "{", "r", "=", "append", "(", "r", ",", "factory", "...
// GetFactories returns all known bee factories.
[ "GetFactories", "returns", "all", "known", "bee", "factories", "." ]
4bfd4852e0b4bdcbc711323775cc7144ccd81b7e
https://github.com/muesli/beehive/blob/4bfd4852e0b4bdcbc711323775cc7144ccd81b7e/bees/factories.go#L128-L135
train
muesli/beehive
bees/chains.go
GetChain
func GetChain(id string) *Chain { for _, c := range chains { if c.Name == id { return &c } } return nil }
go
func GetChain(id string) *Chain { for _, c := range chains { if c.Name == id { return &c } } return nil }
[ "func", "GetChain", "(", "id", "string", ")", "*", "Chain", "{", "for", "_", ",", "c", ":=", "range", "chains", "{", "if", "c", ".", "Name", "==", "id", "{", "return", "&", "c", "\n", "}", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
// GetChain returns a chain with a specific id
[ "GetChain", "returns", "a", "chain", "with", "a", "specific", "id" ]
4bfd4852e0b4bdcbc711323775cc7144ccd81b7e
https://github.com/muesli/beehive/blob/4bfd4852e0b4bdcbc711323775cc7144ccd81b7e/bees/chains.go#L52-L60
train
muesli/beehive
bees/chains.go
SetChains
func SetChains(cs []Chain) { newcs := []Chain{} // migrate old chain style for _, c := range cs { for _, el := range c.Elements { if el.Action.Name != "" { el.Action.ID = UUID() c.Actions = append(c.Actions, el.Action.ID) actions = append(actions, el.Action) } if el.Filter.Name != "" { //F...
go
func SetChains(cs []Chain) { newcs := []Chain{} // migrate old chain style for _, c := range cs { for _, el := range c.Elements { if el.Action.Name != "" { el.Action.ID = UUID() c.Actions = append(c.Actions, el.Action.ID) actions = append(actions, el.Action) } if el.Filter.Name != "" { //F...
[ "func", "SetChains", "(", "cs", "[", "]", "Chain", ")", "{", "newcs", ":=", "[", "]", "Chain", "{", "}", "\n", "// migrate old chain style", "for", "_", ",", "c", ":=", "range", "cs", "{", "for", "_", ",", "el", ":=", "range", "c", ".", "Elements",...
// SetChains sets the currently configured chains
[ "SetChains", "sets", "the", "currently", "configured", "chains" ]
4bfd4852e0b4bdcbc711323775cc7144ccd81b7e
https://github.com/muesli/beehive/blob/4bfd4852e0b4bdcbc711323775cc7144ccd81b7e/bees/chains.go#L63-L84
train
muesli/beehive
bees/chains.go
execChains
func execChains(event *Event) { for _, c := range chains { if c.Event.Name != event.Name || c.Event.Bee != event.Bee { continue } m := make(map[string]interface{}) for _, opt := range event.Options { m[opt.Name] = opt.Value } ctx.FillMap(m) failed := false log.Println("Executing chain:", c.Name...
go
func execChains(event *Event) { for _, c := range chains { if c.Event.Name != event.Name || c.Event.Bee != event.Bee { continue } m := make(map[string]interface{}) for _, opt := range event.Options { m[opt.Name] = opt.Value } ctx.FillMap(m) failed := false log.Println("Executing chain:", c.Name...
[ "func", "execChains", "(", "event", "*", "Event", ")", "{", "for", "_", ",", "c", ":=", "range", "chains", "{", "if", "c", ".", "Event", ".", "Name", "!=", "event", ".", "Name", "||", "c", ".", "Event", ".", "Bee", "!=", "event", ".", "Bee", "{...
// execChains executes chains for an event we received
[ "execChains", "executes", "chains", "for", "an", "event", "we", "received" ]
4bfd4852e0b4bdcbc711323775cc7144ccd81b7e
https://github.com/muesli/beehive/blob/4bfd4852e0b4bdcbc711323775cc7144ccd81b7e/bees/chains.go#L87-L123
train
muesli/beehive
app/app.go
AddFlags
func AddFlags(flags []CliFlag) { for _, flag := range flags { appflags = append(appflags, flag) } }
go
func AddFlags(flags []CliFlag) { for _, flag := range flags { appflags = append(appflags, flag) } }
[ "func", "AddFlags", "(", "flags", "[", "]", "CliFlag", ")", "{", "for", "_", ",", "flag", ":=", "range", "flags", "{", "appflags", "=", "append", "(", "appflags", ",", "flag", ")", "\n", "}", "\n", "}" ]
// AddFlags adds CliFlags to appflags
[ "AddFlags", "adds", "CliFlags", "to", "appflags" ]
4bfd4852e0b4bdcbc711323775cc7144ccd81b7e
https://github.com/muesli/beehive/blob/4bfd4852e0b4bdcbc711323775cc7144ccd81b7e/app/app.go#L42-L46
train
muesli/beehive
app/app.go
Run
func Run() { for _, f := range appflags { switch f.Value.(type) { case string: flag.StringVar((f.V).(*string), f.Name, f.Value.(string), f.Desc) case bool: flag.BoolVar((f.V).(*bool), f.Name, f.Value.(bool), f.Desc) } } flag.Parse() }
go
func Run() { for _, f := range appflags { switch f.Value.(type) { case string: flag.StringVar((f.V).(*string), f.Name, f.Value.(string), f.Desc) case bool: flag.BoolVar((f.V).(*bool), f.Name, f.Value.(bool), f.Desc) } } flag.Parse() }
[ "func", "Run", "(", ")", "{", "for", "_", ",", "f", ":=", "range", "appflags", "{", "switch", "f", ".", "Value", ".", "(", "type", ")", "{", "case", "string", ":", "flag", ".", "StringVar", "(", "(", "f", ".", "V", ")", ".", "(", "*", "string...
// Run sets up all the cli-param mappings
[ "Run", "sets", "up", "all", "the", "cli", "-", "param", "mappings" ]
4bfd4852e0b4bdcbc711323775cc7144ccd81b7e
https://github.com/muesli/beehive/blob/4bfd4852e0b4bdcbc711323775cc7144ccd81b7e/app/app.go#L49-L60
train
muesli/beehive
beehive.go
loadConfig
func loadConfig() Config { config := Config{} j, err := ioutil.ReadFile(configFile) if err == nil { err = json.Unmarshal(j, &config) if err != nil { log.Fatal("Error parsing config file: ", err) } } return config }
go
func loadConfig() Config { config := Config{} j, err := ioutil.ReadFile(configFile) if err == nil { err = json.Unmarshal(j, &config) if err != nil { log.Fatal("Error parsing config file: ", err) } } return config }
[ "func", "loadConfig", "(", ")", "Config", "{", "config", ":=", "Config", "{", "}", "\n\n", "j", ",", "err", ":=", "ioutil", ".", "ReadFile", "(", "configFile", ")", "\n", "if", "err", "==", "nil", "{", "err", "=", "json", ".", "Unmarshal", "(", "j"...
// Loads chains from config
[ "Loads", "chains", "from", "config" ]
4bfd4852e0b4bdcbc711323775cc7144ccd81b7e
https://github.com/muesli/beehive/blob/4bfd4852e0b4bdcbc711323775cc7144ccd81b7e/beehive.go#L58-L70
train
muesli/beehive
beehive.go
saveConfig
func saveConfig(c Config) { j, err := json.MarshalIndent(c, "", " ") if err == nil { err = ioutil.WriteFile(configFile, j, 0644) } if err != nil { log.Fatal(err) } }
go
func saveConfig(c Config) { j, err := json.MarshalIndent(c, "", " ") if err == nil { err = ioutil.WriteFile(configFile, j, 0644) } if err != nil { log.Fatal(err) } }
[ "func", "saveConfig", "(", "c", "Config", ")", "{", "j", ",", "err", ":=", "json", ".", "MarshalIndent", "(", "c", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "if", "err", "==", "nil", "{", "err", "=", "ioutil", ".", "WriteFile", "(", "configFil...
// Saves chains to config
[ "Saves", "chains", "to", "config" ]
4bfd4852e0b4bdcbc711323775cc7144ccd81b7e
https://github.com/muesli/beehive/blob/4bfd4852e0b4bdcbc711323775cc7144ccd81b7e/beehive.go#L73-L82
train
stretchr/testify
mock/mock.go
Maybe
func (c *Call) Maybe() *Call { c.lock() defer c.unlock() c.optional = true return c }
go
func (c *Call) Maybe() *Call { c.lock() defer c.unlock() c.optional = true return c }
[ "func", "(", "c", "*", "Call", ")", "Maybe", "(", ")", "*", "Call", "{", "c", ".", "lock", "(", ")", "\n", "defer", "c", ".", "unlock", "(", ")", "\n", "c", ".", "optional", "=", "true", "\n", "return", "c", "\n", "}" ]
// Maybe allows the method call to be optional. Not calling an optional method // will not cause an error while asserting expectations
[ "Maybe", "allows", "the", "method", "call", "to", "be", "optional", ".", "Not", "calling", "an", "optional", "method", "will", "not", "cause", "an", "error", "while", "asserting", "expectations" ]
34c6fa2dc70986bccbbffcc6130f6920a924b075
https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/mock/mock.go#L166-L171
train
stretchr/testify
mock/mock.go
fail
func (m *Mock) fail(format string, args ...interface{}) { m.mutex.Lock() defer m.mutex.Unlock() if m.test == nil { panic(fmt.Sprintf(format, args...)) } m.test.Errorf(format, args...) m.test.FailNow() }
go
func (m *Mock) fail(format string, args ...interface{}) { m.mutex.Lock() defer m.mutex.Unlock() if m.test == nil { panic(fmt.Sprintf(format, args...)) } m.test.Errorf(format, args...) m.test.FailNow() }
[ "func", "(", "m", "*", "Mock", ")", "fail", "(", "format", "string", ",", "args", "...", "interface", "{", "}", ")", "{", "m", ".", "mutex", ".", "Lock", "(", ")", "\n", "defer", "m", ".", "mutex", ".", "Unlock", "(", ")", "\n\n", "if", "m", ...
// fail fails the current test with the given formatted format and args. // In case that a test was defined, it uses the test APIs for failing a test, // otherwise it uses panic.
[ "fail", "fails", "the", "current", "test", "with", "the", "given", "formatted", "format", "and", "args", ".", "In", "case", "that", "a", "test", "was", "defined", "it", "uses", "the", "test", "APIs", "for", "failing", "a", "test", "otherwise", "it", "use...
34c6fa2dc70986bccbbffcc6130f6920a924b075
https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/mock/mock.go#L231-L240
train
stretchr/testify
mock/mock.go
AssertExpectationsForObjects
func AssertExpectationsForObjects(t TestingT, testObjects ...interface{}) bool { if h, ok := t.(tHelper); ok { h.Helper() } for _, obj := range testObjects { if m, ok := obj.(Mock); ok { t.Logf("Deprecated mock.AssertExpectationsForObjects(myMock.Mock) use mock.AssertExpectationsForObjects(myMock)") obj = ...
go
func AssertExpectationsForObjects(t TestingT, testObjects ...interface{}) bool { if h, ok := t.(tHelper); ok { h.Helper() } for _, obj := range testObjects { if m, ok := obj.(Mock); ok { t.Logf("Deprecated mock.AssertExpectationsForObjects(myMock.Mock) use mock.AssertExpectationsForObjects(myMock)") obj = ...
[ "func", "AssertExpectationsForObjects", "(", "t", "TestingT", ",", "testObjects", "...", "interface", "{", "}", ")", "bool", "{", "if", "h", ",", "ok", ":=", "t", ".", "(", "tHelper", ")", ";", "ok", "{", "h", ".", "Helper", "(", ")", "\n", "}", "\...
// AssertExpectationsForObjects asserts that everything specified with On and Return // of the specified objects was in fact called as expected. // // Calls may have occurred in any order.
[ "AssertExpectationsForObjects", "asserts", "that", "everything", "specified", "with", "On", "and", "Return", "of", "the", "specified", "objects", "was", "in", "fact", "called", "as", "expected", ".", "Calls", "may", "have", "occurred", "in", "any", "order", "." ...
34c6fa2dc70986bccbbffcc6130f6920a924b075
https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/mock/mock.go#L414-L430
train
stretchr/testify
mock/mock.go
AssertExpectations
func (m *Mock) AssertExpectations(t TestingT) bool { if h, ok := t.(tHelper); ok { h.Helper() } m.mutex.Lock() defer m.mutex.Unlock() var somethingMissing bool var failedExpectations int // iterate through each expectation expectedCalls := m.expectedCalls() for _, expectedCall := range expectedCalls { if ...
go
func (m *Mock) AssertExpectations(t TestingT) bool { if h, ok := t.(tHelper); ok { h.Helper() } m.mutex.Lock() defer m.mutex.Unlock() var somethingMissing bool var failedExpectations int // iterate through each expectation expectedCalls := m.expectedCalls() for _, expectedCall := range expectedCalls { if ...
[ "func", "(", "m", "*", "Mock", ")", "AssertExpectations", "(", "t", "TestingT", ")", "bool", "{", "if", "h", ",", "ok", ":=", "t", ".", "(", "tHelper", ")", ";", "ok", "{", "h", ".", "Helper", "(", ")", "\n", "}", "\n", "m", ".", "mutex", "."...
// AssertExpectations asserts that everything specified with On and Return was // in fact called as expected. Calls may have occurred in any order.
[ "AssertExpectations", "asserts", "that", "everything", "specified", "with", "On", "and", "Return", "was", "in", "fact", "called", "as", "expected", ".", "Calls", "may", "have", "occurred", "in", "any", "order", "." ]
34c6fa2dc70986bccbbffcc6130f6920a924b075
https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/mock/mock.go#L434-L466
train
stretchr/testify
mock/mock.go
AssertNumberOfCalls
func (m *Mock) AssertNumberOfCalls(t TestingT, methodName string, expectedCalls int) bool { if h, ok := t.(tHelper); ok { h.Helper() } m.mutex.Lock() defer m.mutex.Unlock() var actualCalls int for _, call := range m.calls() { if call.Method == methodName { actualCalls++ } } return assert.Equal(t, expec...
go
func (m *Mock) AssertNumberOfCalls(t TestingT, methodName string, expectedCalls int) bool { if h, ok := t.(tHelper); ok { h.Helper() } m.mutex.Lock() defer m.mutex.Unlock() var actualCalls int for _, call := range m.calls() { if call.Method == methodName { actualCalls++ } } return assert.Equal(t, expec...
[ "func", "(", "m", "*", "Mock", ")", "AssertNumberOfCalls", "(", "t", "TestingT", ",", "methodName", "string", ",", "expectedCalls", "int", ")", "bool", "{", "if", "h", ",", "ok", ":=", "t", ".", "(", "tHelper", ")", ";", "ok", "{", "h", ".", "Helpe...
// AssertNumberOfCalls asserts that the method was called expectedCalls times.
[ "AssertNumberOfCalls", "asserts", "that", "the", "method", "was", "called", "expectedCalls", "times", "." ]
34c6fa2dc70986bccbbffcc6130f6920a924b075
https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/mock/mock.go#L469-L482
train
stretchr/testify
mock/mock.go
AssertCalled
func (m *Mock) AssertCalled(t TestingT, methodName string, arguments ...interface{}) bool { if h, ok := t.(tHelper); ok { h.Helper() } m.mutex.Lock() defer m.mutex.Unlock() if !m.methodWasCalled(methodName, arguments) { var calledWithArgs []string for _, call := range m.calls() { calledWithArgs = append(c...
go
func (m *Mock) AssertCalled(t TestingT, methodName string, arguments ...interface{}) bool { if h, ok := t.(tHelper); ok { h.Helper() } m.mutex.Lock() defer m.mutex.Unlock() if !m.methodWasCalled(methodName, arguments) { var calledWithArgs []string for _, call := range m.calls() { calledWithArgs = append(c...
[ "func", "(", "m", "*", "Mock", ")", "AssertCalled", "(", "t", "TestingT", ",", "methodName", "string", ",", "arguments", "...", "interface", "{", "}", ")", "bool", "{", "if", "h", ",", "ok", ":=", "t", ".", "(", "tHelper", ")", ";", "ok", "{", "h...
// AssertCalled asserts that the method was called. // It can produce a false result when an argument is a pointer type and the underlying value changed after calling the mocked method.
[ "AssertCalled", "asserts", "that", "the", "method", "was", "called", ".", "It", "can", "produce", "a", "false", "result", "when", "an", "argument", "is", "a", "pointer", "type", "and", "the", "underlying", "value", "changed", "after", "calling", "the", "mock...
34c6fa2dc70986bccbbffcc6130f6920a924b075
https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/mock/mock.go#L486-L505
train
stretchr/testify
mock/mock.go
AssertNotCalled
func (m *Mock) AssertNotCalled(t TestingT, methodName string, arguments ...interface{}) bool { if h, ok := t.(tHelper); ok { h.Helper() } m.mutex.Lock() defer m.mutex.Unlock() if m.methodWasCalled(methodName, arguments) { return assert.Fail(t, "Should not have called with given arguments", fmt.Sprintf("Expe...
go
func (m *Mock) AssertNotCalled(t TestingT, methodName string, arguments ...interface{}) bool { if h, ok := t.(tHelper); ok { h.Helper() } m.mutex.Lock() defer m.mutex.Unlock() if m.methodWasCalled(methodName, arguments) { return assert.Fail(t, "Should not have called with given arguments", fmt.Sprintf("Expe...
[ "func", "(", "m", "*", "Mock", ")", "AssertNotCalled", "(", "t", "TestingT", ",", "methodName", "string", ",", "arguments", "...", "interface", "{", "}", ")", "bool", "{", "if", "h", ",", "ok", ":=", "t", ".", "(", "tHelper", ")", ";", "ok", "{", ...
// AssertNotCalled asserts that the method was not called. // It can produce a false result when an argument is a pointer type and the underlying value changed after calling the mocked method.
[ "AssertNotCalled", "asserts", "that", "the", "method", "was", "not", "called", ".", "It", "can", "produce", "a", "false", "result", "when", "an", "argument", "is", "a", "pointer", "type", "and", "the", "underlying", "value", "changed", "after", "calling", "t...
34c6fa2dc70986bccbbffcc6130f6920a924b075
https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/mock/mock.go#L509-L520
train
stretchr/testify
mock/mock.go
Get
func (args Arguments) Get(index int) interface{} { if index+1 > len(args) { panic(fmt.Sprintf("assert: arguments: Cannot call Get(%d) because there are %d argument(s).", index, len(args))) } return args[index] }
go
func (args Arguments) Get(index int) interface{} { if index+1 > len(args) { panic(fmt.Sprintf("assert: arguments: Cannot call Get(%d) because there are %d argument(s).", index, len(args))) } return args[index] }
[ "func", "(", "args", "Arguments", ")", "Get", "(", "index", "int", ")", "interface", "{", "}", "{", "if", "index", "+", "1", ">", "len", "(", "args", ")", "{", "panic", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "index", ",", "len", "(",...
// Get Returns the argument at the specified index.
[ "Get", "Returns", "the", "argument", "at", "the", "specified", "index", "." ]
34c6fa2dc70986bccbbffcc6130f6920a924b075
https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/mock/mock.go#L638-L643
train
stretchr/testify
mock/mock.go
Is
func (args Arguments) Is(objects ...interface{}) bool { for i, obj := range args { if obj != objects[i] { return false } } return true }
go
func (args Arguments) Is(objects ...interface{}) bool { for i, obj := range args { if obj != objects[i] { return false } } return true }
[ "func", "(", "args", "Arguments", ")", "Is", "(", "objects", "...", "interface", "{", "}", ")", "bool", "{", "for", "i", ",", "obj", ":=", "range", "args", "{", "if", "obj", "!=", "objects", "[", "i", "]", "{", "return", "false", "\n", "}", "\n",...
// Is gets whether the objects match the arguments specified.
[ "Is", "gets", "whether", "the", "objects", "match", "the", "arguments", "specified", "." ]
34c6fa2dc70986bccbbffcc6130f6920a924b075
https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/mock/mock.go#L646-L653
train
stretchr/testify
mock/mock.go
Diff
func (args Arguments) Diff(objects []interface{}) (string, int) { //TODO: could return string as error and nil for No difference var output = "\n" var differences int var maxArgCount = len(args) if len(objects) > maxArgCount { maxArgCount = len(objects) } for i := 0; i < maxArgCount; i++ { var actual, exp...
go
func (args Arguments) Diff(objects []interface{}) (string, int) { //TODO: could return string as error and nil for No difference var output = "\n" var differences int var maxArgCount = len(args) if len(objects) > maxArgCount { maxArgCount = len(objects) } for i := 0; i < maxArgCount; i++ { var actual, exp...
[ "func", "(", "args", "Arguments", ")", "Diff", "(", "objects", "[", "]", "interface", "{", "}", ")", "(", "string", ",", "int", ")", "{", "//TODO: could return string as error and nil for No difference", "var", "output", "=", "\"", "\\n", "\"", "\n", "var", ...
// Diff gets a string describing the differences between the arguments // and the specified objects. // // Returns the diff string and number of differences found.
[ "Diff", "gets", "a", "string", "describing", "the", "differences", "between", "the", "arguments", "and", "the", "specified", "objects", ".", "Returns", "the", "diff", "string", "and", "number", "of", "differences", "found", "." ]
34c6fa2dc70986bccbbffcc6130f6920a924b075
https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/mock/mock.go#L659-L728
train
stretchr/testify
mock/mock.go
Assert
func (args Arguments) Assert(t TestingT, objects ...interface{}) bool { if h, ok := t.(tHelper); ok { h.Helper() } // get the differences diff, diffCount := args.Diff(objects) if diffCount == 0 { return true } // there are differences... report them... t.Logf(diff) t.Errorf("%sArguments do not match.", ...
go
func (args Arguments) Assert(t TestingT, objects ...interface{}) bool { if h, ok := t.(tHelper); ok { h.Helper() } // get the differences diff, diffCount := args.Diff(objects) if diffCount == 0 { return true } // there are differences... report them... t.Logf(diff) t.Errorf("%sArguments do not match.", ...
[ "func", "(", "args", "Arguments", ")", "Assert", "(", "t", "TestingT", ",", "objects", "...", "interface", "{", "}", ")", "bool", "{", "if", "h", ",", "ok", ":=", "t", ".", "(", "tHelper", ")", ";", "ok", "{", "h", ".", "Helper", "(", ")", "\n"...
// Assert compares the arguments with the specified objects and fails if // they do not exactly match.
[ "Assert", "compares", "the", "arguments", "with", "the", "specified", "objects", "and", "fails", "if", "they", "do", "not", "exactly", "match", "." ]
34c6fa2dc70986bccbbffcc6130f6920a924b075
https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/mock/mock.go#L732-L750
train
stretchr/testify
mock/mock.go
Int
func (args Arguments) Int(index int) int { var s int var ok bool if s, ok = args.Get(index).(int); !ok { panic(fmt.Sprintf("assert: arguments: Int(%d) failed because object wasn't correct type: %v", index, args.Get(index))) } return s }
go
func (args Arguments) Int(index int) int { var s int var ok bool if s, ok = args.Get(index).(int); !ok { panic(fmt.Sprintf("assert: arguments: Int(%d) failed because object wasn't correct type: %v", index, args.Get(index))) } return s }
[ "func", "(", "args", "Arguments", ")", "Int", "(", "index", "int", ")", "int", "{", "var", "s", "int", "\n", "var", "ok", "bool", "\n", "if", "s", ",", "ok", "=", "args", ".", "Get", "(", "index", ")", ".", "(", "int", ")", ";", "!", "ok", ...
// Int gets the argument at the specified index. Panics if there is no argument, or // if the argument is of the wrong type.
[ "Int", "gets", "the", "argument", "at", "the", "specified", "index", ".", "Panics", "if", "there", "is", "no", "argument", "or", "if", "the", "argument", "is", "of", "the", "wrong", "type", "." ]
34c6fa2dc70986bccbbffcc6130f6920a924b075
https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/mock/mock.go#L783-L790
train
stretchr/testify
mock/mock.go
Error
func (args Arguments) Error(index int) error { obj := args.Get(index) var s error var ok bool if obj == nil { return nil } if s, ok = obj.(error); !ok { panic(fmt.Sprintf("assert: arguments: Error(%d) failed because object wasn't correct type: %v", index, args.Get(index))) } return s }
go
func (args Arguments) Error(index int) error { obj := args.Get(index) var s error var ok bool if obj == nil { return nil } if s, ok = obj.(error); !ok { panic(fmt.Sprintf("assert: arguments: Error(%d) failed because object wasn't correct type: %v", index, args.Get(index))) } return s }
[ "func", "(", "args", "Arguments", ")", "Error", "(", "index", "int", ")", "error", "{", "obj", ":=", "args", ".", "Get", "(", "index", ")", "\n", "var", "s", "error", "\n", "var", "ok", "bool", "\n", "if", "obj", "==", "nil", "{", "return", "nil"...
// Error gets the argument at the specified index. Panics if there is no argument, or // if the argument is of the wrong type.
[ "Error", "gets", "the", "argument", "at", "the", "specified", "index", ".", "Panics", "if", "there", "is", "no", "argument", "or", "if", "the", "argument", "is", "of", "the", "wrong", "type", "." ]
34c6fa2dc70986bccbbffcc6130f6920a924b075
https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/mock/mock.go#L794-L805
train
stretchr/testify
require/require.go
DirExists
func DirExists(t TestingT, path string, msgAndArgs ...interface{}) { if h, ok := t.(tHelper); ok { h.Helper() } if assert.DirExists(t, path, msgAndArgs...) { return } t.FailNow() }
go
func DirExists(t TestingT, path string, msgAndArgs ...interface{}) { if h, ok := t.(tHelper); ok { h.Helper() } if assert.DirExists(t, path, msgAndArgs...) { return } t.FailNow() }
[ "func", "DirExists", "(", "t", "TestingT", ",", "path", "string", ",", "msgAndArgs", "...", "interface", "{", "}", ")", "{", "if", "h", ",", "ok", ":=", "t", ".", "(", "tHelper", ")", ";", "ok", "{", "h", ".", "Helper", "(", ")", "\n", "}", "\n...
// DirExists checks whether a directory exists in the given path. It also fails if the path is a file rather a directory or there is an error checking whether it exists.
[ "DirExists", "checks", "whether", "a", "directory", "exists", "in", "the", "given", "path", ".", "It", "also", "fails", "if", "the", "path", "is", "a", "file", "rather", "a", "directory", "or", "there", "is", "an", "error", "checking", "whether", "it", "...
34c6fa2dc70986bccbbffcc6130f6920a924b075
https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/require/require.go#L70-L78
train
stretchr/testify
require/require.go
FailNowf
func FailNowf(t TestingT, failureMessage string, msg string, args ...interface{}) { if h, ok := t.(tHelper); ok { h.Helper() } if assert.FailNowf(t, failureMessage, msg, args...) { return } t.FailNow() }
go
func FailNowf(t TestingT, failureMessage string, msg string, args ...interface{}) { if h, ok := t.(tHelper); ok { h.Helper() } if assert.FailNowf(t, failureMessage, msg, args...) { return } t.FailNow() }
[ "func", "FailNowf", "(", "t", "TestingT", ",", "failureMessage", "string", ",", "msg", "string", ",", "args", "...", "interface", "{", "}", ")", "{", "if", "h", ",", "ok", ":=", "t", ".", "(", "tHelper", ")", ";", "ok", "{", "h", ".", "Helper", "...
// FailNowf fails test
[ "FailNowf", "fails", "test" ]
34c6fa2dc70986bccbbffcc6130f6920a924b075
https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/require/require.go#L322-L330
train
stretchr/testify
assert/assertion_forward.go
NotZero
func (a *Assertions) NotZero(i interface{}, msgAndArgs ...interface{}) bool { if h, ok := a.t.(tHelper); ok { h.Helper() } return NotZero(a.t, i, msgAndArgs...) }
go
func (a *Assertions) NotZero(i interface{}, msgAndArgs ...interface{}) bool { if h, ok := a.t.(tHelper); ok { h.Helper() } return NotZero(a.t, i, msgAndArgs...) }
[ "func", "(", "a", "*", "Assertions", ")", "NotZero", "(", "i", "interface", "{", "}", ",", "msgAndArgs", "...", "interface", "{", "}", ")", "bool", "{", "if", "h", ",", "ok", ":=", "a", ".", "t", ".", "(", "tHelper", ")", ";", "ok", "{", "h", ...
// NotZero asserts that i is not the zero value for its type.
[ "NotZero", "asserts", "that", "i", "is", "not", "the", "zero", "value", "for", "its", "type", "." ]
34c6fa2dc70986bccbbffcc6130f6920a924b075
https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/assert/assertion_forward.go#L901-L906
train
stretchr/testify
assert/http_assertions.go
HTTPBody
func HTTPBody(handler http.HandlerFunc, method, url string, values url.Values) string { w := httptest.NewRecorder() req, err := http.NewRequest(method, url+"?"+values.Encode(), nil) if err != nil { return "" } handler(w, req) return w.Body.String() }
go
func HTTPBody(handler http.HandlerFunc, method, url string, values url.Values) string { w := httptest.NewRecorder() req, err := http.NewRequest(method, url+"?"+values.Encode(), nil) if err != nil { return "" } handler(w, req) return w.Body.String() }
[ "func", "HTTPBody", "(", "handler", "http", ".", "HandlerFunc", ",", "method", ",", "url", "string", ",", "values", "url", ".", "Values", ")", "string", "{", "w", ":=", "httptest", ".", "NewRecorder", "(", ")", "\n", "req", ",", "err", ":=", "http", ...
// HTTPBody is a helper that returns HTTP body of the response. It returns // empty string if building a new request fails.
[ "HTTPBody", "is", "a", "helper", "that", "returns", "HTTP", "body", "of", "the", "response", ".", "It", "returns", "empty", "string", "if", "building", "a", "new", "request", "fails", "." ]
34c6fa2dc70986bccbbffcc6130f6920a924b075
https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/assert/http_assertions.go#L95-L103
train
stretchr/testify
suite/suite.go
Require
func (suite *Suite) Require() *require.Assertions { if suite.require == nil { suite.require = require.New(suite.T()) } return suite.require }
go
func (suite *Suite) Require() *require.Assertions { if suite.require == nil { suite.require = require.New(suite.T()) } return suite.require }
[ "func", "(", "suite", "*", "Suite", ")", "Require", "(", ")", "*", "require", ".", "Assertions", "{", "if", "suite", ".", "require", "==", "nil", "{", "suite", ".", "require", "=", "require", ".", "New", "(", "suite", ".", "T", "(", ")", ")", "\n...
// Require returns a require context for suite.
[ "Require", "returns", "a", "require", "context", "for", "suite", "." ]
34c6fa2dc70986bccbbffcc6130f6920a924b075
https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/suite/suite.go#L40-L45
train
stretchr/testify
suite/suite.go
Run
func Run(t *testing.T, suite TestingSuite) { suite.SetT(t) defer failOnPanic(t) suiteSetupDone := false methodFinder := reflect.TypeOf(suite) tests := []testing.InternalTest{} for index := 0; index < methodFinder.NumMethod(); index++ { method := methodFinder.Method(index) ok, err := methodFilter(method.Nam...
go
func Run(t *testing.T, suite TestingSuite) { suite.SetT(t) defer failOnPanic(t) suiteSetupDone := false methodFinder := reflect.TypeOf(suite) tests := []testing.InternalTest{} for index := 0; index < methodFinder.NumMethod(); index++ { method := methodFinder.Method(index) ok, err := methodFilter(method.Nam...
[ "func", "Run", "(", "t", "*", "testing", ".", "T", ",", "suite", "TestingSuite", ")", "{", "suite", ".", "SetT", "(", "t", ")", "\n", "defer", "failOnPanic", "(", "t", ")", "\n\n", "suiteSetupDone", ":=", "false", "\n", "methodFinder", ":=", "reflect",...
// Run takes a testing suite and runs all of the tests attached // to it.
[ "Run", "takes", "a", "testing", "suite", "and", "runs", "all", "of", "the", "tests", "attached", "to", "it", "." ]
34c6fa2dc70986bccbbffcc6130f6920a924b075
https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/suite/suite.go#L82-L139
train
stretchr/testify
suite/suite.go
methodFilter
func methodFilter(name string) (bool, error) { if ok, _ := regexp.MatchString("^Test", name); !ok { return false, nil } return regexp.MatchString(*matchMethod, name) }
go
func methodFilter(name string) (bool, error) { if ok, _ := regexp.MatchString("^Test", name); !ok { return false, nil } return regexp.MatchString(*matchMethod, name) }
[ "func", "methodFilter", "(", "name", "string", ")", "(", "bool", ",", "error", ")", "{", "if", "ok", ",", "_", ":=", "regexp", ".", "MatchString", "(", "\"", "\"", ",", "name", ")", ";", "!", "ok", "{", "return", "false", ",", "nil", "\n", "}", ...
// Filtering method according to set regular expression // specified command-line argument -m
[ "Filtering", "method", "according", "to", "set", "regular", "expression", "specified", "command", "-", "line", "argument", "-", "m" ]
34c6fa2dc70986bccbbffcc6130f6920a924b075
https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/suite/suite.go#L157-L162
train
stretchr/testify
assert/assertion_format.go
InEpsilonf
func InEpsilonf(t TestingT, expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) bool { if h, ok := t.(tHelper); ok { h.Helper() } return InEpsilon(t, expected, actual, epsilon, append([]interface{}{msg}, args...)...) }
go
func InEpsilonf(t TestingT, expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) bool { if h, ok := t.(tHelper); ok { h.Helper() } return InEpsilon(t, expected, actual, epsilon, append([]interface{}{msg}, args...)...) }
[ "func", "InEpsilonf", "(", "t", "TestingT", ",", "expected", "interface", "{", "}", ",", "actual", "interface", "{", "}", ",", "epsilon", "float64", ",", "msg", "string", ",", "args", "...", "interface", "{", "}", ")", "bool", "{", "if", "h", ",", "o...
// InEpsilonf asserts that expected and actual have a relative error less than epsilon
[ "InEpsilonf", "asserts", "that", "expected", "and", "actual", "have", "a", "relative", "error", "less", "than", "epsilon" ]
34c6fa2dc70986bccbbffcc6130f6920a924b075
https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/assert/assertion_format.go#L284-L289
train
stretchr/testify
assert/assertion_format.go
NotZerof
func NotZerof(t TestingT, i interface{}, msg string, args ...interface{}) bool { if h, ok := t.(tHelper); ok { h.Helper() } return NotZero(t, i, append([]interface{}{msg}, args...)...) }
go
func NotZerof(t TestingT, i interface{}, msg string, args ...interface{}) bool { if h, ok := t.(tHelper); ok { h.Helper() } return NotZero(t, i, append([]interface{}{msg}, args...)...) }
[ "func", "NotZerof", "(", "t", "TestingT", ",", "i", "interface", "{", "}", ",", "msg", "string", ",", "args", "...", "interface", "{", "}", ")", "bool", "{", "if", "h", ",", "ok", ":=", "t", ".", "(", "tHelper", ")", ";", "ok", "{", "h", ".", ...
// NotZerof asserts that i is not the zero value for its type.
[ "NotZerof", "asserts", "that", "i", "is", "not", "the", "zero", "value", "for", "its", "type", "." ]
34c6fa2dc70986bccbbffcc6130f6920a924b075
https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/assert/assertion_format.go#L458-L463
train
stretchr/testify
_codegen/main.go
parsePackageSource
func parsePackageSource(pkg string) (*types.Scope, *doc.Package, error) { pd, err := build.Import(pkg, ".", 0) if err != nil { return nil, nil, err } fset := token.NewFileSet() files := make(map[string]*ast.File) fileList := make([]*ast.File, len(pd.GoFiles)) for i, fname := range pd.GoFiles { src, err := i...
go
func parsePackageSource(pkg string) (*types.Scope, *doc.Package, error) { pd, err := build.Import(pkg, ".", 0) if err != nil { return nil, nil, err } fset := token.NewFileSet() files := make(map[string]*ast.File) fileList := make([]*ast.File, len(pd.GoFiles)) for i, fname := range pd.GoFiles { src, err := i...
[ "func", "parsePackageSource", "(", "pkg", "string", ")", "(", "*", "types", ".", "Scope", ",", "*", "doc", ".", "Package", ",", "error", ")", "{", "pd", ",", "err", ":=", "build", ".", "Import", "(", "pkg", ",", "\"", "\"", ",", "0", ")", "\n", ...
// parsePackageSource returns the types scope and the package documentation from the package
[ "parsePackageSource", "returns", "the", "types", "scope", "and", "the", "package", "documentation", "from", "the", "package" ]
34c6fa2dc70986bccbbffcc6130f6920a924b075
https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/_codegen/main.go#L174-L213
train
stretchr/testify
assert/assertions.go
ObjectsAreEqualValues
func ObjectsAreEqualValues(expected, actual interface{}) bool { if ObjectsAreEqual(expected, actual) { return true } actualType := reflect.TypeOf(actual) if actualType == nil { return false } expectedValue := reflect.ValueOf(expected) if expectedValue.IsValid() && expectedValue.Type().ConvertibleTo(actualTy...
go
func ObjectsAreEqualValues(expected, actual interface{}) bool { if ObjectsAreEqual(expected, actual) { return true } actualType := reflect.TypeOf(actual) if actualType == nil { return false } expectedValue := reflect.ValueOf(expected) if expectedValue.IsValid() && expectedValue.Type().ConvertibleTo(actualTy...
[ "func", "ObjectsAreEqualValues", "(", "expected", ",", "actual", "interface", "{", "}", ")", "bool", "{", "if", "ObjectsAreEqual", "(", "expected", ",", "actual", ")", "{", "return", "true", "\n", "}", "\n\n", "actualType", ":=", "reflect", ".", "TypeOf", ...
// ObjectsAreEqualValues gets whether two objects are equal, or if their // values are equal.
[ "ObjectsAreEqualValues", "gets", "whether", "two", "objects", "are", "equal", "or", "if", "their", "values", "are", "equal", "." ]
34c6fa2dc70986bccbbffcc6130f6920a924b075
https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/assert/assertions.go#L78-L94
train
stretchr/testify
assert/assertions.go
formatUnequalValues
func formatUnequalValues(expected, actual interface{}) (e string, a string) { if reflect.TypeOf(expected) != reflect.TypeOf(actual) { return fmt.Sprintf("%T(%#v)", expected, expected), fmt.Sprintf("%T(%#v)", actual, actual) } return fmt.Sprintf("%#v", expected), fmt.Sprintf("%#v", actual) }
go
func formatUnequalValues(expected, actual interface{}) (e string, a string) { if reflect.TypeOf(expected) != reflect.TypeOf(actual) { return fmt.Sprintf("%T(%#v)", expected, expected), fmt.Sprintf("%T(%#v)", actual, actual) } return fmt.Sprintf("%#v", expected), fmt.Sprintf("%#v", actual) }
[ "func", "formatUnequalValues", "(", "expected", ",", "actual", "interface", "{", "}", ")", "(", "e", "string", ",", "a", "string", ")", "{", "if", "reflect", ".", "TypeOf", "(", "expected", ")", "!=", "reflect", ".", "TypeOf", "(", "actual", ")", "{", ...
// formatUnequalValues takes two values of arbitrary types and returns string // representations appropriate to be presented to the user. // // If the values are not of like type, the returned strings will be prefixed // with the type name, and the value will be enclosed in parenthesis similar // to a type conversion i...
[ "formatUnequalValues", "takes", "two", "values", "of", "arbitrary", "types", "and", "returns", "string", "representations", "appropriate", "to", "be", "presented", "to", "the", "user", ".", "If", "the", "values", "are", "not", "of", "like", "type", "the", "ret...
34c6fa2dc70986bccbbffcc6130f6920a924b075
https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/assert/assertions.go#L390-L398
train
stretchr/testify
assert/assertions.go
containsKind
func containsKind(kinds []reflect.Kind, kind reflect.Kind) bool { for i := 0; i < len(kinds); i++ { if kind == kinds[i] { return true } } return false }
go
func containsKind(kinds []reflect.Kind, kind reflect.Kind) bool { for i := 0; i < len(kinds); i++ { if kind == kinds[i] { return true } } return false }
[ "func", "containsKind", "(", "kinds", "[", "]", "reflect", ".", "Kind", ",", "kind", "reflect", ".", "Kind", ")", "bool", "{", "for", "i", ":=", "0", ";", "i", "<", "len", "(", "kinds", ")", ";", "i", "++", "{", "if", "kind", "==", "kinds", "["...
// containsKind checks if a specified kind in the slice of kinds.
[ "containsKind", "checks", "if", "a", "specified", "kind", "in", "the", "slice", "of", "kinds", "." ]
34c6fa2dc70986bccbbffcc6130f6920a924b075
https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/assert/assertions.go#L454-L462
train
stretchr/testify
assert/assertions.go
isNil
func isNil(object interface{}) bool { if object == nil { return true } value := reflect.ValueOf(object) kind := value.Kind() isNilableKind := containsKind( []reflect.Kind{ reflect.Chan, reflect.Func, reflect.Interface, reflect.Map, reflect.Ptr, reflect.Slice}, kind) if isNilableKind && value.IsNi...
go
func isNil(object interface{}) bool { if object == nil { return true } value := reflect.ValueOf(object) kind := value.Kind() isNilableKind := containsKind( []reflect.Kind{ reflect.Chan, reflect.Func, reflect.Interface, reflect.Map, reflect.Ptr, reflect.Slice}, kind) if isNilableKind && value.IsNi...
[ "func", "isNil", "(", "object", "interface", "{", "}", ")", "bool", "{", "if", "object", "==", "nil", "{", "return", "true", "\n", "}", "\n\n", "value", ":=", "reflect", ".", "ValueOf", "(", "object", ")", "\n", "kind", ":=", "value", ".", "Kind", ...
// isNil checks if a specified object is nil or not, without Failing.
[ "isNil", "checks", "if", "a", "specified", "object", "is", "nil", "or", "not", "without", "Failing", "." ]
34c6fa2dc70986bccbbffcc6130f6920a924b075
https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/assert/assertions.go#L465-L484
train
stretchr/testify
assert/assertions.go
didPanic
func didPanic(f PanicTestFunc) (bool, interface{}) { didPanic := false var message interface{} func() { defer func() { if message = recover(); message != nil { didPanic = true } }() // call the target function f() }() return didPanic, message }
go
func didPanic(f PanicTestFunc) (bool, interface{}) { didPanic := false var message interface{} func() { defer func() { if message = recover(); message != nil { didPanic = true } }() // call the target function f() }() return didPanic, message }
[ "func", "didPanic", "(", "f", "PanicTestFunc", ")", "(", "bool", ",", "interface", "{", "}", ")", "{", "didPanic", ":=", "false", "\n", "var", "message", "interface", "{", "}", "\n", "func", "(", ")", "{", "defer", "func", "(", ")", "{", "if", "mes...
// didPanic returns true if the function passed to it panics. Otherwise, it returns false.
[ "didPanic", "returns", "true", "if", "the", "function", "passed", "to", "it", "panics", ".", "Otherwise", "it", "returns", "false", "." ]
34c6fa2dc70986bccbbffcc6130f6920a924b075
https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/assert/assertions.go#L903-L922
train
stretchr/testify
assert/assertions.go
InDeltaMapValues
func InDeltaMapValues(t TestingT, expected, actual interface{}, delta float64, msgAndArgs ...interface{}) bool { if h, ok := t.(tHelper); ok { h.Helper() } if expected == nil || actual == nil || reflect.TypeOf(actual).Kind() != reflect.Map || reflect.TypeOf(expected).Kind() != reflect.Map { return Fail(t, "A...
go
func InDeltaMapValues(t TestingT, expected, actual interface{}, delta float64, msgAndArgs ...interface{}) bool { if h, ok := t.(tHelper); ok { h.Helper() } if expected == nil || actual == nil || reflect.TypeOf(actual).Kind() != reflect.Map || reflect.TypeOf(expected).Kind() != reflect.Map { return Fail(t, "A...
[ "func", "InDeltaMapValues", "(", "t", "TestingT", ",", "expected", ",", "actual", "interface", "{", "}", ",", "delta", "float64", ",", "msgAndArgs", "...", "interface", "{", "}", ")", "bool", "{", "if", "h", ",", "ok", ":=", "t", ".", "(", "tHelper", ...
// InDeltaMapValues is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys.
[ "InDeltaMapValues", "is", "the", "same", "as", "InDelta", "but", "it", "compares", "all", "values", "between", "two", "maps", ".", "Both", "maps", "must", "have", "exactly", "the", "same", "keys", "." ]
34c6fa2dc70986bccbbffcc6130f6920a924b075
https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/assert/assertions.go#L1082-L1123
train
stretchr/testify
assert/assertions.go
matchRegexp
func matchRegexp(rx interface{}, str interface{}) bool { var r *regexp.Regexp if rr, ok := rx.(*regexp.Regexp); ok { r = rr } else { r = regexp.MustCompile(fmt.Sprint(rx)) } return (r.FindStringIndex(fmt.Sprint(str)) != nil) }
go
func matchRegexp(rx interface{}, str interface{}) bool { var r *regexp.Regexp if rr, ok := rx.(*regexp.Regexp); ok { r = rr } else { r = regexp.MustCompile(fmt.Sprint(rx)) } return (r.FindStringIndex(fmt.Sprint(str)) != nil) }
[ "func", "matchRegexp", "(", "rx", "interface", "{", "}", ",", "str", "interface", "{", "}", ")", "bool", "{", "var", "r", "*", "regexp", ".", "Regexp", "\n", "if", "rr", ",", "ok", ":=", "rx", ".", "(", "*", "regexp", ".", "Regexp", ")", ";", "...
// matchRegexp return true if a specified regexp matches a string.
[ "matchRegexp", "return", "true", "if", "a", "specified", "regexp", "matches", "a", "string", "." ]
34c6fa2dc70986bccbbffcc6130f6920a924b075
https://github.com/stretchr/testify/blob/34c6fa2dc70986bccbbffcc6130f6920a924b075/assert/assertions.go#L1245-L1256
train
vmware/govmomi
object/virtual_device_list.go
SCSIControllerTypes
func SCSIControllerTypes() VirtualDeviceList { // Return a mutable list of SCSI controller types, initialized with defaults. return VirtualDeviceList([]types.BaseVirtualDevice{ &types.VirtualLsiLogicController{}, &types.VirtualBusLogicController{}, &types.ParaVirtualSCSIController{}, &types.VirtualLsiLogicSAS...
go
func SCSIControllerTypes() VirtualDeviceList { // Return a mutable list of SCSI controller types, initialized with defaults. return VirtualDeviceList([]types.BaseVirtualDevice{ &types.VirtualLsiLogicController{}, &types.VirtualBusLogicController{}, &types.ParaVirtualSCSIController{}, &types.VirtualLsiLogicSAS...
[ "func", "SCSIControllerTypes", "(", ")", "VirtualDeviceList", "{", "// Return a mutable list of SCSI controller types, initialized with defaults.", "return", "VirtualDeviceList", "(", "[", "]", "types", ".", "BaseVirtualDevice", "{", "&", "types", ".", "VirtualLsiLogicControlle...
// SCSIControllerTypes are used for adding a new SCSI controller to a VM.
[ "SCSIControllerTypes", "are", "used", "for", "adding", "a", "new", "SCSI", "controller", "to", "a", "VM", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/object/virtual_device_list.go#L44-L57
train
vmware/govmomi
object/virtual_device_list.go
EthernetCardTypes
func EthernetCardTypes() VirtualDeviceList { return VirtualDeviceList([]types.BaseVirtualDevice{ &types.VirtualE1000{}, &types.VirtualE1000e{}, &types.VirtualVmxnet2{}, &types.VirtualVmxnet3{}, &types.VirtualPCNet32{}, &types.VirtualSriovEthernetCard{}, }).Select(func(device types.BaseVirtualDevice) bool ...
go
func EthernetCardTypes() VirtualDeviceList { return VirtualDeviceList([]types.BaseVirtualDevice{ &types.VirtualE1000{}, &types.VirtualE1000e{}, &types.VirtualVmxnet2{}, &types.VirtualVmxnet3{}, &types.VirtualPCNet32{}, &types.VirtualSriovEthernetCard{}, }).Select(func(device types.BaseVirtualDevice) bool ...
[ "func", "EthernetCardTypes", "(", ")", "VirtualDeviceList", "{", "return", "VirtualDeviceList", "(", "[", "]", "types", ".", "BaseVirtualDevice", "{", "&", "types", ".", "VirtualE1000", "{", "}", ",", "&", "types", ".", "VirtualE1000e", "{", "}", ",", "&", ...
// EthernetCardTypes are used for adding a new ethernet card to a VM.
[ "EthernetCardTypes", "are", "used", "for", "adding", "a", "new", "ethernet", "card", "to", "a", "VM", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/object/virtual_device_list.go#L60-L73
train
vmware/govmomi
object/virtual_device_list.go
Select
func (l VirtualDeviceList) Select(f func(device types.BaseVirtualDevice) bool) VirtualDeviceList { var found VirtualDeviceList for _, device := range l { if f(device) { found = append(found, device) } } return found }
go
func (l VirtualDeviceList) Select(f func(device types.BaseVirtualDevice) bool) VirtualDeviceList { var found VirtualDeviceList for _, device := range l { if f(device) { found = append(found, device) } } return found }
[ "func", "(", "l", "VirtualDeviceList", ")", "Select", "(", "f", "func", "(", "device", "types", ".", "BaseVirtualDevice", ")", "bool", ")", "VirtualDeviceList", "{", "var", "found", "VirtualDeviceList", "\n\n", "for", "_", ",", "device", ":=", "range", "l", ...
// Select returns a new list containing all elements of the list for which the given func returns true.
[ "Select", "returns", "a", "new", "list", "containing", "all", "elements", "of", "the", "list", "for", "which", "the", "given", "func", "returns", "true", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/object/virtual_device_list.go#L76-L86
train
vmware/govmomi
object/virtual_device_list.go
SelectByType
func (l VirtualDeviceList) SelectByType(deviceType types.BaseVirtualDevice) VirtualDeviceList { dtype := reflect.TypeOf(deviceType) if dtype == nil { return nil } dname := dtype.Elem().Name() return l.Select(func(device types.BaseVirtualDevice) bool { t := reflect.TypeOf(device) if t == dtype { return t...
go
func (l VirtualDeviceList) SelectByType(deviceType types.BaseVirtualDevice) VirtualDeviceList { dtype := reflect.TypeOf(deviceType) if dtype == nil { return nil } dname := dtype.Elem().Name() return l.Select(func(device types.BaseVirtualDevice) bool { t := reflect.TypeOf(device) if t == dtype { return t...
[ "func", "(", "l", "VirtualDeviceList", ")", "SelectByType", "(", "deviceType", "types", ".", "BaseVirtualDevice", ")", "VirtualDeviceList", "{", "dtype", ":=", "reflect", ".", "TypeOf", "(", "deviceType", ")", "\n", "if", "dtype", "==", "nil", "{", "return", ...
// SelectByType returns a new list with devices that are equal to or extend the given type.
[ "SelectByType", "returns", "a", "new", "list", "with", "devices", "that", "are", "equal", "to", "or", "extend", "the", "given", "type", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/object/virtual_device_list.go#L89-L107
train
vmware/govmomi
object/virtual_device_list.go
SelectByBackingInfo
func (l VirtualDeviceList) SelectByBackingInfo(backing types.BaseVirtualDeviceBackingInfo) VirtualDeviceList { t := reflect.TypeOf(backing) return l.Select(func(device types.BaseVirtualDevice) bool { db := device.GetVirtualDevice().Backing if db == nil { return false } if reflect.TypeOf(db) != t { ret...
go
func (l VirtualDeviceList) SelectByBackingInfo(backing types.BaseVirtualDeviceBackingInfo) VirtualDeviceList { t := reflect.TypeOf(backing) return l.Select(func(device types.BaseVirtualDevice) bool { db := device.GetVirtualDevice().Backing if db == nil { return false } if reflect.TypeOf(db) != t { ret...
[ "func", "(", "l", "VirtualDeviceList", ")", "SelectByBackingInfo", "(", "backing", "types", ".", "BaseVirtualDeviceBackingInfo", ")", "VirtualDeviceList", "{", "t", ":=", "reflect", ".", "TypeOf", "(", "backing", ")", "\n\n", "return", "l", ".", "Select", "(", ...
// SelectByBackingInfo returns a new list with devices matching the given backing info. // If the value of backing is nil, any device with a backing of the same type will be returned.
[ "SelectByBackingInfo", "returns", "a", "new", "list", "with", "devices", "matching", "the", "given", "backing", "info", ".", "If", "the", "value", "of", "backing", "is", "nil", "any", "device", "with", "a", "backing", "of", "the", "same", "type", "will", "...
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/object/virtual_device_list.go#L111-L153
train
vmware/govmomi
object/virtual_device_list.go
Find
func (l VirtualDeviceList) Find(name string) types.BaseVirtualDevice { for _, device := range l { if l.Name(device) == name { return device } } return nil }
go
func (l VirtualDeviceList) Find(name string) types.BaseVirtualDevice { for _, device := range l { if l.Name(device) == name { return device } } return nil }
[ "func", "(", "l", "VirtualDeviceList", ")", "Find", "(", "name", "string", ")", "types", ".", "BaseVirtualDevice", "{", "for", "_", ",", "device", ":=", "range", "l", "{", "if", "l", ".", "Name", "(", "device", ")", "==", "name", "{", "return", "devi...
// Find returns the device matching the given name.
[ "Find", "returns", "the", "device", "matching", "the", "given", "name", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/object/virtual_device_list.go#L156-L163
train
vmware/govmomi
object/virtual_device_list.go
FindByKey
func (l VirtualDeviceList) FindByKey(key int32) types.BaseVirtualDevice { for _, device := range l { if device.GetVirtualDevice().Key == key { return device } } return nil }
go
func (l VirtualDeviceList) FindByKey(key int32) types.BaseVirtualDevice { for _, device := range l { if device.GetVirtualDevice().Key == key { return device } } return nil }
[ "func", "(", "l", "VirtualDeviceList", ")", "FindByKey", "(", "key", "int32", ")", "types", ".", "BaseVirtualDevice", "{", "for", "_", ",", "device", ":=", "range", "l", "{", "if", "device", ".", "GetVirtualDevice", "(", ")", ".", "Key", "==", "key", "...
// FindByKey returns the device matching the given key.
[ "FindByKey", "returns", "the", "device", "matching", "the", "given", "key", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/object/virtual_device_list.go#L166-L173
train
vmware/govmomi
object/virtual_device_list.go
FindIDEController
func (l VirtualDeviceList) FindIDEController(name string) (*types.VirtualIDEController, error) { if name != "" { d := l.Find(name) if d == nil { return nil, fmt.Errorf("device '%s' not found", name) } if c, ok := d.(*types.VirtualIDEController); ok { return c, nil } return nil, fmt.Errorf("%s is not ...
go
func (l VirtualDeviceList) FindIDEController(name string) (*types.VirtualIDEController, error) { if name != "" { d := l.Find(name) if d == nil { return nil, fmt.Errorf("device '%s' not found", name) } if c, ok := d.(*types.VirtualIDEController); ok { return c, nil } return nil, fmt.Errorf("%s is not ...
[ "func", "(", "l", "VirtualDeviceList", ")", "FindIDEController", "(", "name", "string", ")", "(", "*", "types", ".", "VirtualIDEController", ",", "error", ")", "{", "if", "name", "!=", "\"", "\"", "{", "d", ":=", "l", ".", "Find", "(", "name", ")", "...
// FindIDEController will find the named IDE controller if given, otherwise will pick an available controller. // An error is returned if the named controller is not found or not an IDE controller. Or, if name is not // given and no available controller can be found.
[ "FindIDEController", "will", "find", "the", "named", "IDE", "controller", "if", "given", "otherwise", "will", "pick", "an", "available", "controller", ".", "An", "error", "is", "returned", "if", "the", "named", "controller", "is", "not", "found", "or", "not", ...
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/object/virtual_device_list.go#L178-L196
train
vmware/govmomi
object/virtual_device_list.go
CreateIDEController
func (l VirtualDeviceList) CreateIDEController() (types.BaseVirtualDevice, error) { ide := &types.VirtualIDEController{} ide.Key = l.NewKey() return ide, nil }
go
func (l VirtualDeviceList) CreateIDEController() (types.BaseVirtualDevice, error) { ide := &types.VirtualIDEController{} ide.Key = l.NewKey() return ide, nil }
[ "func", "(", "l", "VirtualDeviceList", ")", "CreateIDEController", "(", ")", "(", "types", ".", "BaseVirtualDevice", ",", "error", ")", "{", "ide", ":=", "&", "types", ".", "VirtualIDEController", "{", "}", "\n", "ide", ".", "Key", "=", "l", ".", "NewKey...
// CreateIDEController creates a new IDE controller.
[ "CreateIDEController", "creates", "a", "new", "IDE", "controller", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/object/virtual_device_list.go#L199-L203
train
vmware/govmomi
object/virtual_device_list.go
FindSCSIController
func (l VirtualDeviceList) FindSCSIController(name string) (*types.VirtualSCSIController, error) { if name != "" { d := l.Find(name) if d == nil { return nil, fmt.Errorf("device '%s' not found", name) } if c, ok := d.(types.BaseVirtualSCSIController); ok { return c.GetVirtualSCSIController(), nil } r...
go
func (l VirtualDeviceList) FindSCSIController(name string) (*types.VirtualSCSIController, error) { if name != "" { d := l.Find(name) if d == nil { return nil, fmt.Errorf("device '%s' not found", name) } if c, ok := d.(types.BaseVirtualSCSIController); ok { return c.GetVirtualSCSIController(), nil } r...
[ "func", "(", "l", "VirtualDeviceList", ")", "FindSCSIController", "(", "name", "string", ")", "(", "*", "types", ".", "VirtualSCSIController", ",", "error", ")", "{", "if", "name", "!=", "\"", "\"", "{", "d", ":=", "l", ".", "Find", "(", "name", ")", ...
// FindSCSIController will find the named SCSI controller if given, otherwise will pick an available controller. // An error is returned if the named controller is not found or not an SCSI controller. Or, if name is not // given and no available controller can be found.
[ "FindSCSIController", "will", "find", "the", "named", "SCSI", "controller", "if", "given", "otherwise", "will", "pick", "an", "available", "controller", ".", "An", "error", "is", "returned", "if", "the", "named", "controller", "is", "not", "found", "or", "not"...
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/object/virtual_device_list.go#L208-L226
train
vmware/govmomi
object/virtual_device_list.go
CreateSCSIController
func (l VirtualDeviceList) CreateSCSIController(name string) (types.BaseVirtualDevice, error) { ctypes := SCSIControllerTypes() if name == "" || name == "scsi" { name = ctypes.Type(ctypes[0]) } else if name == "virtualscsi" { name = "pvscsi" // ovf VirtualSCSI mapping } found := ctypes.Select(func(device typ...
go
func (l VirtualDeviceList) CreateSCSIController(name string) (types.BaseVirtualDevice, error) { ctypes := SCSIControllerTypes() if name == "" || name == "scsi" { name = ctypes.Type(ctypes[0]) } else if name == "virtualscsi" { name = "pvscsi" // ovf VirtualSCSI mapping } found := ctypes.Select(func(device typ...
[ "func", "(", "l", "VirtualDeviceList", ")", "CreateSCSIController", "(", "name", "string", ")", "(", "types", ".", "BaseVirtualDevice", ",", "error", ")", "{", "ctypes", ":=", "SCSIControllerTypes", "(", ")", "\n\n", "if", "name", "==", "\"", "\"", "||", "...
// CreateSCSIController creates a new SCSI controller of type name if given, otherwise defaults to lsilogic.
[ "CreateSCSIController", "creates", "a", "new", "SCSI", "controller", "of", "type", "name", "if", "given", "otherwise", "defaults", "to", "lsilogic", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/object/virtual_device_list.go#L229-L256
train
vmware/govmomi
object/virtual_device_list.go
newSCSIBusNumber
func (l VirtualDeviceList) newSCSIBusNumber() int32 { var used []int for _, d := range l.SelectByType((*types.VirtualSCSIController)(nil)) { num := d.(types.BaseVirtualSCSIController).GetVirtualSCSIController().BusNumber if num >= 0 { used = append(used, int(num)) } // else caller is creating a new vm using...
go
func (l VirtualDeviceList) newSCSIBusNumber() int32 { var used []int for _, d := range l.SelectByType((*types.VirtualSCSIController)(nil)) { num := d.(types.BaseVirtualSCSIController).GetVirtualSCSIController().BusNumber if num >= 0 { used = append(used, int(num)) } // else caller is creating a new vm using...
[ "func", "(", "l", "VirtualDeviceList", ")", "newSCSIBusNumber", "(", ")", "int32", "{", "var", "used", "[", "]", "int", "\n\n", "for", "_", ",", "d", ":=", "range", "l", ".", "SelectByType", "(", "(", "*", "types", ".", "VirtualSCSIController", ")", "(...
// newSCSIBusNumber returns the bus number to use for adding a new SCSI bus device. // -1 is returned if there are no bus numbers available.
[ "newSCSIBusNumber", "returns", "the", "bus", "number", "to", "use", "for", "adding", "a", "new", "SCSI", "bus", "device", ".", "-", "1", "is", "returned", "if", "there", "are", "no", "bus", "numbers", "available", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/object/virtual_device_list.go#L262-L281
train
vmware/govmomi
object/virtual_device_list.go
CreateNVMEController
func (l VirtualDeviceList) CreateNVMEController() (types.BaseVirtualDevice, error) { nvme := &types.VirtualNVMEController{} nvme.BusNumber = l.newNVMEBusNumber() nvme.Key = l.NewKey() return nvme, nil }
go
func (l VirtualDeviceList) CreateNVMEController() (types.BaseVirtualDevice, error) { nvme := &types.VirtualNVMEController{} nvme.BusNumber = l.newNVMEBusNumber() nvme.Key = l.NewKey() return nvme, nil }
[ "func", "(", "l", "VirtualDeviceList", ")", "CreateNVMEController", "(", ")", "(", "types", ".", "BaseVirtualDevice", ",", "error", ")", "{", "nvme", ":=", "&", "types", ".", "VirtualNVMEController", "{", "}", "\n", "nvme", ".", "BusNumber", "=", "l", ".",...
// CreateNVMEController creates a new NVMWE controller.
[ "CreateNVMEController", "creates", "a", "new", "NVMWE", "controller", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/object/virtual_device_list.go#L307-L313
train
vmware/govmomi
object/virtual_device_list.go
newNVMEBusNumber
func (l VirtualDeviceList) newNVMEBusNumber() int32 { var used []int for _, d := range l.SelectByType((*types.VirtualNVMEController)(nil)) { num := d.(types.BaseVirtualController).GetVirtualController().BusNumber if num >= 0 { used = append(used, int(num)) } // else caller is creating a new vm using NVMECon...
go
func (l VirtualDeviceList) newNVMEBusNumber() int32 { var used []int for _, d := range l.SelectByType((*types.VirtualNVMEController)(nil)) { num := d.(types.BaseVirtualController).GetVirtualController().BusNumber if num >= 0 { used = append(used, int(num)) } // else caller is creating a new vm using NVMECon...
[ "func", "(", "l", "VirtualDeviceList", ")", "newNVMEBusNumber", "(", ")", "int32", "{", "var", "used", "[", "]", "int", "\n\n", "for", "_", ",", "d", ":=", "range", "l", ".", "SelectByType", "(", "(", "*", "types", ".", "VirtualNVMEController", ")", "(...
// newNVMEBusNumber returns the bus number to use for adding a new NVME bus device. // -1 is returned if there are no bus numbers available.
[ "newNVMEBusNumber", "returns", "the", "bus", "number", "to", "use", "for", "adding", "a", "new", "NVME", "bus", "device", ".", "-", "1", "is", "returned", "if", "there", "are", "no", "bus", "numbers", "available", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/object/virtual_device_list.go#L319-L338
train
vmware/govmomi
object/virtual_device_list.go
FindDiskController
func (l VirtualDeviceList) FindDiskController(name string) (types.BaseVirtualController, error) { switch { case name == "ide": return l.FindIDEController("") case name == "scsi" || name == "": return l.FindSCSIController("") case name == "nvme": return l.FindNVMEController("") default: if c, ok := l.Find(n...
go
func (l VirtualDeviceList) FindDiskController(name string) (types.BaseVirtualController, error) { switch { case name == "ide": return l.FindIDEController("") case name == "scsi" || name == "": return l.FindSCSIController("") case name == "nvme": return l.FindNVMEController("") default: if c, ok := l.Find(n...
[ "func", "(", "l", "VirtualDeviceList", ")", "FindDiskController", "(", "name", "string", ")", "(", "types", ".", "BaseVirtualController", ",", "error", ")", "{", "switch", "{", "case", "name", "==", "\"", "\"", ":", "return", "l", ".", "FindIDEController", ...
// FindDiskController will find an existing ide or scsi disk controller.
[ "FindDiskController", "will", "find", "an", "existing", "ide", "or", "scsi", "disk", "controller", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/object/virtual_device_list.go#L341-L355
train
vmware/govmomi
object/virtual_device_list.go
newUnitNumber
func (l VirtualDeviceList) newUnitNumber(c types.BaseVirtualController) int32 { units := make([]bool, 30) switch sc := c.(type) { case types.BaseVirtualSCSIController: // The SCSI controller sits on its own bus units[sc.GetVirtualSCSIController().ScsiCtlrUnitNumber] = true } key := c.GetVirtualController()....
go
func (l VirtualDeviceList) newUnitNumber(c types.BaseVirtualController) int32 { units := make([]bool, 30) switch sc := c.(type) { case types.BaseVirtualSCSIController: // The SCSI controller sits on its own bus units[sc.GetVirtualSCSIController().ScsiCtlrUnitNumber] = true } key := c.GetVirtualController()....
[ "func", "(", "l", "VirtualDeviceList", ")", "newUnitNumber", "(", "c", "types", ".", "BaseVirtualController", ")", "int32", "{", "units", ":=", "make", "(", "[", "]", "bool", ",", "30", ")", "\n\n", "switch", "sc", ":=", "c", ".", "(", "type", ")", "...
// newUnitNumber returns the unit number to use for attaching a new device to the given controller.
[ "newUnitNumber", "returns", "the", "unit", "number", "to", "use", "for", "attaching", "a", "new", "device", "to", "the", "given", "controller", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/object/virtual_device_list.go#L383-L409
train
vmware/govmomi
object/virtual_device_list.go
AssignController
func (l VirtualDeviceList) AssignController(device types.BaseVirtualDevice, c types.BaseVirtualController) { d := device.GetVirtualDevice() d.ControllerKey = c.GetVirtualController().Key d.UnitNumber = new(int32) *d.UnitNumber = l.newUnitNumber(c) if d.Key == 0 { d.Key = -1 } }
go
func (l VirtualDeviceList) AssignController(device types.BaseVirtualDevice, c types.BaseVirtualController) { d := device.GetVirtualDevice() d.ControllerKey = c.GetVirtualController().Key d.UnitNumber = new(int32) *d.UnitNumber = l.newUnitNumber(c) if d.Key == 0 { d.Key = -1 } }
[ "func", "(", "l", "VirtualDeviceList", ")", "AssignController", "(", "device", "types", ".", "BaseVirtualDevice", ",", "c", "types", ".", "BaseVirtualController", ")", "{", "d", ":=", "device", ".", "GetVirtualDevice", "(", ")", "\n", "d", ".", "ControllerKey"...
// AssignController assigns a device to a controller.
[ "AssignController", "assigns", "a", "device", "to", "a", "controller", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/object/virtual_device_list.go#L430-L438
train
vmware/govmomi
object/virtual_device_list.go
CreateDisk
func (l VirtualDeviceList) CreateDisk(c types.BaseVirtualController, ds types.ManagedObjectReference, name string) *types.VirtualDisk { // If name is not specified, one will be chosen for you. // But if when given, make sure it ends in .vmdk, otherwise it will be treated as a directory. if len(name) > 0 && filepath....
go
func (l VirtualDeviceList) CreateDisk(c types.BaseVirtualController, ds types.ManagedObjectReference, name string) *types.VirtualDisk { // If name is not specified, one will be chosen for you. // But if when given, make sure it ends in .vmdk, otherwise it will be treated as a directory. if len(name) > 0 && filepath....
[ "func", "(", "l", "VirtualDeviceList", ")", "CreateDisk", "(", "c", "types", ".", "BaseVirtualController", ",", "ds", "types", ".", "ManagedObjectReference", ",", "name", "string", ")", "*", "types", ".", "VirtualDisk", "{", "// If name is not specified, one will be...
// CreateDisk creates a new VirtualDisk device which can be added to a VM.
[ "CreateDisk", "creates", "a", "new", "VirtualDisk", "device", "which", "can", "be", "added", "to", "a", "VM", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/object/virtual_device_list.go#L441-L463
train
vmware/govmomi
object/virtual_device_list.go
ChildDisk
func (l VirtualDeviceList) ChildDisk(parent *types.VirtualDisk) *types.VirtualDisk { disk := *parent backing := disk.Backing.(*types.VirtualDiskFlatVer2BackingInfo) p := new(DatastorePath) p.FromString(backing.FileName) p.Path = "" // Use specified disk as parent backing to a new disk. disk.Backing = &types.Vir...
go
func (l VirtualDeviceList) ChildDisk(parent *types.VirtualDisk) *types.VirtualDisk { disk := *parent backing := disk.Backing.(*types.VirtualDiskFlatVer2BackingInfo) p := new(DatastorePath) p.FromString(backing.FileName) p.Path = "" // Use specified disk as parent backing to a new disk. disk.Backing = &types.Vir...
[ "func", "(", "l", "VirtualDeviceList", ")", "ChildDisk", "(", "parent", "*", "types", ".", "VirtualDisk", ")", "*", "types", ".", "VirtualDisk", "{", "disk", ":=", "*", "parent", "\n", "backing", ":=", "disk", ".", "Backing", ".", "(", "*", "types", "....
// ChildDisk creates a new VirtualDisk device, linked to the given parent disk, which can be added to a VM.
[ "ChildDisk", "creates", "a", "new", "VirtualDisk", "device", "linked", "to", "the", "given", "parent", "disk", "which", "can", "be", "added", "to", "a", "VM", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/object/virtual_device_list.go#L466-L485
train
vmware/govmomi
object/virtual_device_list.go
Connect
func (l VirtualDeviceList) Connect(device types.BaseVirtualDevice) error { return l.connectivity(device, true) }
go
func (l VirtualDeviceList) Connect(device types.BaseVirtualDevice) error { return l.connectivity(device, true) }
[ "func", "(", "l", "VirtualDeviceList", ")", "Connect", "(", "device", "types", ".", "BaseVirtualDevice", ")", "error", "{", "return", "l", ".", "connectivity", "(", "device", ",", "true", ")", "\n", "}" ]
// Connect changes the device to connected, returns an error if the device is not connectable.
[ "Connect", "changes", "the", "device", "to", "connected", "returns", "an", "error", "if", "the", "device", "is", "not", "connectable", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/object/virtual_device_list.go#L500-L502
train
vmware/govmomi
object/virtual_device_list.go
Disconnect
func (l VirtualDeviceList) Disconnect(device types.BaseVirtualDevice) error { return l.connectivity(device, false) }
go
func (l VirtualDeviceList) Disconnect(device types.BaseVirtualDevice) error { return l.connectivity(device, false) }
[ "func", "(", "l", "VirtualDeviceList", ")", "Disconnect", "(", "device", "types", ".", "BaseVirtualDevice", ")", "error", "{", "return", "l", ".", "connectivity", "(", "device", ",", "false", ")", "\n", "}" ]
// Disconnect changes the device to disconnected, returns an error if the device is not connectable.
[ "Disconnect", "changes", "the", "device", "to", "disconnected", "returns", "an", "error", "if", "the", "device", "is", "not", "connectable", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/object/virtual_device_list.go#L505-L507
train
vmware/govmomi
object/virtual_device_list.go
FindCdrom
func (l VirtualDeviceList) FindCdrom(name string) (*types.VirtualCdrom, error) { if name != "" { d := l.Find(name) if d == nil { return nil, fmt.Errorf("device '%s' not found", name) } if c, ok := d.(*types.VirtualCdrom); ok { return c, nil } return nil, fmt.Errorf("%s is not a cdrom device", name) ...
go
func (l VirtualDeviceList) FindCdrom(name string) (*types.VirtualCdrom, error) { if name != "" { d := l.Find(name) if d == nil { return nil, fmt.Errorf("device '%s' not found", name) } if c, ok := d.(*types.VirtualCdrom); ok { return c, nil } return nil, fmt.Errorf("%s is not a cdrom device", name) ...
[ "func", "(", "l", "VirtualDeviceList", ")", "FindCdrom", "(", "name", "string", ")", "(", "*", "types", ".", "VirtualCdrom", ",", "error", ")", "{", "if", "name", "!=", "\"", "\"", "{", "d", ":=", "l", ".", "Find", "(", "name", ")", "\n", "if", "...
// FindCdrom finds a cdrom device with the given name, defaulting to the first cdrom device if any.
[ "FindCdrom", "finds", "a", "cdrom", "device", "with", "the", "given", "name", "defaulting", "to", "the", "first", "cdrom", "device", "if", "any", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/object/virtual_device_list.go#L510-L528
train
vmware/govmomi
object/virtual_device_list.go
CreateCdrom
func (l VirtualDeviceList) CreateCdrom(c *types.VirtualIDEController) (*types.VirtualCdrom, error) { device := &types.VirtualCdrom{} l.AssignController(device, c) l.setDefaultCdromBacking(device) device.Connectable = &types.VirtualDeviceConnectInfo{ AllowGuestControl: true, Connected: true, StartCo...
go
func (l VirtualDeviceList) CreateCdrom(c *types.VirtualIDEController) (*types.VirtualCdrom, error) { device := &types.VirtualCdrom{} l.AssignController(device, c) l.setDefaultCdromBacking(device) device.Connectable = &types.VirtualDeviceConnectInfo{ AllowGuestControl: true, Connected: true, StartCo...
[ "func", "(", "l", "VirtualDeviceList", ")", "CreateCdrom", "(", "c", "*", "types", ".", "VirtualIDEController", ")", "(", "*", "types", ".", "VirtualCdrom", ",", "error", ")", "{", "device", ":=", "&", "types", ".", "VirtualCdrom", "{", "}", "\n\n", "l",...
// CreateCdrom creates a new VirtualCdrom device which can be added to a VM.
[ "CreateCdrom", "creates", "a", "new", "VirtualCdrom", "device", "which", "can", "be", "added", "to", "a", "VM", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/object/virtual_device_list.go#L531-L545
train
vmware/govmomi
object/virtual_device_list.go
InsertIso
func (l VirtualDeviceList) InsertIso(device *types.VirtualCdrom, iso string) *types.VirtualCdrom { device.Backing = &types.VirtualCdromIsoBackingInfo{ VirtualDeviceFileBackingInfo: types.VirtualDeviceFileBackingInfo{ FileName: iso, }, } return device }
go
func (l VirtualDeviceList) InsertIso(device *types.VirtualCdrom, iso string) *types.VirtualCdrom { device.Backing = &types.VirtualCdromIsoBackingInfo{ VirtualDeviceFileBackingInfo: types.VirtualDeviceFileBackingInfo{ FileName: iso, }, } return device }
[ "func", "(", "l", "VirtualDeviceList", ")", "InsertIso", "(", "device", "*", "types", ".", "VirtualCdrom", ",", "iso", "string", ")", "*", "types", ".", "VirtualCdrom", "{", "device", ".", "Backing", "=", "&", "types", ".", "VirtualCdromIsoBackingInfo", "{",...
// InsertIso changes the cdrom device backing to use the given iso file.
[ "InsertIso", "changes", "the", "cdrom", "device", "backing", "to", "use", "the", "given", "iso", "file", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/object/virtual_device_list.go#L548-L556
train
vmware/govmomi
object/virtual_device_list.go
EjectIso
func (l VirtualDeviceList) EjectIso(device *types.VirtualCdrom) *types.VirtualCdrom { l.setDefaultCdromBacking(device) return device }
go
func (l VirtualDeviceList) EjectIso(device *types.VirtualCdrom) *types.VirtualCdrom { l.setDefaultCdromBacking(device) return device }
[ "func", "(", "l", "VirtualDeviceList", ")", "EjectIso", "(", "device", "*", "types", ".", "VirtualCdrom", ")", "*", "types", ".", "VirtualCdrom", "{", "l", ".", "setDefaultCdromBacking", "(", "device", ")", "\n", "return", "device", "\n", "}" ]
// EjectIso removes the iso file based backing and replaces with the default cdrom backing.
[ "EjectIso", "removes", "the", "iso", "file", "based", "backing", "and", "replaces", "with", "the", "default", "cdrom", "backing", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/object/virtual_device_list.go#L559-L562
train
vmware/govmomi
object/virtual_device_list.go
CreateFloppy
func (l VirtualDeviceList) CreateFloppy() (*types.VirtualFloppy, error) { device := &types.VirtualFloppy{} c := l.PickController((*types.VirtualSIOController)(nil)) if c == nil { return nil, errors.New("no available SIO controller") } l.AssignController(device, c) l.setDefaultFloppyBacking(device) device.C...
go
func (l VirtualDeviceList) CreateFloppy() (*types.VirtualFloppy, error) { device := &types.VirtualFloppy{} c := l.PickController((*types.VirtualSIOController)(nil)) if c == nil { return nil, errors.New("no available SIO controller") } l.AssignController(device, c) l.setDefaultFloppyBacking(device) device.C...
[ "func", "(", "l", "VirtualDeviceList", ")", "CreateFloppy", "(", ")", "(", "*", "types", ".", "VirtualFloppy", ",", "error", ")", "{", "device", ":=", "&", "types", ".", "VirtualFloppy", "{", "}", "\n\n", "c", ":=", "l", ".", "PickController", "(", "("...
// CreateFloppy creates a new VirtualFloppy device which can be added to a VM.
[ "CreateFloppy", "creates", "a", "new", "VirtualFloppy", "device", "which", "can", "be", "added", "to", "a", "VM", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/object/virtual_device_list.go#L595-L614
train
vmware/govmomi
object/virtual_device_list.go
InsertImg
func (l VirtualDeviceList) InsertImg(device *types.VirtualFloppy, img string) *types.VirtualFloppy { device.Backing = &types.VirtualFloppyImageBackingInfo{ VirtualDeviceFileBackingInfo: types.VirtualDeviceFileBackingInfo{ FileName: img, }, } return device }
go
func (l VirtualDeviceList) InsertImg(device *types.VirtualFloppy, img string) *types.VirtualFloppy { device.Backing = &types.VirtualFloppyImageBackingInfo{ VirtualDeviceFileBackingInfo: types.VirtualDeviceFileBackingInfo{ FileName: img, }, } return device }
[ "func", "(", "l", "VirtualDeviceList", ")", "InsertImg", "(", "device", "*", "types", ".", "VirtualFloppy", ",", "img", "string", ")", "*", "types", ".", "VirtualFloppy", "{", "device", ".", "Backing", "=", "&", "types", ".", "VirtualFloppyImageBackingInfo", ...
// InsertImg changes the floppy device backing to use the given img file.
[ "InsertImg", "changes", "the", "floppy", "device", "backing", "to", "use", "the", "given", "img", "file", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/object/virtual_device_list.go#L617-L625
train
vmware/govmomi
object/virtual_device_list.go
EjectImg
func (l VirtualDeviceList) EjectImg(device *types.VirtualFloppy) *types.VirtualFloppy { l.setDefaultFloppyBacking(device) return device }
go
func (l VirtualDeviceList) EjectImg(device *types.VirtualFloppy) *types.VirtualFloppy { l.setDefaultFloppyBacking(device) return device }
[ "func", "(", "l", "VirtualDeviceList", ")", "EjectImg", "(", "device", "*", "types", ".", "VirtualFloppy", ")", "*", "types", ".", "VirtualFloppy", "{", "l", ".", "setDefaultFloppyBacking", "(", "device", ")", "\n", "return", "device", "\n", "}" ]
// EjectImg removes the img file based backing and replaces with the default floppy backing.
[ "EjectImg", "removes", "the", "img", "file", "based", "backing", "and", "replaces", "with", "the", "default", "floppy", "backing", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/object/virtual_device_list.go#L628-L631
train
vmware/govmomi
object/virtual_device_list.go
CreateSerialPort
func (l VirtualDeviceList) CreateSerialPort() (*types.VirtualSerialPort, error) { device := &types.VirtualSerialPort{ YieldOnPoll: true, } c := l.PickController((*types.VirtualSIOController)(nil)) if c == nil { return nil, errors.New("no available SIO controller") } l.AssignController(device, c) l.setDefa...
go
func (l VirtualDeviceList) CreateSerialPort() (*types.VirtualSerialPort, error) { device := &types.VirtualSerialPort{ YieldOnPoll: true, } c := l.PickController((*types.VirtualSIOController)(nil)) if c == nil { return nil, errors.New("no available SIO controller") } l.AssignController(device, c) l.setDefa...
[ "func", "(", "l", "VirtualDeviceList", ")", "CreateSerialPort", "(", ")", "(", "*", "types", ".", "VirtualSerialPort", ",", "error", ")", "{", "device", ":=", "&", "types", ".", "VirtualSerialPort", "{", "YieldOnPoll", ":", "true", ",", "}", "\n\n", "c", ...
// CreateSerialPort creates a new VirtualSerialPort device which can be added to a VM.
[ "CreateSerialPort", "creates", "a", "new", "VirtualSerialPort", "device", "which", "can", "be", "added", "to", "a", "VM", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/object/virtual_device_list.go#L664-L679
train
vmware/govmomi
object/virtual_device_list.go
ConnectSerialPort
func (l VirtualDeviceList) ConnectSerialPort(device *types.VirtualSerialPort, uri string, client bool, proxyuri string) *types.VirtualSerialPort { if strings.HasPrefix(uri, "[") { device.Backing = &types.VirtualSerialPortFileBackingInfo{ VirtualDeviceFileBackingInfo: types.VirtualDeviceFileBackingInfo{ FileNa...
go
func (l VirtualDeviceList) ConnectSerialPort(device *types.VirtualSerialPort, uri string, client bool, proxyuri string) *types.VirtualSerialPort { if strings.HasPrefix(uri, "[") { device.Backing = &types.VirtualSerialPortFileBackingInfo{ VirtualDeviceFileBackingInfo: types.VirtualDeviceFileBackingInfo{ FileNa...
[ "func", "(", "l", "VirtualDeviceList", ")", "ConnectSerialPort", "(", "device", "*", "types", ".", "VirtualSerialPort", ",", "uri", "string", ",", "client", "bool", ",", "proxyuri", "string", ")", "*", "types", ".", "VirtualSerialPort", "{", "if", "strings", ...
// ConnectSerialPort connects a serial port to a server or client uri.
[ "ConnectSerialPort", "connects", "a", "serial", "port", "to", "a", "server", "or", "client", "uri", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/object/virtual_device_list.go#L682-L707
train
vmware/govmomi
object/virtual_device_list.go
DisconnectSerialPort
func (l VirtualDeviceList) DisconnectSerialPort(device *types.VirtualSerialPort) *types.VirtualSerialPort { l.setDefaultSerialPortBacking(device) return device }
go
func (l VirtualDeviceList) DisconnectSerialPort(device *types.VirtualSerialPort) *types.VirtualSerialPort { l.setDefaultSerialPortBacking(device) return device }
[ "func", "(", "l", "VirtualDeviceList", ")", "DisconnectSerialPort", "(", "device", "*", "types", ".", "VirtualSerialPort", ")", "*", "types", ".", "VirtualSerialPort", "{", "l", ".", "setDefaultSerialPortBacking", "(", "device", ")", "\n", "return", "device", "\...
// DisconnectSerialPort disconnects the serial port backing.
[ "DisconnectSerialPort", "disconnects", "the", "serial", "port", "backing", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/object/virtual_device_list.go#L710-L713
train
vmware/govmomi
object/virtual_device_list.go
CreateEthernetCard
func (l VirtualDeviceList) CreateEthernetCard(name string, backing types.BaseVirtualDeviceBackingInfo) (types.BaseVirtualDevice, error) { ctypes := EthernetCardTypes() if name == "" { name = ctypes.deviceName(ctypes[0]) } found := ctypes.Select(func(device types.BaseVirtualDevice) bool { return l.deviceName(d...
go
func (l VirtualDeviceList) CreateEthernetCard(name string, backing types.BaseVirtualDeviceBackingInfo) (types.BaseVirtualDevice, error) { ctypes := EthernetCardTypes() if name == "" { name = ctypes.deviceName(ctypes[0]) } found := ctypes.Select(func(device types.BaseVirtualDevice) bool { return l.deviceName(d...
[ "func", "(", "l", "VirtualDeviceList", ")", "CreateEthernetCard", "(", "name", "string", ",", "backing", "types", ".", "BaseVirtualDeviceBackingInfo", ")", "(", "types", ".", "BaseVirtualDevice", ",", "error", ")", "{", "ctypes", ":=", "EthernetCardTypes", "(", ...
// CreateEthernetCard creates a new VirtualEthernetCard of the given name name and initialized with the given backing.
[ "CreateEthernetCard", "creates", "a", "new", "VirtualEthernetCard", "of", "the", "given", "name", "name", "and", "initialized", "with", "the", "given", "backing", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/object/virtual_device_list.go#L725-L748
train
vmware/govmomi
object/virtual_device_list.go
PrimaryMacAddress
func (l VirtualDeviceList) PrimaryMacAddress() string { eth0 := l.Find("ethernet-0") if eth0 == nil { return "" } return eth0.(types.BaseVirtualEthernetCard).GetVirtualEthernetCard().MacAddress }
go
func (l VirtualDeviceList) PrimaryMacAddress() string { eth0 := l.Find("ethernet-0") if eth0 == nil { return "" } return eth0.(types.BaseVirtualEthernetCard).GetVirtualEthernetCard().MacAddress }
[ "func", "(", "l", "VirtualDeviceList", ")", "PrimaryMacAddress", "(", ")", "string", "{", "eth0", ":=", "l", ".", "Find", "(", "\"", "\"", ")", "\n\n", "if", "eth0", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n\n", "return", "eth0", ".", ...
// PrimaryMacAddress returns the MacAddress field of the primary VirtualEthernetCard
[ "PrimaryMacAddress", "returns", "the", "MacAddress", "field", "of", "the", "primary", "VirtualEthernetCard" ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/object/virtual_device_list.go#L751-L759
train
vmware/govmomi
object/virtual_device_list.go
SelectBootOrder
func (l VirtualDeviceList) SelectBootOrder(order []types.BaseVirtualMachineBootOptionsBootableDevice) VirtualDeviceList { var devices VirtualDeviceList for _, bd := range order { for _, device := range l { if kind, ok := bootableDevices[l.Type(device)]; ok { if reflect.DeepEqual(kind(device), bd) { dev...
go
func (l VirtualDeviceList) SelectBootOrder(order []types.BaseVirtualMachineBootOptionsBootableDevice) VirtualDeviceList { var devices VirtualDeviceList for _, bd := range order { for _, device := range l { if kind, ok := bootableDevices[l.Type(device)]; ok { if reflect.DeepEqual(kind(device), bd) { dev...
[ "func", "(", "l", "VirtualDeviceList", ")", "SelectBootOrder", "(", "order", "[", "]", "types", ".", "BaseVirtualMachineBootOptionsBootableDevice", ")", "VirtualDeviceList", "{", "var", "devices", "VirtualDeviceList", "\n\n", "for", "_", ",", "bd", ":=", "range", ...
// SelectBootOrder returns an ordered list of devices matching the given bootable device order
[ "SelectBootOrder", "returns", "an", "ordered", "list", "of", "devices", "matching", "the", "given", "bootable", "device", "order" ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/object/virtual_device_list.go#L817-L831
train
vmware/govmomi
object/virtual_device_list.go
TypeName
func (l VirtualDeviceList) TypeName(device types.BaseVirtualDevice) string { dtype := reflect.TypeOf(device) if dtype == nil { return "" } return dtype.Elem().Name() }
go
func (l VirtualDeviceList) TypeName(device types.BaseVirtualDevice) string { dtype := reflect.TypeOf(device) if dtype == nil { return "" } return dtype.Elem().Name() }
[ "func", "(", "l", "VirtualDeviceList", ")", "TypeName", "(", "device", "types", ".", "BaseVirtualDevice", ")", "string", "{", "dtype", ":=", "reflect", ".", "TypeOf", "(", "device", ")", "\n", "if", "dtype", "==", "nil", "{", "return", "\"", "\"", "\n", ...
// TypeName returns the vmodl type name of the device
[ "TypeName", "returns", "the", "vmodl", "type", "name", "of", "the", "device" ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/object/virtual_device_list.go#L834-L840
train
vmware/govmomi
object/virtual_device_list.go
Type
func (l VirtualDeviceList) Type(device types.BaseVirtualDevice) string { switch device.(type) { case types.BaseVirtualEthernetCard: return DeviceTypeEthernet case *types.ParaVirtualSCSIController: return "pvscsi" case *types.VirtualLsiLogicSASController: return "lsilogic-sas" case *types.VirtualNVMEControlle...
go
func (l VirtualDeviceList) Type(device types.BaseVirtualDevice) string { switch device.(type) { case types.BaseVirtualEthernetCard: return DeviceTypeEthernet case *types.ParaVirtualSCSIController: return "pvscsi" case *types.VirtualLsiLogicSASController: return "lsilogic-sas" case *types.VirtualNVMEControlle...
[ "func", "(", "l", "VirtualDeviceList", ")", "Type", "(", "device", "types", ".", "BaseVirtualDevice", ")", "string", "{", "switch", "device", ".", "(", "type", ")", "{", "case", "types", ".", "BaseVirtualEthernetCard", ":", "return", "DeviceTypeEthernet", "\n"...
// Type returns a human-readable name for the given device
[ "Type", "returns", "a", "human", "-", "readable", "name", "for", "the", "given", "device" ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/object/virtual_device_list.go#L857-L870
train
vmware/govmomi
object/virtual_device_list.go
Name
func (l VirtualDeviceList) Name(device types.BaseVirtualDevice) string { var key string var UnitNumber int32 d := device.GetVirtualDevice() if d.UnitNumber != nil { UnitNumber = *d.UnitNumber } dtype := l.Type(device) switch dtype { case DeviceTypeEthernet: key = fmt.Sprintf("%d", UnitNumber-7) case Devic...
go
func (l VirtualDeviceList) Name(device types.BaseVirtualDevice) string { var key string var UnitNumber int32 d := device.GetVirtualDevice() if d.UnitNumber != nil { UnitNumber = *d.UnitNumber } dtype := l.Type(device) switch dtype { case DeviceTypeEthernet: key = fmt.Sprintf("%d", UnitNumber-7) case Devic...
[ "func", "(", "l", "VirtualDeviceList", ")", "Name", "(", "device", "types", ".", "BaseVirtualDevice", ")", "string", "{", "var", "key", "string", "\n", "var", "UnitNumber", "int32", "\n", "d", ":=", "device", ".", "GetVirtualDevice", "(", ")", "\n", "if", ...
// Name returns a stable, human-readable name for the given device
[ "Name", "returns", "a", "stable", "human", "-", "readable", "name", "for", "the", "given", "device" ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/object/virtual_device_list.go#L873-L892
train
vmware/govmomi
object/virtual_device_list.go
ConfigSpec
func (l VirtualDeviceList) ConfigSpec(op types.VirtualDeviceConfigSpecOperation) ([]types.BaseVirtualDeviceConfigSpec, error) { var fop types.VirtualDeviceConfigSpecFileOperation switch op { case types.VirtualDeviceConfigSpecOperationAdd: fop = types.VirtualDeviceConfigSpecFileOperationCreate case types.VirtualDe...
go
func (l VirtualDeviceList) ConfigSpec(op types.VirtualDeviceConfigSpecOperation) ([]types.BaseVirtualDeviceConfigSpec, error) { var fop types.VirtualDeviceConfigSpecFileOperation switch op { case types.VirtualDeviceConfigSpecOperationAdd: fop = types.VirtualDeviceConfigSpecFileOperationCreate case types.VirtualDe...
[ "func", "(", "l", "VirtualDeviceList", ")", "ConfigSpec", "(", "op", "types", ".", "VirtualDeviceConfigSpecOperation", ")", "(", "[", "]", "types", ".", "BaseVirtualDeviceConfigSpec", ",", "error", ")", "{", "var", "fop", "types", ".", "VirtualDeviceConfigSpecFile...
// ConfigSpec creates a virtual machine configuration spec for // the specified operation, for the list of devices in the device list.
[ "ConfigSpec", "creates", "a", "virtual", "machine", "configuration", "spec", "for", "the", "specified", "operation", "for", "the", "list", "of", "devices", "in", "the", "device", "list", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/object/virtual_device_list.go#L896-L937
train
vmware/govmomi
object/host_certificate_manager.go
NewHostCertificateManager
func NewHostCertificateManager(c *vim25.Client, ref types.ManagedObjectReference, host types.ManagedObjectReference) *HostCertificateManager { return &HostCertificateManager{ Common: NewCommon(c, ref), Host: NewHostSystem(c, host), } }
go
func NewHostCertificateManager(c *vim25.Client, ref types.ManagedObjectReference, host types.ManagedObjectReference) *HostCertificateManager { return &HostCertificateManager{ Common: NewCommon(c, ref), Host: NewHostSystem(c, host), } }
[ "func", "NewHostCertificateManager", "(", "c", "*", "vim25", ".", "Client", ",", "ref", "types", ".", "ManagedObjectReference", ",", "host", "types", ".", "ManagedObjectReference", ")", "*", "HostCertificateManager", "{", "return", "&", "HostCertificateManager", "{"...
// NewHostCertificateManager creates a new HostCertificateManager helper
[ "NewHostCertificateManager", "creates", "a", "new", "HostCertificateManager", "helper" ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/object/host_certificate_manager.go#L36-L41
train
vmware/govmomi
object/host_certificate_manager.go
CertificateInfo
func (m HostCertificateManager) CertificateInfo(ctx context.Context) (*HostCertificateInfo, error) { var hs mo.HostSystem var cm mo.HostCertificateManager pc := property.DefaultCollector(m.Client()) err := pc.RetrieveOne(ctx, m.Reference(), []string{"certificateInfo"}, &cm) if err != nil { return nil, err } ...
go
func (m HostCertificateManager) CertificateInfo(ctx context.Context) (*HostCertificateInfo, error) { var hs mo.HostSystem var cm mo.HostCertificateManager pc := property.DefaultCollector(m.Client()) err := pc.RetrieveOne(ctx, m.Reference(), []string{"certificateInfo"}, &cm) if err != nil { return nil, err } ...
[ "func", "(", "m", "HostCertificateManager", ")", "CertificateInfo", "(", "ctx", "context", ".", "Context", ")", "(", "*", "HostCertificateInfo", ",", "error", ")", "{", "var", "hs", "mo", ".", "HostSystem", "\n", "var", "cm", "mo", ".", "HostCertificateManag...
// CertificateInfo wraps the host CertificateManager certificateInfo property with the HostCertificateInfo helper. // The ThumbprintSHA1 field is set to HostSystem.Summary.Config.SslThumbprint if the host system is managed by a vCenter.
[ "CertificateInfo", "wraps", "the", "host", "CertificateManager", "certificateInfo", "property", "with", "the", "HostCertificateInfo", "helper", ".", "The", "ThumbprintSHA1", "field", "is", "set", "to", "HostSystem", ".", "Summary", ".", "Config", ".", "SslThumbprint",...
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/object/host_certificate_manager.go#L45-L62
train
vmware/govmomi
object/host_certificate_manager.go
InstallServerCertificate
func (m HostCertificateManager) InstallServerCertificate(ctx context.Context, cert string) error { req := types.InstallServerCertificate{ This: m.Reference(), Cert: cert, } _, err := methods.InstallServerCertificate(ctx, m.Client(), &req) if err != nil { return err } // NotifyAffectedService is internal, ...
go
func (m HostCertificateManager) InstallServerCertificate(ctx context.Context, cert string) error { req := types.InstallServerCertificate{ This: m.Reference(), Cert: cert, } _, err := methods.InstallServerCertificate(ctx, m.Client(), &req) if err != nil { return err } // NotifyAffectedService is internal, ...
[ "func", "(", "m", "HostCertificateManager", ")", "InstallServerCertificate", "(", "ctx", "context", ".", "Context", ",", "cert", "string", ")", "error", "{", "req", ":=", "types", ".", "InstallServerCertificate", "{", "This", ":", "m", ".", "Reference", "(", ...
// InstallServerCertificate imports the given SSL certificate to the host system.
[ "InstallServerCertificate", "imports", "the", "given", "SSL", "certificate", "to", "the", "host", "system", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/object/host_certificate_manager.go#L98-L121
train
vmware/govmomi
object/host_certificate_manager.go
ListCACertificateRevocationLists
func (m HostCertificateManager) ListCACertificateRevocationLists(ctx context.Context) ([]string, error) { req := types.ListCACertificateRevocationLists{ This: m.Reference(), } res, err := methods.ListCACertificateRevocationLists(ctx, m.Client(), &req) if err != nil { return nil, err } return res.Returnval, ...
go
func (m HostCertificateManager) ListCACertificateRevocationLists(ctx context.Context) ([]string, error) { req := types.ListCACertificateRevocationLists{ This: m.Reference(), } res, err := methods.ListCACertificateRevocationLists(ctx, m.Client(), &req) if err != nil { return nil, err } return res.Returnval, ...
[ "func", "(", "m", "HostCertificateManager", ")", "ListCACertificateRevocationLists", "(", "ctx", "context", ".", "Context", ")", "(", "[", "]", "string", ",", "error", ")", "{", "req", ":=", "types", ".", "ListCACertificateRevocationLists", "{", "This", ":", "...
// ListCACertificateRevocationLists returns the SSL CRLs of Certificate Authorities that are trusted by the host system.
[ "ListCACertificateRevocationLists", "returns", "the", "SSL", "CRLs", "of", "Certificate", "Authorities", "that", "are", "trusted", "by", "the", "host", "system", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/object/host_certificate_manager.go#L124-L135
train
vmware/govmomi
object/host_certificate_manager.go
ReplaceCACertificatesAndCRLs
func (m HostCertificateManager) ReplaceCACertificatesAndCRLs(ctx context.Context, caCert []string, caCrl []string) error { req := types.ReplaceCACertificatesAndCRLs{ This: m.Reference(), CaCert: caCert, CaCrl: caCrl, } _, err := methods.ReplaceCACertificatesAndCRLs(ctx, m.Client(), &req) return err }
go
func (m HostCertificateManager) ReplaceCACertificatesAndCRLs(ctx context.Context, caCert []string, caCrl []string) error { req := types.ReplaceCACertificatesAndCRLs{ This: m.Reference(), CaCert: caCert, CaCrl: caCrl, } _, err := methods.ReplaceCACertificatesAndCRLs(ctx, m.Client(), &req) return err }
[ "func", "(", "m", "HostCertificateManager", ")", "ReplaceCACertificatesAndCRLs", "(", "ctx", "context", ".", "Context", ",", "caCert", "[", "]", "string", ",", "caCrl", "[", "]", "string", ")", "error", "{", "req", ":=", "types", ".", "ReplaceCACertificatesAnd...
// ReplaceCACertificatesAndCRLs replaces the trusted CA certificates and CRL used by the host system. // These determine whether the server can verify the identity of an external entity.
[ "ReplaceCACertificatesAndCRLs", "replaces", "the", "trusted", "CA", "certificates", "and", "CRL", "used", "by", "the", "host", "system", ".", "These", "determine", "whether", "the", "server", "can", "verify", "the", "identity", "of", "an", "external", "entity", ...
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/object/host_certificate_manager.go#L153-L162
train
vmware/govmomi
simulator/session_manager.go
mapSession
func (c *Context) mapSession() { if cookie, err := c.req.Cookie(soap.SessionCookieName); err == nil { if val, ok := c.svc.sm.sessions[cookie.Value]; ok { c.SetSession(val, false) } } }
go
func (c *Context) mapSession() { if cookie, err := c.req.Cookie(soap.SessionCookieName); err == nil { if val, ok := c.svc.sm.sessions[cookie.Value]; ok { c.SetSession(val, false) } } }
[ "func", "(", "c", "*", "Context", ")", "mapSession", "(", ")", "{", "if", "cookie", ",", "err", ":=", "c", ".", "req", ".", "Cookie", "(", "soap", ".", "SessionCookieName", ")", ";", "err", "==", "nil", "{", "if", "val", ",", "ok", ":=", "c", "...
// mapSession maps an HTTP cookie to a Session.
[ "mapSession", "maps", "an", "HTTP", "cookie", "to", "a", "Session", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/simulator/session_manager.go#L265-L271
train