id
int32
0
167k
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
listlengths
21
1.41k
docstring
stringlengths
6
2.61k
docstring_tokens
listlengths
3
215
sha
stringlengths
40
40
url
stringlengths
85
252
21,200
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
21,201
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
21,202
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
21,203
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
21,204
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
21,205
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
21,206
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
21,207
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
21,208
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
21,209
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
21,210
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
21,211
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
21,212
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
21,213
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
21,214
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
21,215
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
21,216
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
21,217
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
21,218
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
21,219
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
21,220
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
21,221
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
21,222
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
21,223
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
21,224
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
21,225
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
21,226
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
21,227
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
21,228
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
21,229
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
21,230
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
21,231
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
21,232
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
21,233
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
21,234
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
21,235
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
21,236
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
21,237
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
21,238
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
21,239
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
21,240
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
21,241
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
21,242
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
21,243
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
21,244
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
21,245
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
21,246
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
21,247
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
21,248
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
21,249
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
21,250
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
21,251
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
21,252
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
21,253
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
21,254
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
21,255
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
21,256
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
21,257
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
21,258
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
21,259
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
21,260
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
21,261
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
21,262
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
21,263
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
21,264
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
21,265
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
21,266
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
21,267
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
21,268
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
21,269
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
21,270
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
21,271
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
21,272
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
21,273
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
21,274
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
21,275
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
21,276
vmware/govmomi
simulator/session_manager.go
SetSession
func (c *Context) SetSession(session Session, login bool) { session.UserAgent = c.req.UserAgent() session.IpAddress = strings.Split(c.req.RemoteAddr, ":")[0] session.LastActiveTime = time.Now() session.CallCount++ c.svc.sm.sessions[session.Key] = session c.Session = &session if login { http.SetCookie(c.res, ...
go
func (c *Context) SetSession(session Session, login bool) { session.UserAgent = c.req.UserAgent() session.IpAddress = strings.Split(c.req.RemoteAddr, ":")[0] session.LastActiveTime = time.Now() session.CallCount++ c.svc.sm.sessions[session.Key] = session c.Session = &session if login { http.SetCookie(c.res, ...
[ "func", "(", "c", "*", "Context", ")", "SetSession", "(", "session", "Session", ",", "login", "bool", ")", "{", "session", ".", "UserAgent", "=", "c", ".", "req", ".", "UserAgent", "(", ")", "\n", "session", ".", "IpAddress", "=", "strings", ".", "Sp...
// SetSession should be called after successful authentication.
[ "SetSession", "should", "be", "called", "after", "successful", "authentication", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/simulator/session_manager.go#L274-L296
21,277
vmware/govmomi
simulator/session_manager.go
postEvent
func (c *Context) postEvent(events ...types.BaseEvent) { m := Map.EventManager() c.WithLock(m, func() { for _, event := range events { m.PostEvent(c, &types.PostEvent{EventToPost: event}) } }) }
go
func (c *Context) postEvent(events ...types.BaseEvent) { m := Map.EventManager() c.WithLock(m, func() { for _, event := range events { m.PostEvent(c, &types.PostEvent{EventToPost: event}) } }) }
[ "func", "(", "c", "*", "Context", ")", "postEvent", "(", "events", "...", "types", ".", "BaseEvent", ")", "{", "m", ":=", "Map", ".", "EventManager", "(", ")", "\n", "c", ".", "WithLock", "(", "m", ",", "func", "(", ")", "{", "for", "_", ",", "...
// postEvent wraps EventManager.PostEvent for internal use, with a lock on the EventManager.
[ "postEvent", "wraps", "EventManager", ".", "PostEvent", "for", "internal", "use", "with", "a", "lock", "on", "the", "EventManager", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/simulator/session_manager.go#L309-L316
21,278
vmware/govmomi
simulator/session_manager.go
Put
func (s *Session) Put(item mo.Reference) mo.Reference { ref := item.Reference() if ref.Value == "" { ref.Value = fmt.Sprintf("session[%s]%s", s.Key, uuid.New()) } s.Registry.setReference(item, ref) return s.Registry.Put(item) }
go
func (s *Session) Put(item mo.Reference) mo.Reference { ref := item.Reference() if ref.Value == "" { ref.Value = fmt.Sprintf("session[%s]%s", s.Key, uuid.New()) } s.Registry.setReference(item, ref) return s.Registry.Put(item) }
[ "func", "(", "s", "*", "Session", ")", "Put", "(", "item", "mo", ".", "Reference", ")", "mo", ".", "Reference", "{", "ref", ":=", "item", ".", "Reference", "(", ")", "\n", "if", "ref", ".", "Value", "==", "\"", "\"", "{", "ref", ".", "Value", "...
// Put wraps Registry.Put, setting the moref value to include the session key.
[ "Put", "wraps", "Registry", ".", "Put", "setting", "the", "moref", "value", "to", "include", "the", "session", "key", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/simulator/session_manager.go#L325-L332
21,279
vmware/govmomi
simulator/session_manager.go
Get
func (s *Session) Get(ref types.ManagedObjectReference) mo.Reference { obj := s.Registry.Get(ref) if obj != nil { return obj } // Return a session "view" of certain singleton objects switch ref.Type { case "SessionManager": // Clone SessionManager so the PropertyCollector can properly report CurrentSession ...
go
func (s *Session) Get(ref types.ManagedObjectReference) mo.Reference { obj := s.Registry.Get(ref) if obj != nil { return obj } // Return a session "view" of certain singleton objects switch ref.Type { case "SessionManager": // Clone SessionManager so the PropertyCollector can properly report CurrentSession ...
[ "func", "(", "s", "*", "Session", ")", "Get", "(", "ref", "types", ".", "ManagedObjectReference", ")", "mo", ".", "Reference", "{", "obj", ":=", "s", ".", "Registry", ".", "Get", "(", "ref", ")", "\n", "if", "obj", "!=", "nil", "{", "return", "obj"...
// Get wraps Registry.Get, session-izing singleton objects such as SessionManager and the root PropertyCollector.
[ "Get", "wraps", "Registry", ".", "Get", "session", "-", "izing", "singleton", "objects", "such", "as", "SessionManager", "and", "the", "root", "PropertyCollector", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/simulator/session_manager.go#L335-L361
21,280
vmware/govmomi
object/file_manager.go
DeleteDatastoreFile
func (f FileManager) DeleteDatastoreFile(ctx context.Context, name string, dc *Datacenter) (*Task, error) { req := types.DeleteDatastoreFile_Task{ This: f.Reference(), Name: name, } if dc != nil { ref := dc.Reference() req.Datacenter = &ref } res, err := methods.DeleteDatastoreFile_Task(ctx, f.c, &req) ...
go
func (f FileManager) DeleteDatastoreFile(ctx context.Context, name string, dc *Datacenter) (*Task, error) { req := types.DeleteDatastoreFile_Task{ This: f.Reference(), Name: name, } if dc != nil { ref := dc.Reference() req.Datacenter = &ref } res, err := methods.DeleteDatastoreFile_Task(ctx, f.c, &req) ...
[ "func", "(", "f", "FileManager", ")", "DeleteDatastoreFile", "(", "ctx", "context", ".", "Context", ",", "name", "string", ",", "dc", "*", "Datacenter", ")", "(", "*", "Task", ",", "error", ")", "{", "req", ":=", "types", ".", "DeleteDatastoreFile_Task", ...
// DeleteDatastoreFile deletes the specified file or folder from the datastore.
[ "DeleteDatastoreFile", "deletes", "the", "specified", "file", "or", "folder", "from", "the", "datastore", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/object/file_manager.go#L66-L83
21,281
vmware/govmomi
object/file_manager.go
MakeDirectory
func (f FileManager) MakeDirectory(ctx context.Context, name string, dc *Datacenter, createParentDirectories bool) error { req := types.MakeDirectory{ This: f.Reference(), Name: name, CreateParentDirectories: types.NewBool(createParentDirectories), } if dc != nil { ref ...
go
func (f FileManager) MakeDirectory(ctx context.Context, name string, dc *Datacenter, createParentDirectories bool) error { req := types.MakeDirectory{ This: f.Reference(), Name: name, CreateParentDirectories: types.NewBool(createParentDirectories), } if dc != nil { ref ...
[ "func", "(", "f", "FileManager", ")", "MakeDirectory", "(", "ctx", "context", ".", "Context", ",", "name", "string", ",", "dc", "*", "Datacenter", ",", "createParentDirectories", "bool", ")", "error", "{", "req", ":=", "types", ".", "MakeDirectory", "{", "...
// MakeDirectory creates a folder using the specified name.
[ "MakeDirectory", "creates", "a", "folder", "using", "the", "specified", "name", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/object/file_manager.go#L86-L100
21,282
vmware/govmomi
event/manager.go
EventCategory
func (m Manager) EventCategory(ctx context.Context, event types.BaseEvent) (string, error) { // Most of the event details are included in the Event.FullFormattedMessage, but the category // is only available via the EventManager description.eventInfo property. The value of this // property is static, so we fetch an...
go
func (m Manager) EventCategory(ctx context.Context, event types.BaseEvent) (string, error) { // Most of the event details are included in the Event.FullFormattedMessage, but the category // is only available via the EventManager description.eventInfo property. The value of this // property is static, so we fetch an...
[ "func", "(", "m", "Manager", ")", "EventCategory", "(", "ctx", "context", ".", "Context", ",", "event", "types", ".", "BaseEvent", ")", "(", "string", ",", "error", ")", "{", "// Most of the event details are included in the Event.FullFormattedMessage, but the category"...
// EventCategory returns the category for an event, such as "info" or "error" for example.
[ "EventCategory", "returns", "the", "category", "for", "an", "event", "such", "as", "info", "or", "error", "for", "example", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/event/manager.go#L152-L172
21,283
vmware/govmomi
toolbox/hgfs/protocol.go
errorStatus
func errorStatus(err error) uint32 { if x, ok := err.(*Status); ok { return x.Code } switch { case os.IsNotExist(err): return StatusNoSuchFileOrDir case os.IsExist(err): return StatusFileExists case os.IsPermission(err): return StatusOperationNotPermitted } return StatusGenericError }
go
func errorStatus(err error) uint32 { if x, ok := err.(*Status); ok { return x.Code } switch { case os.IsNotExist(err): return StatusNoSuchFileOrDir case os.IsExist(err): return StatusFileExists case os.IsPermission(err): return StatusOperationNotPermitted } return StatusGenericError }
[ "func", "errorStatus", "(", "err", "error", ")", "uint32", "{", "if", "x", ",", "ok", ":=", "err", ".", "(", "*", "Status", ")", ";", "ok", "{", "return", "x", ".", "Code", "\n", "}", "\n\n", "switch", "{", "case", "os", ".", "IsNotExist", "(", ...
// errorStatus maps the given error type to a status code
[ "errorStatus", "maps", "the", "given", "error", "type", "to", "a", "status", "code" ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/toolbox/hgfs/protocol.go#L178-L193
21,284
vmware/govmomi
toolbox/hgfs/protocol.go
Reply
func (r *Packet) Reply(payload interface{}, err error) ([]byte, error) { p := new(Packet) status := uint32(StatusSuccess) if err != nil { status = errorStatus(err) } else { p.Payload, err = MarshalBinary(payload) if err != nil { return nil, err } } p.Header = Header{ Version: HeaderVersion, ...
go
func (r *Packet) Reply(payload interface{}, err error) ([]byte, error) { p := new(Packet) status := uint32(StatusSuccess) if err != nil { status = errorStatus(err) } else { p.Payload, err = MarshalBinary(payload) if err != nil { return nil, err } } p.Header = Header{ Version: HeaderVersion, ...
[ "func", "(", "r", "*", "Packet", ")", "Reply", "(", "payload", "interface", "{", "}", ",", "err", "error", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "p", ":=", "new", "(", "Packet", ")", "\n\n", "status", ":=", "uint32", "(", "StatusSuc...
// Reply composes a new Packet with the given payload or error
[ "Reply", "composes", "a", "new", "Packet", "with", "the", "given", "payload", "or", "error" ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/toolbox/hgfs/protocol.go#L263-L301
21,285
vmware/govmomi
toolbox/hgfs/protocol.go
FromString
func (f *FileName) FromString(name string) { name = strings.TrimPrefix(name, "/") cp := strings.Split(name, "/") cp = append([]string{serverPolicyRootShareName}, cp...) f.Name = strings.Join(cp, "\x00") f.Length = uint32(len(f.Name)) }
go
func (f *FileName) FromString(name string) { name = strings.TrimPrefix(name, "/") cp := strings.Split(name, "/") cp = append([]string{serverPolicyRootShareName}, cp...) f.Name = strings.Join(cp, "\x00") f.Length = uint32(len(f.Name)) }
[ "func", "(", "f", "*", "FileName", ")", "FromString", "(", "name", "string", ")", "{", "name", "=", "strings", ".", "TrimPrefix", "(", "name", ",", "\"", "\"", ")", "\n\n", "cp", ":=", "strings", ".", "Split", "(", "name", ",", "\"", "\"", ")", "...
// FromString converts name to a FileName
[ "FromString", "converts", "name", "to", "a", "FileName" ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/toolbox/hgfs/protocol.go#L515-L524
21,286
vmware/govmomi
toolbox/hgfs/protocol.go
Path
func (f *FileName) Path() string { cp := strings.Split(f.Name, "\x00") if len(cp) == 0 || cp[0] != serverPolicyRootShareName { return "" // TODO: not happening until if/when we handle Windows shares } cp[0] = "" return strings.Join(cp, "/") }
go
func (f *FileName) Path() string { cp := strings.Split(f.Name, "\x00") if len(cp) == 0 || cp[0] != serverPolicyRootShareName { return "" // TODO: not happening until if/when we handle Windows shares } cp[0] = "" return strings.Join(cp, "/") }
[ "func", "(", "f", "*", "FileName", ")", "Path", "(", ")", "string", "{", "cp", ":=", "strings", ".", "Split", "(", "f", ".", "Name", ",", "\"", "\\x00", "\"", ")", "\n\n", "if", "len", "(", "cp", ")", "==", "0", "||", "cp", "[", "0", "]", "...
// Path converts FileName to a string
[ "Path", "converts", "FileName", "to", "a", "string" ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/toolbox/hgfs/protocol.go#L527-L537
21,287
vmware/govmomi
toolbox/hgfs/protocol.go
FromString
func (f *FileNameV3) FromString(name string) { p := new(FileName) p.FromString(name) f.Name = p.Name f.Length = p.Length }
go
func (f *FileNameV3) FromString(name string) { p := new(FileName) p.FromString(name) f.Name = p.Name f.Length = p.Length }
[ "func", "(", "f", "*", "FileNameV3", ")", "FromString", "(", "name", "string", ")", "{", "p", ":=", "new", "(", "FileName", ")", "\n", "p", ".", "FromString", "(", "name", ")", "\n", "f", ".", "Name", "=", "p", ".", "Name", "\n", "f", ".", "Len...
// FromString converts name to a FileNameV3
[ "FromString", "converts", "name", "to", "a", "FileNameV3" ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/toolbox/hgfs/protocol.go#L579-L584
21,288
vmware/govmomi
toolbox/hgfs/protocol.go
Path
func (f *FileNameV3) Path() string { return (&FileName{Name: f.Name, Length: f.Length}).Path() }
go
func (f *FileNameV3) Path() string { return (&FileName{Name: f.Name, Length: f.Length}).Path() }
[ "func", "(", "f", "*", "FileNameV3", ")", "Path", "(", ")", "string", "{", "return", "(", "&", "FileName", "{", "Name", ":", "f", ".", "Name", ",", "Length", ":", "f", ".", "Length", "}", ")", ".", "Path", "(", ")", "\n", "}" ]
// Path converts FileNameV3 to a string
[ "Path", "converts", "FileNameV3", "to", "a", "string" ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/toolbox/hgfs/protocol.go#L587-L589
21,289
vmware/govmomi
sts/simulator/simulator.go
New
func New(u *url.URL, settings []vim.BaseOptionValue) (string, http.Handler) { for i := range settings { setting := settings[i].GetOptionValue() if setting.Key == "config.vpxd.sso.sts.uri" { endpoint, _ := url.Parse(setting.Value.(string)) endpoint.Host = u.Host setting.Value = endpoint.String() setting...
go
func New(u *url.URL, settings []vim.BaseOptionValue) (string, http.Handler) { for i := range settings { setting := settings[i].GetOptionValue() if setting.Key == "config.vpxd.sso.sts.uri" { endpoint, _ := url.Parse(setting.Value.(string)) endpoint.Host = u.Host setting.Value = endpoint.String() setting...
[ "func", "New", "(", "u", "*", "url", ".", "URL", ",", "settings", "[", "]", "vim", ".", "BaseOptionValue", ")", "(", "string", ",", "http", ".", "Handler", ")", "{", "for", "i", ":=", "range", "settings", "{", "setting", ":=", "settings", "[", "i",...
// New creates an STS simulator and configures the simulator endpoint in the given settings. // The path returned is that of the settings "config.vpxd.sso.sts.uri" property.
[ "New", "creates", "an", "STS", "simulator", "and", "configures", "the", "simulator", "endpoint", "in", "the", "given", "settings", ".", "The", "path", "returned", "is", "that", "of", "the", "settings", "config", ".", "vpxd", ".", "sso", ".", "sts", ".", ...
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/sts/simulator/simulator.go#L34-L46
21,290
vmware/govmomi
sts/simulator/simulator.go
ServeHTTP
func (s *handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { action := r.Header.Get("SOAPAction") env := soap.Envelope{} now := time.Now() lifetime := &internal.Lifetime{ Created: now.Format(internal.Time), Expires: now.Add(5 * time.Minute).Format(internal.Time), } switch path.Base(action) { case "...
go
func (s *handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { action := r.Header.Get("SOAPAction") env := soap.Envelope{} now := time.Now() lifetime := &internal.Lifetime{ Created: now.Format(internal.Time), Expires: now.Add(5 * time.Minute).Format(internal.Time), } switch path.Base(action) { case "...
[ "func", "(", "s", "*", "handler", ")", "ServeHTTP", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "action", ":=", "r", ".", "Header", ".", "Get", "(", "\"", "\"", ")", "\n", "env", ":=", "soap", ".", ...
// ServeHTTP handles STS requests.
[ "ServeHTTP", "handles", "STS", "requests", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/sts/simulator/simulator.go#L51-L91
21,291
vmware/govmomi
object/virtual_machine.go
Device
func (v VirtualMachine) Device(ctx context.Context) (VirtualDeviceList, error) { var o mo.VirtualMachine err := v.Properties(ctx, v.Reference(), []string{"config.hardware.device", "summary.runtime.connectionState"}, &o) if err != nil { return nil, err } // Quoting the SDK doc: // The virtual machine configu...
go
func (v VirtualMachine) Device(ctx context.Context) (VirtualDeviceList, error) { var o mo.VirtualMachine err := v.Properties(ctx, v.Reference(), []string{"config.hardware.device", "summary.runtime.connectionState"}, &o) if err != nil { return nil, err } // Quoting the SDK doc: // The virtual machine configu...
[ "func", "(", "v", "VirtualMachine", ")", "Device", "(", "ctx", "context", ".", "Context", ")", "(", "VirtualDeviceList", ",", "error", ")", "{", "var", "o", "mo", ".", "VirtualMachine", "\n\n", "err", ":=", "v", ".", "Properties", "(", "ctx", ",", "v",...
// Device returns the VirtualMachine's config.hardware.device property.
[ "Device", "returns", "the", "VirtualMachine", "s", "config", ".", "hardware", ".", "device", "property", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/object/virtual_machine.go#L345-L364
21,292
vmware/govmomi
object/virtual_machine.go
AddDevice
func (v VirtualMachine) AddDevice(ctx context.Context, device ...types.BaseVirtualDevice) error { return v.configureDevice(ctx, types.VirtualDeviceConfigSpecOperationAdd, types.VirtualDeviceConfigSpecFileOperationCreate, device...) }
go
func (v VirtualMachine) AddDevice(ctx context.Context, device ...types.BaseVirtualDevice) error { return v.configureDevice(ctx, types.VirtualDeviceConfigSpecOperationAdd, types.VirtualDeviceConfigSpecFileOperationCreate, device...) }
[ "func", "(", "v", "VirtualMachine", ")", "AddDevice", "(", "ctx", "context", ".", "Context", ",", "device", "...", "types", ".", "BaseVirtualDevice", ")", "error", "{", "return", "v", ".", "configureDevice", "(", "ctx", ",", "types", ".", "VirtualDeviceConfi...
// AddDevice adds the given devices to the VirtualMachine
[ "AddDevice", "adds", "the", "given", "devices", "to", "the", "VirtualMachine" ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/object/virtual_machine.go#L435-L437
21,293
vmware/govmomi
object/virtual_machine.go
RemoveDevice
func (v VirtualMachine) RemoveDevice(ctx context.Context, keepFiles bool, device ...types.BaseVirtualDevice) error { fop := types.VirtualDeviceConfigSpecFileOperationDestroy if keepFiles { fop = "" } return v.configureDevice(ctx, types.VirtualDeviceConfigSpecOperationRemove, fop, device...) }
go
func (v VirtualMachine) RemoveDevice(ctx context.Context, keepFiles bool, device ...types.BaseVirtualDevice) error { fop := types.VirtualDeviceConfigSpecFileOperationDestroy if keepFiles { fop = "" } return v.configureDevice(ctx, types.VirtualDeviceConfigSpecOperationRemove, fop, device...) }
[ "func", "(", "v", "VirtualMachine", ")", "RemoveDevice", "(", "ctx", "context", ".", "Context", ",", "keepFiles", "bool", ",", "device", "...", "types", ".", "BaseVirtualDevice", ")", "error", "{", "fop", ":=", "types", ".", "VirtualDeviceConfigSpecFileOperation...
// RemoveDevice removes the given devices on the VirtualMachine
[ "RemoveDevice", "removes", "the", "given", "devices", "on", "the", "VirtualMachine" ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/object/virtual_machine.go#L445-L451
21,294
vmware/govmomi
object/virtual_machine.go
BootOptions
func (v VirtualMachine) BootOptions(ctx context.Context) (*types.VirtualMachineBootOptions, error) { var o mo.VirtualMachine err := v.Properties(ctx, v.Reference(), []string{"config.bootOptions"}, &o) if err != nil { return nil, err } return o.Config.BootOptions, nil }
go
func (v VirtualMachine) BootOptions(ctx context.Context) (*types.VirtualMachineBootOptions, error) { var o mo.VirtualMachine err := v.Properties(ctx, v.Reference(), []string{"config.bootOptions"}, &o) if err != nil { return nil, err } return o.Config.BootOptions, nil }
[ "func", "(", "v", "VirtualMachine", ")", "BootOptions", "(", "ctx", "context", ".", "Context", ")", "(", "*", "types", ".", "VirtualMachineBootOptions", ",", "error", ")", "{", "var", "o", "mo", ".", "VirtualMachine", "\n\n", "err", ":=", "v", ".", "Prop...
// BootOptions returns the VirtualMachine's config.bootOptions property.
[ "BootOptions", "returns", "the", "VirtualMachine", "s", "config", ".", "bootOptions", "property", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/object/virtual_machine.go#L454-L463
21,295
vmware/govmomi
object/virtual_machine.go
SetBootOptions
func (v VirtualMachine) SetBootOptions(ctx context.Context, options *types.VirtualMachineBootOptions) error { spec := types.VirtualMachineConfigSpec{} spec.BootOptions = options task, err := v.Reconfigure(ctx, spec) if err != nil { return err } return task.Wait(ctx) }
go
func (v VirtualMachine) SetBootOptions(ctx context.Context, options *types.VirtualMachineBootOptions) error { spec := types.VirtualMachineConfigSpec{} spec.BootOptions = options task, err := v.Reconfigure(ctx, spec) if err != nil { return err } return task.Wait(ctx) }
[ "func", "(", "v", "VirtualMachine", ")", "SetBootOptions", "(", "ctx", "context", ".", "Context", ",", "options", "*", "types", ".", "VirtualMachineBootOptions", ")", "error", "{", "spec", ":=", "types", ".", "VirtualMachineConfigSpec", "{", "}", "\n\n", "spec...
// SetBootOptions reconfigures the VirtualMachine with the given options.
[ "SetBootOptions", "reconfigures", "the", "VirtualMachine", "with", "the", "given", "options", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/object/virtual_machine.go#L466-L477
21,296
vmware/govmomi
object/virtual_machine.go
Answer
func (v VirtualMachine) Answer(ctx context.Context, id, answer string) error { req := types.AnswerVM{ This: v.Reference(), QuestionId: id, AnswerChoice: answer, } _, err := methods.AnswerVM(ctx, v.c, &req) if err != nil { return err } return nil }
go
func (v VirtualMachine) Answer(ctx context.Context, id, answer string) error { req := types.AnswerVM{ This: v.Reference(), QuestionId: id, AnswerChoice: answer, } _, err := methods.AnswerVM(ctx, v.c, &req) if err != nil { return err } return nil }
[ "func", "(", "v", "VirtualMachine", ")", "Answer", "(", "ctx", "context", ".", "Context", ",", "id", ",", "answer", "string", ")", "error", "{", "req", ":=", "types", ".", "AnswerVM", "{", "This", ":", "v", ".", "Reference", "(", ")", ",", "QuestionI...
// Answer answers a pending question.
[ "Answer", "answers", "a", "pending", "question", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/object/virtual_machine.go#L480-L493
21,297
vmware/govmomi
object/virtual_machine.go
CreateSnapshot
func (v VirtualMachine) CreateSnapshot(ctx context.Context, name string, description string, memory bool, quiesce bool) (*Task, error) { req := types.CreateSnapshot_Task{ This: v.Reference(), Name: name, Description: description, Memory: memory, Quiesce: quiesce, } res, err := metho...
go
func (v VirtualMachine) CreateSnapshot(ctx context.Context, name string, description string, memory bool, quiesce bool) (*Task, error) { req := types.CreateSnapshot_Task{ This: v.Reference(), Name: name, Description: description, Memory: memory, Quiesce: quiesce, } res, err := metho...
[ "func", "(", "v", "VirtualMachine", ")", "CreateSnapshot", "(", "ctx", "context", ".", "Context", ",", "name", "string", ",", "description", "string", ",", "memory", "bool", ",", "quiesce", "bool", ")", "(", "*", "Task", ",", "error", ")", "{", "req", ...
// CreateSnapshot creates a new snapshot of a virtual machine.
[ "CreateSnapshot", "creates", "a", "new", "snapshot", "of", "a", "virtual", "machine", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/object/virtual_machine.go#L510-L525
21,298
vmware/govmomi
object/virtual_machine.go
RemoveAllSnapshot
func (v VirtualMachine) RemoveAllSnapshot(ctx context.Context, consolidate *bool) (*Task, error) { req := types.RemoveAllSnapshots_Task{ This: v.Reference(), Consolidate: consolidate, } res, err := methods.RemoveAllSnapshots_Task(ctx, v.c, &req) if err != nil { return nil, err } return NewTask(v.c,...
go
func (v VirtualMachine) RemoveAllSnapshot(ctx context.Context, consolidate *bool) (*Task, error) { req := types.RemoveAllSnapshots_Task{ This: v.Reference(), Consolidate: consolidate, } res, err := methods.RemoveAllSnapshots_Task(ctx, v.c, &req) if err != nil { return nil, err } return NewTask(v.c,...
[ "func", "(", "v", "VirtualMachine", ")", "RemoveAllSnapshot", "(", "ctx", "context", ".", "Context", ",", "consolidate", "*", "bool", ")", "(", "*", "Task", ",", "error", ")", "{", "req", ":=", "types", ".", "RemoveAllSnapshots_Task", "{", "This", ":", "...
// RemoveAllSnapshot removes all snapshots of a virtual machine
[ "RemoveAllSnapshot", "removes", "all", "snapshots", "of", "a", "virtual", "machine" ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/object/virtual_machine.go#L528-L540
21,299
vmware/govmomi
object/virtual_machine.go
RemoveSnapshot
func (v VirtualMachine) RemoveSnapshot(ctx context.Context, name string, removeChildren bool, consolidate *bool) (*Task, error) { snapshot, err := v.FindSnapshot(ctx, name) if err != nil { return nil, err } req := types.RemoveSnapshot_Task{ This: snapshot.Reference(), RemoveChildren: removeChildren...
go
func (v VirtualMachine) RemoveSnapshot(ctx context.Context, name string, removeChildren bool, consolidate *bool) (*Task, error) { snapshot, err := v.FindSnapshot(ctx, name) if err != nil { return nil, err } req := types.RemoveSnapshot_Task{ This: snapshot.Reference(), RemoveChildren: removeChildren...
[ "func", "(", "v", "VirtualMachine", ")", "RemoveSnapshot", "(", "ctx", "context", ".", "Context", ",", "name", "string", ",", "removeChildren", "bool", ",", "consolidate", "*", "bool", ")", "(", "*", "Task", ",", "error", ")", "{", "snapshot", ",", "err"...
// RemoveSnapshot removes a named snapshot
[ "RemoveSnapshot", "removes", "a", "named", "snapshot" ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/object/virtual_machine.go#L594-L612