repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
list
docstring
stringlengths
6
2.61k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
85
252
partition
stringclasses
1 value
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
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
train
vmware/govmomi
object/virtual_machine.go
RevertToCurrentSnapshot
func (v VirtualMachine) RevertToCurrentSnapshot(ctx context.Context, suppressPowerOn bool) (*Task, error) { req := types.RevertToCurrentSnapshot_Task{ This: v.Reference(), SuppressPowerOn: types.NewBool(suppressPowerOn), } res, err := methods.RevertToCurrentSnapshot_Task(ctx, v.c, &req) if err != ni...
go
func (v VirtualMachine) RevertToCurrentSnapshot(ctx context.Context, suppressPowerOn bool) (*Task, error) { req := types.RevertToCurrentSnapshot_Task{ This: v.Reference(), SuppressPowerOn: types.NewBool(suppressPowerOn), } res, err := methods.RevertToCurrentSnapshot_Task(ctx, v.c, &req) if err != ni...
[ "func", "(", "v", "VirtualMachine", ")", "RevertToCurrentSnapshot", "(", "ctx", "context", ".", "Context", ",", "suppressPowerOn", "bool", ")", "(", "*", "Task", ",", "error", ")", "{", "req", ":=", "types", ".", "RevertToCurrentSnapshot_Task", "{", "This", ...
// RevertToCurrentSnapshot reverts to the current snapshot
[ "RevertToCurrentSnapshot", "reverts", "to", "the", "current", "snapshot" ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/object/virtual_machine.go#L615-L627
train
vmware/govmomi
object/virtual_machine.go
RevertToSnapshot
func (v VirtualMachine) RevertToSnapshot(ctx context.Context, name string, suppressPowerOn bool) (*Task, error) { snapshot, err := v.FindSnapshot(ctx, name) if err != nil { return nil, err } req := types.RevertToSnapshot_Task{ This: snapshot.Reference(), SuppressPowerOn: types.NewBool(suppressPowe...
go
func (v VirtualMachine) RevertToSnapshot(ctx context.Context, name string, suppressPowerOn bool) (*Task, error) { snapshot, err := v.FindSnapshot(ctx, name) if err != nil { return nil, err } req := types.RevertToSnapshot_Task{ This: snapshot.Reference(), SuppressPowerOn: types.NewBool(suppressPowe...
[ "func", "(", "v", "VirtualMachine", ")", "RevertToSnapshot", "(", "ctx", "context", ".", "Context", ",", "name", "string", ",", "suppressPowerOn", "bool", ")", "(", "*", "Task", ",", "error", ")", "{", "snapshot", ",", "err", ":=", "v", ".", "FindSnapsho...
// RevertToSnapshot reverts to a named snapshot
[ "RevertToSnapshot", "reverts", "to", "a", "named", "snapshot" ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/object/virtual_machine.go#L630-L647
train
vmware/govmomi
object/virtual_machine.go
IsToolsRunning
func (v VirtualMachine) IsToolsRunning(ctx context.Context) (bool, error) { var o mo.VirtualMachine err := v.Properties(ctx, v.Reference(), []string{"guest.toolsRunningStatus"}, &o) if err != nil { return false, err } return o.Guest.ToolsRunningStatus == string(types.VirtualMachineToolsRunningStatusGuestToolsR...
go
func (v VirtualMachine) IsToolsRunning(ctx context.Context) (bool, error) { var o mo.VirtualMachine err := v.Properties(ctx, v.Reference(), []string{"guest.toolsRunningStatus"}, &o) if err != nil { return false, err } return o.Guest.ToolsRunningStatus == string(types.VirtualMachineToolsRunningStatusGuestToolsR...
[ "func", "(", "v", "VirtualMachine", ")", "IsToolsRunning", "(", "ctx", "context", ".", "Context", ")", "(", "bool", ",", "error", ")", "{", "var", "o", "mo", ".", "VirtualMachine", "\n\n", "err", ":=", "v", ".", "Properties", "(", "ctx", ",", "v", "....
// IsToolsRunning returns true if VMware Tools is currently running in the guest OS, and false otherwise.
[ "IsToolsRunning", "returns", "true", "if", "VMware", "Tools", "is", "currently", "running", "in", "the", "guest", "OS", "and", "false", "otherwise", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/object/virtual_machine.go#L650-L659
train
vmware/govmomi
object/virtual_machine.go
WaitForPowerState
func (v VirtualMachine) WaitForPowerState(ctx context.Context, state types.VirtualMachinePowerState) error { p := property.DefaultCollector(v.c) err := property.Wait(ctx, p, v.Reference(), []string{PropRuntimePowerState}, func(pc []types.PropertyChange) bool { for _, c := range pc { if c.Name != PropRuntimePower...
go
func (v VirtualMachine) WaitForPowerState(ctx context.Context, state types.VirtualMachinePowerState) error { p := property.DefaultCollector(v.c) err := property.Wait(ctx, p, v.Reference(), []string{PropRuntimePowerState}, func(pc []types.PropertyChange) bool { for _, c := range pc { if c.Name != PropRuntimePower...
[ "func", "(", "v", "VirtualMachine", ")", "WaitForPowerState", "(", "ctx", "context", ".", "Context", ",", "state", "types", ".", "VirtualMachinePowerState", ")", "error", "{", "p", ":=", "property", ".", "DefaultCollector", "(", "v", ".", "c", ")", "\n", "...
// Wait for the VirtualMachine to change to the desired power state.
[ "Wait", "for", "the", "VirtualMachine", "to", "change", "to", "the", "desired", "power", "state", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/object/virtual_machine.go#L662-L682
train
vmware/govmomi
object/virtual_machine.go
QueryConfigTarget
func (v VirtualMachine) QueryConfigTarget(ctx context.Context) (*types.ConfigTarget, error) { var vm mo.VirtualMachine err := v.Properties(ctx, v.Reference(), []string{"environmentBrowser"}, &vm) if err != nil { return nil, err } req := types.QueryConfigTarget{ This: vm.EnvironmentBrowser, } res, err := m...
go
func (v VirtualMachine) QueryConfigTarget(ctx context.Context) (*types.ConfigTarget, error) { var vm mo.VirtualMachine err := v.Properties(ctx, v.Reference(), []string{"environmentBrowser"}, &vm) if err != nil { return nil, err } req := types.QueryConfigTarget{ This: vm.EnvironmentBrowser, } res, err := m...
[ "func", "(", "v", "VirtualMachine", ")", "QueryConfigTarget", "(", "ctx", "context", ".", "Context", ")", "(", "*", "types", ".", "ConfigTarget", ",", "error", ")", "{", "var", "vm", "mo", ".", "VirtualMachine", "\n\n", "err", ":=", "v", ".", "Properties...
// QueryEnvironmentBrowser is a helper to get the environmentBrowser property.
[ "QueryEnvironmentBrowser", "is", "a", "helper", "to", "get", "the", "environmentBrowser", "property", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/object/virtual_machine.go#L751-L769
train
vmware/govmomi
object/virtual_machine.go
UUID
func (v VirtualMachine) UUID(ctx context.Context) string { var o mo.VirtualMachine err := v.Properties(ctx, v.Reference(), []string{"config.uuid"}, &o) if err != nil { return "" } return o.Config.Uuid }
go
func (v VirtualMachine) UUID(ctx context.Context) string { var o mo.VirtualMachine err := v.Properties(ctx, v.Reference(), []string{"config.uuid"}, &o) if err != nil { return "" } return o.Config.Uuid }
[ "func", "(", "v", "VirtualMachine", ")", "UUID", "(", "ctx", "context", ".", "Context", ")", "string", "{", "var", "o", "mo", ".", "VirtualMachine", "\n\n", "err", ":=", "v", ".", "Properties", "(", "ctx", ",", "v", ".", "Reference", "(", ")", ",", ...
// UUID is a helper to get the UUID of the VirtualMachine managed object. // This method returns an empty string if an error occurs when retrieving UUID from the VirtualMachine object.
[ "UUID", "is", "a", "helper", "to", "get", "the", "UUID", "of", "the", "VirtualMachine", "managed", "object", ".", "This", "method", "returns", "an", "empty", "string", "if", "an", "error", "occurs", "when", "retrieving", "UUID", "from", "the", "VirtualMachin...
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/object/virtual_machine.go#L832-L841
train
vmware/govmomi
vim25/xml/extras.go
typeToString
func typeToString(typ reflect.Type) string { switch typ.Kind() { case reflect.Bool: return "xsd:boolean" case reflect.Int8: return "xsd:byte" case reflect.Int16: return "xsd:short" case reflect.Int32: return "xsd:int" case reflect.Int, reflect.Int64: return "xsd:long" case reflect.Uint8: return "xsd:...
go
func typeToString(typ reflect.Type) string { switch typ.Kind() { case reflect.Bool: return "xsd:boolean" case reflect.Int8: return "xsd:byte" case reflect.Int16: return "xsd:short" case reflect.Int32: return "xsd:int" case reflect.Int, reflect.Int64: return "xsd:long" case reflect.Uint8: return "xsd:...
[ "func", "typeToString", "(", "typ", "reflect", ".", "Type", ")", "string", "{", "switch", "typ", ".", "Kind", "(", ")", "{", "case", "reflect", ".", "Bool", ":", "return", "\"", "\"", "\n", "case", "reflect", ".", "Int8", ":", "return", "\"", "\"", ...
// Return a string for the specified reflect.Type. Panic if unknown.
[ "Return", "a", "string", "for", "the", "specified", "reflect", ".", "Type", ".", "Panic", "if", "unknown", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/vim25/xml/extras.go#L51-L99
train
vmware/govmomi
simulator/container.go
inspect
func (c *container) inspect(vm *VirtualMachine) error { if c.id == "" { return nil } var objects []struct { NetworkSettings struct { Gateway string IPAddress string IPPrefixLen int MacAddress string } } cmd := exec.Command("docker", "inspect", c.id) out, err := cmd.Output() if err != n...
go
func (c *container) inspect(vm *VirtualMachine) error { if c.id == "" { return nil } var objects []struct { NetworkSettings struct { Gateway string IPAddress string IPPrefixLen int MacAddress string } } cmd := exec.Command("docker", "inspect", c.id) out, err := cmd.Output() if err != n...
[ "func", "(", "c", "*", "container", ")", "inspect", "(", "vm", "*", "VirtualMachine", ")", "error", "{", "if", "c", ".", "id", "==", "\"", "\"", "{", "return", "nil", "\n", "}", "\n\n", "var", "objects", "[", "]", "struct", "{", "NetworkSettings", ...
// inspect applies container network settings to vm.Guest properties.
[ "inspect", "applies", "container", "network", "settings", "to", "vm", ".", "Guest", "properties", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/simulator/container.go#L35-L78
train
vmware/govmomi
simulator/container.go
start
func (c *container) start(vm *VirtualMachine) { if c.id != "" { start := "start" if vm.Runtime.PowerState == types.VirtualMachinePowerStateSuspended { start = "unpause" } cmd := exec.Command("docker", start, c.id) err := cmd.Run() if err != nil { log.Printf("%s %s: %s", vm.Name, cmd.Args, err) } ...
go
func (c *container) start(vm *VirtualMachine) { if c.id != "" { start := "start" if vm.Runtime.PowerState == types.VirtualMachinePowerStateSuspended { start = "unpause" } cmd := exec.Command("docker", start, c.id) err := cmd.Run() if err != nil { log.Printf("%s %s: %s", vm.Name, cmd.Args, err) } ...
[ "func", "(", "c", "*", "container", ")", "start", "(", "vm", "*", "VirtualMachine", ")", "{", "if", "c", ".", "id", "!=", "\"", "\"", "{", "start", ":=", "\"", "\"", "\n", "if", "vm", ".", "Runtime", ".", "PowerState", "==", "types", ".", "Virtua...
// start runs the container if specified by the RUN.container extraConfig property.
[ "start", "runs", "the", "container", "if", "specified", "by", "the", "RUN", ".", "container", "extraConfig", "property", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/simulator/container.go#L81-L128
train
vmware/govmomi
client.go
Login
func (c *Client) Login(ctx context.Context, u *url.Userinfo) error { return c.SessionManager.Login(ctx, u) }
go
func (c *Client) Login(ctx context.Context, u *url.Userinfo) error { return c.SessionManager.Login(ctx, u) }
[ "func", "(", "c", "*", "Client", ")", "Login", "(", "ctx", "context", ".", "Context", ",", "u", "*", "url", ".", "Userinfo", ")", "error", "{", "return", "c", ".", "SessionManager", ".", "Login", "(", "ctx", ",", "u", ")", "\n", "}" ]
// Login dispatches to the SessionManager.
[ "Login", "dispatches", "to", "the", "SessionManager", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/client.go#L102-L104
train
vmware/govmomi
client.go
Logout
func (c *Client) Logout(ctx context.Context) error { // Close any idle connections after logging out. defer c.Client.CloseIdleConnections() return c.SessionManager.Logout(ctx) }
go
func (c *Client) Logout(ctx context.Context) error { // Close any idle connections after logging out. defer c.Client.CloseIdleConnections() return c.SessionManager.Logout(ctx) }
[ "func", "(", "c", "*", "Client", ")", "Logout", "(", "ctx", "context", ".", "Context", ")", "error", "{", "// Close any idle connections after logging out.", "defer", "c", ".", "Client", ".", "CloseIdleConnections", "(", ")", "\n", "return", "c", ".", "Session...
// Logout dispatches to the SessionManager.
[ "Logout", "dispatches", "to", "the", "SessionManager", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/client.go#L107-L111
train
vmware/govmomi
client.go
RetrieveOne
func (c *Client) RetrieveOne(ctx context.Context, obj types.ManagedObjectReference, p []string, dst interface{}) error { return c.PropertyCollector().RetrieveOne(ctx, obj, p, dst) }
go
func (c *Client) RetrieveOne(ctx context.Context, obj types.ManagedObjectReference, p []string, dst interface{}) error { return c.PropertyCollector().RetrieveOne(ctx, obj, p, dst) }
[ "func", "(", "c", "*", "Client", ")", "RetrieveOne", "(", "ctx", "context", ".", "Context", ",", "obj", "types", ".", "ManagedObjectReference", ",", "p", "[", "]", "string", ",", "dst", "interface", "{", "}", ")", "error", "{", "return", "c", ".", "P...
// RetrieveOne dispatches to the Retrieve function on the default property collector.
[ "RetrieveOne", "dispatches", "to", "the", "Retrieve", "function", "on", "the", "default", "property", "collector", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/client.go#L119-L121
train
vmware/govmomi
client.go
Retrieve
func (c *Client) Retrieve(ctx context.Context, objs []types.ManagedObjectReference, p []string, dst interface{}) error { return c.PropertyCollector().Retrieve(ctx, objs, p, dst) }
go
func (c *Client) Retrieve(ctx context.Context, objs []types.ManagedObjectReference, p []string, dst interface{}) error { return c.PropertyCollector().Retrieve(ctx, objs, p, dst) }
[ "func", "(", "c", "*", "Client", ")", "Retrieve", "(", "ctx", "context", ".", "Context", ",", "objs", "[", "]", "types", ".", "ManagedObjectReference", ",", "p", "[", "]", "string", ",", "dst", "interface", "{", "}", ")", "error", "{", "return", "c",...
// Retrieve dispatches to the Retrieve function on the default property collector.
[ "Retrieve", "dispatches", "to", "the", "Retrieve", "function", "on", "the", "default", "property", "collector", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/client.go#L124-L126
train
vmware/govmomi
client.go
Wait
func (c *Client) Wait(ctx context.Context, obj types.ManagedObjectReference, ps []string, f func([]types.PropertyChange) bool) error { return property.Wait(ctx, c.PropertyCollector(), obj, ps, f) }
go
func (c *Client) Wait(ctx context.Context, obj types.ManagedObjectReference, ps []string, f func([]types.PropertyChange) bool) error { return property.Wait(ctx, c.PropertyCollector(), obj, ps, f) }
[ "func", "(", "c", "*", "Client", ")", "Wait", "(", "ctx", "context", ".", "Context", ",", "obj", "types", ".", "ManagedObjectReference", ",", "ps", "[", "]", "string", ",", "f", "func", "(", "[", "]", "types", ".", "PropertyChange", ")", "bool", ")",...
// Wait dispatches to property.Wait.
[ "Wait", "dispatches", "to", "property", ".", "Wait", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/client.go#L129-L131
train
vmware/govmomi
sts/client.go
NewClient
func NewClient(ctx context.Context, c *vim25.Client) (*Client, error) { filter := &types.LookupServiceRegistrationFilter{ ServiceType: &types.LookupServiceRegistrationServiceType{ Product: "com.vmware.cis", Type: "sso:sts", }, EndpointType: &types.LookupServiceRegistrationEndpointType{ Protocol: "wsT...
go
func NewClient(ctx context.Context, c *vim25.Client) (*Client, error) { filter := &types.LookupServiceRegistrationFilter{ ServiceType: &types.LookupServiceRegistrationServiceType{ Product: "com.vmware.cis", Type: "sso:sts", }, EndpointType: &types.LookupServiceRegistrationEndpointType{ Protocol: "wsT...
[ "func", "NewClient", "(", "ctx", "context", ".", "Context", ",", "c", "*", "vim25", ".", "Client", ")", "(", "*", "Client", ",", "error", ")", "{", "filter", ":=", "&", "types", ".", "LookupServiceRegistrationFilter", "{", "ServiceType", ":", "&", "types...
// NewClient returns a client targeting the STS API endpoint. // The Client.URL will be set to that of the Lookup Service's endpoint registration, // as the SSO endpoint can be external to vCenter. If the Lookup Service is not available, // URL defaults to Path on the vim25.Client.URL.Host.
[ "NewClient", "returns", "a", "client", "targeting", "the", "STS", "API", "endpoint", ".", "The", "Client", ".", "URL", "will", "be", "set", "to", "that", "of", "the", "Lookup", "Service", "s", "endpoint", "registration", "as", "the", "SSO", "endpoint", "ca...
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/sts/client.go#L47-L63
train
vmware/govmomi
sts/client.go
Renew
func (c *Client) Renew(ctx context.Context, req TokenRequest) (*Signer, error) { s := &Signer{ Certificate: req.Certificate, } rst, err := c.newRequest(req, "Renew", s) if err != nil { return nil, err } if req.Token == "" { return nil, errors.New("TokenRequest Token is required") } rst.RenewTarget = &i...
go
func (c *Client) Renew(ctx context.Context, req TokenRequest) (*Signer, error) { s := &Signer{ Certificate: req.Certificate, } rst, err := c.newRequest(req, "Renew", s) if err != nil { return nil, err } if req.Token == "" { return nil, errors.New("TokenRequest Token is required") } rst.RenewTarget = &i...
[ "func", "(", "c", "*", "Client", ")", "Renew", "(", "ctx", "context", ".", "Context", ",", "req", "TokenRequest", ")", "(", "*", "Signer", ",", "error", ")", "{", "s", ":=", "&", "Signer", "{", "Certificate", ":", "req", ".", "Certificate", ",", "}...
// Renew is used to request a security token renewal.
[ "Renew", "is", "used", "to", "request", "a", "security", "token", "renewal", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/sts/client.go#L180-L209
train
vmware/govmomi
object/host_vsan_internal_system.go
QueryVsanObjectUuidsByFilter
func (m HostVsanInternalSystem) QueryVsanObjectUuidsByFilter(ctx context.Context, uuids []string, limit int32, version int32) ([]string, error) { req := types.QueryVsanObjectUuidsByFilter{ This: m.Reference(), Uuids: uuids, Limit: &limit, Version: version, } res, err := methods.QueryVsanObjectUuidsBy...
go
func (m HostVsanInternalSystem) QueryVsanObjectUuidsByFilter(ctx context.Context, uuids []string, limit int32, version int32) ([]string, error) { req := types.QueryVsanObjectUuidsByFilter{ This: m.Reference(), Uuids: uuids, Limit: &limit, Version: version, } res, err := methods.QueryVsanObjectUuidsBy...
[ "func", "(", "m", "HostVsanInternalSystem", ")", "QueryVsanObjectUuidsByFilter", "(", "ctx", "context", ".", "Context", ",", "uuids", "[", "]", "string", ",", "limit", "int32", ",", "version", "int32", ")", "(", "[", "]", "string", ",", "error", ")", "{", ...
// QueryVsanObjectUuidsByFilter returns vSAN DOM object uuids by filter.
[ "QueryVsanObjectUuidsByFilter", "returns", "vSAN", "DOM", "object", "uuids", "by", "filter", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/object/host_vsan_internal_system.go#L41-L55
train
vmware/govmomi
object/datastore.go
NewURL
func (d Datastore) NewURL(path string) *url.URL { u := d.c.URL() return &url.URL{ Scheme: u.Scheme, Host: u.Host, Path: fmt.Sprintf("/folder/%s", path), RawQuery: url.Values{ "dcPath": []string{d.DatacenterPath}, "dsName": []string{d.Name()}, }.Encode(), } }
go
func (d Datastore) NewURL(path string) *url.URL { u := d.c.URL() return &url.URL{ Scheme: u.Scheme, Host: u.Host, Path: fmt.Sprintf("/folder/%s", path), RawQuery: url.Values{ "dcPath": []string{d.DatacenterPath}, "dsName": []string{d.Name()}, }.Encode(), } }
[ "func", "(", "d", "Datastore", ")", "NewURL", "(", "path", "string", ")", "*", "url", ".", "URL", "{", "u", ":=", "d", ".", "c", ".", "URL", "(", ")", "\n\n", "return", "&", "url", ".", "URL", "{", "Scheme", ":", "u", ".", "Scheme", ",", "Hos...
// NewURL constructs a url.URL with the given file path for datastore access over HTTP.
[ "NewURL", "constructs", "a", "url", ".", "URL", "with", "the", "given", "file", "path", "for", "datastore", "access", "over", "HTTP", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/object/datastore.go#L83-L95
train
vmware/govmomi
object/datastore.go
URL
func (d Datastore) URL(ctx context.Context, dc *Datacenter, path string) (*url.URL, error) { return d.NewURL(path), nil }
go
func (d Datastore) URL(ctx context.Context, dc *Datacenter, path string) (*url.URL, error) { return d.NewURL(path), nil }
[ "func", "(", "d", "Datastore", ")", "URL", "(", "ctx", "context", ".", "Context", ",", "dc", "*", "Datacenter", ",", "path", "string", ")", "(", "*", "url", ".", "URL", ",", "error", ")", "{", "return", "d", ".", "NewURL", "(", "path", ")", ",", ...
// URL is deprecated, use NewURL instead.
[ "URL", "is", "deprecated", "use", "NewURL", "instead", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/object/datastore.go#L98-L100
train
vmware/govmomi
object/datastore.go
HostContext
func (d Datastore) HostContext(ctx context.Context, host *HostSystem) context.Context { return context.WithValue(ctx, datastoreServiceTicketHostKey{}, host) }
go
func (d Datastore) HostContext(ctx context.Context, host *HostSystem) context.Context { return context.WithValue(ctx, datastoreServiceTicketHostKey{}, host) }
[ "func", "(", "d", "Datastore", ")", "HostContext", "(", "ctx", "context", ".", "Context", ",", "host", "*", "HostSystem", ")", "context", ".", "Context", "{", "return", "context", ".", "WithValue", "(", "ctx", ",", "datastoreServiceTicketHostKey", "{", "}", ...
// HostContext returns a Context where the given host will be used for datastore HTTP access // via the ServiceTicket method.
[ "HostContext", "returns", "a", "Context", "where", "the", "given", "host", "will", "be", "used", "for", "datastore", "HTTP", "access", "via", "the", "ServiceTicket", "method", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/object/datastore.go#L174-L176
train
vmware/govmomi
object/datastore.go
ServiceTicket
func (d Datastore) ServiceTicket(ctx context.Context, path string, method string) (*url.URL, *http.Cookie, error) { u := d.NewURL(path) host, ok := ctx.Value(datastoreServiceTicketHostKey{}).(*HostSystem) if !ok { if !d.useServiceTicket() { return u, nil, nil } hosts, err := d.AttachedHosts(ctx) if err...
go
func (d Datastore) ServiceTicket(ctx context.Context, path string, method string) (*url.URL, *http.Cookie, error) { u := d.NewURL(path) host, ok := ctx.Value(datastoreServiceTicketHostKey{}).(*HostSystem) if !ok { if !d.useServiceTicket() { return u, nil, nil } hosts, err := d.AttachedHosts(ctx) if err...
[ "func", "(", "d", "Datastore", ")", "ServiceTicket", "(", "ctx", "context", ".", "Context", ",", "path", "string", ",", "method", "string", ")", "(", "*", "url", ".", "URL", ",", "*", "http", ".", "Cookie", ",", "error", ")", "{", "u", ":=", "d", ...
// ServiceTicket obtains a ticket via AcquireGenericServiceTicket and returns it an http.Cookie with the url.URL // that can be used along with the ticket cookie to access the given path. An host is chosen at random unless the // the given Context was created with a specific host via the HostContext method.
[ "ServiceTicket", "obtains", "a", "ticket", "via", "AcquireGenericServiceTicket", "and", "returns", "it", "an", "http", ".", "Cookie", "with", "the", "url", ".", "URL", "that", "can", "be", "used", "along", "with", "the", "ticket", "cookie", "to", "access", "...
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/object/datastore.go#L181-L251
train
vmware/govmomi
object/datastore.go
Upload
func (d Datastore) Upload(ctx context.Context, f io.Reader, path string, param *soap.Upload) error { u, p, err := d.uploadTicket(ctx, path, param) if err != nil { return err } return d.Client().Upload(ctx, f, u, p) }
go
func (d Datastore) Upload(ctx context.Context, f io.Reader, path string, param *soap.Upload) error { u, p, err := d.uploadTicket(ctx, path, param) if err != nil { return err } return d.Client().Upload(ctx, f, u, p) }
[ "func", "(", "d", "Datastore", ")", "Upload", "(", "ctx", "context", ".", "Context", ",", "f", "io", ".", "Reader", ",", "path", "string", ",", "param", "*", "soap", ".", "Upload", ")", "error", "{", "u", ",", "p", ",", "err", ":=", "d", ".", "...
// Upload via soap.Upload with an http service ticket
[ "Upload", "via", "soap", ".", "Upload", "with", "an", "http", "service", "ticket" ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/object/datastore.go#L286-L292
train
vmware/govmomi
object/datastore.go
UploadFile
func (d Datastore) UploadFile(ctx context.Context, file string, path string, param *soap.Upload) error { u, p, err := d.uploadTicket(ctx, path, param) if err != nil { return err } return d.Client().UploadFile(ctx, file, u, p) }
go
func (d Datastore) UploadFile(ctx context.Context, file string, path string, param *soap.Upload) error { u, p, err := d.uploadTicket(ctx, path, param) if err != nil { return err } return d.Client().UploadFile(ctx, file, u, p) }
[ "func", "(", "d", "Datastore", ")", "UploadFile", "(", "ctx", "context", ".", "Context", ",", "file", "string", ",", "path", "string", ",", "param", "*", "soap", ".", "Upload", ")", "error", "{", "u", ",", "p", ",", "err", ":=", "d", ".", "uploadTi...
// UploadFile via soap.Upload with an http service ticket
[ "UploadFile", "via", "soap", ".", "Upload", "with", "an", "http", "service", "ticket" ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/object/datastore.go#L295-L301
train
vmware/govmomi
object/datastore.go
Download
func (d Datastore) Download(ctx context.Context, path string, param *soap.Download) (io.ReadCloser, int64, error) { u, p, err := d.downloadTicket(ctx, path, param) if err != nil { return nil, 0, err } return d.Client().Download(ctx, u, p) }
go
func (d Datastore) Download(ctx context.Context, path string, param *soap.Download) (io.ReadCloser, int64, error) { u, p, err := d.downloadTicket(ctx, path, param) if err != nil { return nil, 0, err } return d.Client().Download(ctx, u, p) }
[ "func", "(", "d", "Datastore", ")", "Download", "(", "ctx", "context", ".", "Context", ",", "path", "string", ",", "param", "*", "soap", ".", "Download", ")", "(", "io", ".", "ReadCloser", ",", "int64", ",", "error", ")", "{", "u", ",", "p", ",", ...
// Download via soap.Download with an http service ticket
[ "Download", "via", "soap", ".", "Download", "with", "an", "http", "service", "ticket" ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/object/datastore.go#L304-L310
train
vmware/govmomi
object/datastore.go
DownloadFile
func (d Datastore) DownloadFile(ctx context.Context, path string, file string, param *soap.Download) error { u, p, err := d.downloadTicket(ctx, path, param) if err != nil { return err } return d.Client().DownloadFile(ctx, file, u, p) }
go
func (d Datastore) DownloadFile(ctx context.Context, path string, file string, param *soap.Download) error { u, p, err := d.downloadTicket(ctx, path, param) if err != nil { return err } return d.Client().DownloadFile(ctx, file, u, p) }
[ "func", "(", "d", "Datastore", ")", "DownloadFile", "(", "ctx", "context", ".", "Context", ",", "path", "string", ",", "file", "string", ",", "param", "*", "soap", ".", "Download", ")", "error", "{", "u", ",", "p", ",", "err", ":=", "d", ".", "down...
// DownloadFile via soap.Download with an http service ticket
[ "DownloadFile", "via", "soap", ".", "Download", "with", "an", "http", "service", "ticket" ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/object/datastore.go#L313-L319
train
vmware/govmomi
object/datastore.go
AttachedHosts
func (d Datastore) AttachedHosts(ctx context.Context) ([]*HostSystem, error) { var ds mo.Datastore var hosts []*HostSystem pc := property.DefaultCollector(d.Client()) err := pc.RetrieveOne(ctx, d.Reference(), []string{"host"}, &ds) if err != nil { return nil, err } mounts := make(map[types.ManagedObjectRefer...
go
func (d Datastore) AttachedHosts(ctx context.Context) ([]*HostSystem, error) { var ds mo.Datastore var hosts []*HostSystem pc := property.DefaultCollector(d.Client()) err := pc.RetrieveOne(ctx, d.Reference(), []string{"host"}, &ds) if err != nil { return nil, err } mounts := make(map[types.ManagedObjectRefer...
[ "func", "(", "d", "Datastore", ")", "AttachedHosts", "(", "ctx", "context", ".", "Context", ")", "(", "[", "]", "*", "HostSystem", ",", "error", ")", "{", "var", "ds", "mo", ".", "Datastore", "\n", "var", "hosts", "[", "]", "*", "HostSystem", "\n\n",...
// AttachedHosts returns hosts that have this Datastore attached, accessible and writable.
[ "AttachedHosts", "returns", "hosts", "that", "have", "this", "Datastore", "attached", "accessible", "and", "writable", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/object/datastore.go#L322-L359
train
vmware/govmomi
object/datastore.go
AttachedClusterHosts
func (d Datastore) AttachedClusterHosts(ctx context.Context, cluster *ComputeResource) ([]*HostSystem, error) { var hosts []*HostSystem clusterHosts, err := cluster.Hosts(ctx) if err != nil { return nil, err } attachedHosts, err := d.AttachedHosts(ctx) if err != nil { return nil, err } refs := make(map[t...
go
func (d Datastore) AttachedClusterHosts(ctx context.Context, cluster *ComputeResource) ([]*HostSystem, error) { var hosts []*HostSystem clusterHosts, err := cluster.Hosts(ctx) if err != nil { return nil, err } attachedHosts, err := d.AttachedHosts(ctx) if err != nil { return nil, err } refs := make(map[t...
[ "func", "(", "d", "Datastore", ")", "AttachedClusterHosts", "(", "ctx", "context", ".", "Context", ",", "cluster", "*", "ComputeResource", ")", "(", "[", "]", "*", "HostSystem", ",", "error", ")", "{", "var", "hosts", "[", "]", "*", "HostSystem", "\n\n",...
// AttachedClusterHosts returns hosts that have this Datastore attached, accessible and writable and are members of the given cluster.
[ "AttachedClusterHosts", "returns", "hosts", "that", "have", "this", "Datastore", "attached", "accessible", "and", "writable", "and", "are", "members", "of", "the", "given", "cluster", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/object/datastore.go#L362-L387
train
vmware/govmomi
object/datastore.go
Type
func (d Datastore) Type(ctx context.Context) (types.HostFileSystemVolumeFileSystemType, error) { var mds mo.Datastore if err := d.Properties(ctx, d.Reference(), []string{"summary.type"}, &mds); err != nil { return types.HostFileSystemVolumeFileSystemType(""), err } return types.HostFileSystemVolumeFileSystemType...
go
func (d Datastore) Type(ctx context.Context) (types.HostFileSystemVolumeFileSystemType, error) { var mds mo.Datastore if err := d.Properties(ctx, d.Reference(), []string{"summary.type"}, &mds); err != nil { return types.HostFileSystemVolumeFileSystemType(""), err } return types.HostFileSystemVolumeFileSystemType...
[ "func", "(", "d", "Datastore", ")", "Type", "(", "ctx", "context", ".", "Context", ")", "(", "types", ".", "HostFileSystemVolumeFileSystemType", ",", "error", ")", "{", "var", "mds", "mo", ".", "Datastore", "\n\n", "if", "err", ":=", "d", ".", "Propertie...
// Type returns the type of file system volume.
[ "Type", "returns", "the", "type", "of", "file", "system", "volume", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/object/datastore.go#L432-L439
train
vmware/govmomi
vapi/internal/internal.go
NewAssociation
func NewAssociation(ref mo.Reference) Association { obj := AssociatedObject(ref.Reference()) return Association{ ObjectID: &obj, } }
go
func NewAssociation(ref mo.Reference) Association { obj := AssociatedObject(ref.Reference()) return Association{ ObjectID: &obj, } }
[ "func", "NewAssociation", "(", "ref", "mo", ".", "Reference", ")", "Association", "{", "obj", ":=", "AssociatedObject", "(", "ref", ".", "Reference", "(", ")", ")", "\n", "return", "Association", "{", "ObjectID", ":", "&", "obj", ",", "}", "\n", "}" ]
// NewAssociation returns an Association, converting ref to an AssociatedObject.
[ "NewAssociation", "returns", "an", "Association", "converting", "ref", "to", "an", "AssociatedObject", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/vapi/internal/internal.go#L67-L72
train
vmware/govmomi
vapi/internal/internal.go
URL
func URL(c CloneURL, path string) *Resource { r := &Resource{u: c.URL()} r.u.Path = Path + path return r }
go
func URL(c CloneURL, path string) *Resource { r := &Resource{u: c.URL()} r.u.Path = Path + path return r }
[ "func", "URL", "(", "c", "CloneURL", ",", "path", "string", ")", "*", "Resource", "{", "r", ":=", "&", "Resource", "{", "u", ":", "c", ".", "URL", "(", ")", "}", "\n", "r", ".", "u", ".", "Path", "=", "Path", "+", "path", "\n", "return", "r",...
// URL creates a URL resource
[ "URL", "creates", "a", "URL", "resource" ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/vapi/internal/internal.go#L85-L89
train
vmware/govmomi
vapi/internal/internal.go
WithID
func (r *Resource) WithID(id string) *Resource { r.u.Path += "/id:" + id return r }
go
func (r *Resource) WithID(id string) *Resource { r.u.Path += "/id:" + id return r }
[ "func", "(", "r", "*", "Resource", ")", "WithID", "(", "id", "string", ")", "*", "Resource", "{", "r", ".", "u", ".", "Path", "+=", "\"", "\"", "+", "id", "\n", "return", "r", "\n", "}" ]
// WithID appends id to the URL.Path
[ "WithID", "appends", "id", "to", "the", "URL", ".", "Path" ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/vapi/internal/internal.go#L96-L99
train
vmware/govmomi
vapi/internal/internal.go
WithAction
func (r *Resource) WithAction(action string) *Resource { r.u.RawQuery = url.Values{ "~action": []string{action}, }.Encode() return r }
go
func (r *Resource) WithAction(action string) *Resource { r.u.RawQuery = url.Values{ "~action": []string{action}, }.Encode() return r }
[ "func", "(", "r", "*", "Resource", ")", "WithAction", "(", "action", "string", ")", "*", "Resource", "{", "r", ".", "u", ".", "RawQuery", "=", "url", ".", "Values", "{", "\"", "\"", ":", "[", "]", "string", "{", "action", "}", ",", "}", ".", "E...
// WithAction sets adds action to the URL.RawQuery
[ "WithAction", "sets", "adds", "action", "to", "the", "URL", ".", "RawQuery" ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/vapi/internal/internal.go#L102-L107
train
vmware/govmomi
vapi/internal/internal.go
WithParameter
func (r *Resource) WithParameter(name string, value string) *Resource { parameter := url.Values{} parameter.Set(name, value) r.u.RawQuery = parameter.Encode() return r }
go
func (r *Resource) WithParameter(name string, value string) *Resource { parameter := url.Values{} parameter.Set(name, value) r.u.RawQuery = parameter.Encode() return r }
[ "func", "(", "r", "*", "Resource", ")", "WithParameter", "(", "name", "string", ",", "value", "string", ")", "*", "Resource", "{", "parameter", ":=", "url", ".", "Values", "{", "}", "\n", "parameter", ".", "Set", "(", "name", ",", "value", ")", "\n",...
// WithParameter sets adds a parameter to the URL.RawQuery
[ "WithParameter", "sets", "adds", "a", "parameter", "to", "the", "URL", ".", "RawQuery" ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/vapi/internal/internal.go#L110-L115
train
vmware/govmomi
vapi/internal/internal.go
Request
func (r *Resource) Request(method string, body ...interface{}) *http.Request { rdr := io.MultiReader() // empty body by default if len(body) != 0 { rdr = encode(body[0]) } req, err := http.NewRequest(method, r.u.String(), rdr) if err != nil { panic(err) } return req }
go
func (r *Resource) Request(method string, body ...interface{}) *http.Request { rdr := io.MultiReader() // empty body by default if len(body) != 0 { rdr = encode(body[0]) } req, err := http.NewRequest(method, r.u.String(), rdr) if err != nil { panic(err) } return req }
[ "func", "(", "r", "*", "Resource", ")", "Request", "(", "method", "string", ",", "body", "...", "interface", "{", "}", ")", "*", "http", ".", "Request", "{", "rdr", ":=", "io", ".", "MultiReader", "(", ")", "// empty body by default", "\n", "if", "len"...
// Request returns a new http.Request for the given method. // An optional body can be provided for POST and PATCH methods.
[ "Request", "returns", "a", "new", "http", ".", "Request", "for", "the", "given", "method", ".", "An", "optional", "body", "can", "be", "provided", "for", "POST", "and", "PATCH", "methods", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/vapi/internal/internal.go#L119-L129
train
vmware/govmomi
vapi/internal/internal.go
encode
func encode(body interface{}) io.Reader { var b bytes.Buffer err := json.NewEncoder(&b).Encode(body) if err != nil { return errorReader{err} } return &b }
go
func encode(body interface{}) io.Reader { var b bytes.Buffer err := json.NewEncoder(&b).Encode(body) if err != nil { return errorReader{err} } return &b }
[ "func", "encode", "(", "body", "interface", "{", "}", ")", "io", ".", "Reader", "{", "var", "b", "bytes", ".", "Buffer", "\n", "err", ":=", "json", ".", "NewEncoder", "(", "&", "b", ")", ".", "Encode", "(", "body", ")", "\n", "if", "err", "!=", ...
// encode body as JSON, deferring any errors until io.Reader is used.
[ "encode", "body", "as", "JSON", "deferring", "any", "errors", "until", "io", ".", "Reader", "is", "used", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/vapi/internal/internal.go#L140-L147
train
vmware/govmomi
vim25/client.go
NewClient
func NewClient(ctx context.Context, rt soap.RoundTripper) (*Client, error) { c := Client{ RoundTripper: rt, } // Set client if it happens to be a soap.Client if sc, ok := rt.(*soap.Client); ok { c.Client = sc if c.Namespace == "" { c.Namespace = "urn:" + Namespace } else if !strings.Contains(c.Namespac...
go
func NewClient(ctx context.Context, rt soap.RoundTripper) (*Client, error) { c := Client{ RoundTripper: rt, } // Set client if it happens to be a soap.Client if sc, ok := rt.(*soap.Client); ok { c.Client = sc if c.Namespace == "" { c.Namespace = "urn:" + Namespace } else if !strings.Contains(c.Namespac...
[ "func", "NewClient", "(", "ctx", "context", ".", "Context", ",", "rt", "soap", ".", "RoundTripper", ")", "(", "*", "Client", ",", "error", ")", "{", "c", ":=", "Client", "{", "RoundTripper", ":", "rt", ",", "}", "\n\n", "// Set client if it happens to be a...
// NewClient creates and returns a new client with the ServiceContent field // filled in.
[ "NewClient", "creates", "and", "returns", "a", "new", "client", "with", "the", "ServiceContent", "field", "filled", "in", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/vim25/client.go#L59-L85
train
vmware/govmomi
vim25/client.go
RoundTrip
func (c *Client) RoundTrip(ctx context.Context, req, res soap.HasFault) error { return c.RoundTripper.RoundTrip(ctx, req, res) }
go
func (c *Client) RoundTrip(ctx context.Context, req, res soap.HasFault) error { return c.RoundTripper.RoundTrip(ctx, req, res) }
[ "func", "(", "c", "*", "Client", ")", "RoundTrip", "(", "ctx", "context", ".", "Context", ",", "req", ",", "res", "soap", ".", "HasFault", ")", "error", "{", "return", "c", ".", "RoundTripper", ".", "RoundTrip", "(", "ctx", ",", "req", ",", "res", ...
// RoundTrip dispatches to the RoundTripper field.
[ "RoundTrip", "dispatches", "to", "the", "RoundTripper", "field", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/vim25/client.go#L88-L90
train
vmware/govmomi
vim25/client.go
Valid
func (c *Client) Valid() bool { if c == nil { return false } if c.Client == nil { return false } // Use arbitrary pointer field in the service content. // Doesn't matter which one, as long as it is populated by default. if c.ServiceContent.SessionManager == nil { return false } return true }
go
func (c *Client) Valid() bool { if c == nil { return false } if c.Client == nil { return false } // Use arbitrary pointer field in the service content. // Doesn't matter which one, as long as it is populated by default. if c.ServiceContent.SessionManager == nil { return false } return true }
[ "func", "(", "c", "*", "Client", ")", "Valid", "(", ")", "bool", "{", "if", "c", "==", "nil", "{", "return", "false", "\n", "}", "\n\n", "if", "c", ".", "Client", "==", "nil", "{", "return", "false", "\n", "}", "\n\n", "// Use arbitrary pointer field...
// Valid returns whether or not the client is valid and ready for use. // This should be called after unmarshalling the client.
[ "Valid", "returns", "whether", "or", "not", "the", "client", "is", "valid", "and", "ready", "for", "use", ".", "This", "should", "be", "called", "after", "unmarshalling", "the", "client", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/vim25/client.go#L125-L141
train
vmware/govmomi
govc/task/recent.go
taskName
func taskName(info *types.TaskInfo) string { name := strings.TrimSuffix(info.Name, "_Task") switch name { case "": return info.DescriptionId case "Destroy", "Rename": return info.Entity.Type + "." + name default: return name } }
go
func taskName(info *types.TaskInfo) string { name := strings.TrimSuffix(info.Name, "_Task") switch name { case "": return info.DescriptionId case "Destroy", "Rename": return info.Entity.Type + "." + name default: return name } }
[ "func", "taskName", "(", "info", "*", "types", ".", "TaskInfo", ")", "string", "{", "name", ":=", "strings", ".", "TrimSuffix", "(", "info", ".", "Name", ",", "\"", "\"", ")", "\n", "switch", "name", "{", "case", "\"", "\"", ":", "return", "info", ...
// taskName describes the tasks similar to the ESX ui
[ "taskName", "describes", "the", "tasks", "similar", "to", "the", "ESX", "ui" ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/govc/task/recent.go#L91-L101
train
vmware/govmomi
govc/flags/datastore.go
NewCustomDatastoreFlag
func NewCustomDatastoreFlag(ctx context.Context) (*DatastoreFlag, context.Context) { v := &DatastoreFlag{} v.DatacenterFlag, ctx = NewDatacenterFlag(ctx) return v, ctx }
go
func NewCustomDatastoreFlag(ctx context.Context) (*DatastoreFlag, context.Context) { v := &DatastoreFlag{} v.DatacenterFlag, ctx = NewDatacenterFlag(ctx) return v, ctx }
[ "func", "NewCustomDatastoreFlag", "(", "ctx", "context", ".", "Context", ")", "(", "*", "DatastoreFlag", ",", "context", ".", "Context", ")", "{", "v", ":=", "&", "DatastoreFlag", "{", "}", "\n", "v", ".", "DatacenterFlag", ",", "ctx", "=", "NewDatacenterF...
// NewCustomDatastoreFlag creates and returns a new DatastoreFlag without // trying to retrieve an existing one from the specified context.
[ "NewCustomDatastoreFlag", "creates", "and", "returns", "a", "new", "DatastoreFlag", "without", "trying", "to", "retrieve", "an", "existing", "one", "from", "the", "specified", "context", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/govc/flags/datastore.go#L43-L47
train
vmware/govmomi
object/datastore_file_manager.go
NewFileManager
func (d Datastore) NewFileManager(dc *Datacenter, force bool) *DatastoreFileManager { c := d.Client() m := &DatastoreFileManager{ Datacenter: dc, Datastore: &d, FileManager: NewFileManager(c), VirtualDiskManager: NewVirtualDiskManager(c), Force: force, DatacenterTarge...
go
func (d Datastore) NewFileManager(dc *Datacenter, force bool) *DatastoreFileManager { c := d.Client() m := &DatastoreFileManager{ Datacenter: dc, Datastore: &d, FileManager: NewFileManager(c), VirtualDiskManager: NewVirtualDiskManager(c), Force: force, DatacenterTarge...
[ "func", "(", "d", "Datastore", ")", "NewFileManager", "(", "dc", "*", "Datacenter", ",", "force", "bool", ")", "*", "DatastoreFileManager", "{", "c", ":=", "d", ".", "Client", "(", ")", "\n\n", "m", ":=", "&", "DatastoreFileManager", "{", "Datacenter", "...
// NewFileManager creates a new instance of DatastoreFileManager
[ "NewFileManager", "creates", "a", "new", "instance", "of", "DatastoreFileManager" ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/object/datastore_file_manager.go#L45-L58
train
vmware/govmomi
object/datastore_file_manager.go
Delete
func (m *DatastoreFileManager) Delete(ctx context.Context, name string) error { switch path.Ext(name) { case ".vmdk": return m.DeleteVirtualDisk(ctx, name) default: return m.DeleteFile(ctx, name) } }
go
func (m *DatastoreFileManager) Delete(ctx context.Context, name string) error { switch path.Ext(name) { case ".vmdk": return m.DeleteVirtualDisk(ctx, name) default: return m.DeleteFile(ctx, name) } }
[ "func", "(", "m", "*", "DatastoreFileManager", ")", "Delete", "(", "ctx", "context", ".", "Context", ",", "name", "string", ")", "error", "{", "switch", "path", ".", "Ext", "(", "name", ")", "{", "case", "\"", "\"", ":", "return", "m", ".", "DeleteVi...
// Delete dispatches to the appropriate Delete method based on file name extension
[ "Delete", "dispatches", "to", "the", "appropriate", "Delete", "method", "based", "on", "file", "name", "extension" ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/object/datastore_file_manager.go#L74-L81
train
vmware/govmomi
object/datastore_file_manager.go
DeleteFile
func (m *DatastoreFileManager) DeleteFile(ctx context.Context, name string) error { p := m.Path(name) task, err := m.FileManager.DeleteDatastoreFile(ctx, p.String(), m.Datacenter) if err != nil { return err } return m.wait(ctx, task) }
go
func (m *DatastoreFileManager) DeleteFile(ctx context.Context, name string) error { p := m.Path(name) task, err := m.FileManager.DeleteDatastoreFile(ctx, p.String(), m.Datacenter) if err != nil { return err } return m.wait(ctx, task) }
[ "func", "(", "m", "*", "DatastoreFileManager", ")", "DeleteFile", "(", "ctx", "context", ".", "Context", ",", "name", "string", ")", "error", "{", "p", ":=", "m", ".", "Path", "(", "name", ")", "\n\n", "task", ",", "err", ":=", "m", ".", "FileManager...
// DeleteFile calls FileManager.DeleteDatastoreFile
[ "DeleteFile", "calls", "FileManager", ".", "DeleteDatastoreFile" ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/object/datastore_file_manager.go#L84-L93
train
vmware/govmomi
object/datastore_file_manager.go
DeleteVirtualDisk
func (m *DatastoreFileManager) DeleteVirtualDisk(ctx context.Context, name string) error { p := m.Path(name) var merr error if m.Force { merr = m.markDiskAsDeletable(ctx, p) } task, err := m.VirtualDiskManager.DeleteVirtualDisk(ctx, p.String(), m.Datacenter) if err != nil { log.Printf("markDiskAsDeletable(...
go
func (m *DatastoreFileManager) DeleteVirtualDisk(ctx context.Context, name string) error { p := m.Path(name) var merr error if m.Force { merr = m.markDiskAsDeletable(ctx, p) } task, err := m.VirtualDiskManager.DeleteVirtualDisk(ctx, p.String(), m.Datacenter) if err != nil { log.Printf("markDiskAsDeletable(...
[ "func", "(", "m", "*", "DatastoreFileManager", ")", "DeleteVirtualDisk", "(", "ctx", "context", ".", "Context", ",", "name", "string", ")", "error", "{", "p", ":=", "m", ".", "Path", "(", "name", ")", "\n\n", "var", "merr", "error", "\n\n", "if", "m", ...
// DeleteVirtualDisk calls VirtualDiskManager.DeleteVirtualDisk // Regardless of the Datastore type, DeleteVirtualDisk will fail if 'ddb.deletable=false', // so if Force=true this method attempts to set 'ddb.deletable=true' before starting the delete task.
[ "DeleteVirtualDisk", "calls", "VirtualDiskManager", ".", "DeleteVirtualDisk", "Regardless", "of", "the", "Datastore", "type", "DeleteVirtualDisk", "will", "fail", "if", "ddb", ".", "deletable", "=", "false", "so", "if", "Force", "=", "true", "this", "method", "att...
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/object/datastore_file_manager.go#L98-L114
train
vmware/govmomi
object/datastore_file_manager.go
Copy
func (m *DatastoreFileManager) Copy(ctx context.Context, src string, dst string) error { srcp := m.Path(src) dstp := m.Path(dst) f := m.FileManager.CopyDatastoreFile if srcp.IsVMDK() { // types.VirtualDiskSpec=nil as it is not implemented by vCenter f = func(ctx context.Context, src string, srcDC *Datacenter,...
go
func (m *DatastoreFileManager) Copy(ctx context.Context, src string, dst string) error { srcp := m.Path(src) dstp := m.Path(dst) f := m.FileManager.CopyDatastoreFile if srcp.IsVMDK() { // types.VirtualDiskSpec=nil as it is not implemented by vCenter f = func(ctx context.Context, src string, srcDC *Datacenter,...
[ "func", "(", "m", "*", "DatastoreFileManager", ")", "Copy", "(", "ctx", "context", ".", "Context", ",", "src", "string", ",", "dst", "string", ")", "error", "{", "srcp", ":=", "m", ".", "Path", "(", "src", ")", "\n", "dstp", ":=", "m", ".", "Path",...
// Copy dispatches to the appropriate FileManager or VirtualDiskManager Copy method based on file name extension
[ "Copy", "dispatches", "to", "the", "appropriate", "FileManager", "or", "VirtualDiskManager", "Copy", "method", "based", "on", "file", "name", "extension" ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/object/datastore_file_manager.go#L130-L149
train
vmware/govmomi
object/datastore_file_manager.go
MoveFile
func (m *DatastoreFileManager) MoveFile(ctx context.Context, src string, dst string) error { srcp := m.Path(src) dstp := m.Path(dst) task, err := m.FileManager.MoveDatastoreFile(ctx, srcp.String(), m.Datacenter, dstp.String(), m.DatacenterTarget, m.Force) if err != nil { return err } return m.wait(ctx, task) ...
go
func (m *DatastoreFileManager) MoveFile(ctx context.Context, src string, dst string) error { srcp := m.Path(src) dstp := m.Path(dst) task, err := m.FileManager.MoveDatastoreFile(ctx, srcp.String(), m.Datacenter, dstp.String(), m.DatacenterTarget, m.Force) if err != nil { return err } return m.wait(ctx, task) ...
[ "func", "(", "m", "*", "DatastoreFileManager", ")", "MoveFile", "(", "ctx", "context", ".", "Context", ",", "src", "string", ",", "dst", "string", ")", "error", "{", "srcp", ":=", "m", ".", "Path", "(", "src", ")", "\n", "dstp", ":=", "m", ".", "Pa...
// MoveFile calls FileManager.MoveDatastoreFile
[ "MoveFile", "calls", "FileManager", ".", "MoveDatastoreFile" ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/object/datastore_file_manager.go#L152-L162
train
vmware/govmomi
object/datastore_file_manager.go
Move
func (m *DatastoreFileManager) Move(ctx context.Context, src string, dst string) error { srcp := m.Path(src) dstp := m.Path(dst) f := m.FileManager.MoveDatastoreFile if srcp.IsVMDK() { f = m.VirtualDiskManager.MoveVirtualDisk } task, err := f(ctx, srcp.String(), m.Datacenter, dstp.String(), m.DatacenterTarge...
go
func (m *DatastoreFileManager) Move(ctx context.Context, src string, dst string) error { srcp := m.Path(src) dstp := m.Path(dst) f := m.FileManager.MoveDatastoreFile if srcp.IsVMDK() { f = m.VirtualDiskManager.MoveVirtualDisk } task, err := f(ctx, srcp.String(), m.Datacenter, dstp.String(), m.DatacenterTarge...
[ "func", "(", "m", "*", "DatastoreFileManager", ")", "Move", "(", "ctx", "context", ".", "Context", ",", "src", "string", ",", "dst", "string", ")", "error", "{", "srcp", ":=", "m", ".", "Path", "(", "src", ")", "\n", "dstp", ":=", "m", ".", "Path",...
// Move dispatches to the appropriate FileManager or VirtualDiskManager Move method based on file name extension
[ "Move", "dispatches", "to", "the", "appropriate", "FileManager", "or", "VirtualDiskManager", "Move", "method", "based", "on", "file", "name", "extension" ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/object/datastore_file_manager.go#L165-L181
train
vmware/govmomi
object/datastore_file_manager.go
Path
func (m *DatastoreFileManager) Path(name string) *DatastorePath { var p DatastorePath if !p.FromString(name) { p.Path = name p.Datastore = m.Datastore.Name() } return &p }
go
func (m *DatastoreFileManager) Path(name string) *DatastorePath { var p DatastorePath if !p.FromString(name) { p.Path = name p.Datastore = m.Datastore.Name() } return &p }
[ "func", "(", "m", "*", "DatastoreFileManager", ")", "Path", "(", "name", "string", ")", "*", "DatastorePath", "{", "var", "p", "DatastorePath", "\n\n", "if", "!", "p", ".", "FromString", "(", "name", ")", "{", "p", ".", "Path", "=", "name", "\n", "p"...
// Path converts path name to a DatastorePath
[ "Path", "converts", "path", "name", "to", "a", "DatastorePath" ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/object/datastore_file_manager.go#L184-L193
train
vmware/govmomi
nfc/lease.go
Abort
func (l *Lease) Abort(ctx context.Context, fault *types.LocalizedMethodFault) error { req := types.HttpNfcLeaseAbort{ This: l.Reference(), Fault: fault, } _, err := methods.HttpNfcLeaseAbort(ctx, l.c, &req) if err != nil { return err } return nil }
go
func (l *Lease) Abort(ctx context.Context, fault *types.LocalizedMethodFault) error { req := types.HttpNfcLeaseAbort{ This: l.Reference(), Fault: fault, } _, err := methods.HttpNfcLeaseAbort(ctx, l.c, &req) if err != nil { return err } return nil }
[ "func", "(", "l", "*", "Lease", ")", "Abort", "(", "ctx", "context", ".", "Context", ",", "fault", "*", "types", ".", "LocalizedMethodFault", ")", "error", "{", "req", ":=", "types", ".", "HttpNfcLeaseAbort", "{", "This", ":", "l", ".", "Reference", "(...
// Abort wraps methods.Abort
[ "Abort", "wraps", "methods", ".", "Abort" ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/nfc/lease.go#L45-L57
train
vmware/govmomi
nfc/lease.go
Complete
func (l *Lease) Complete(ctx context.Context) error { req := types.HttpNfcLeaseComplete{ This: l.Reference(), } _, err := methods.HttpNfcLeaseComplete(ctx, l.c, &req) if err != nil { return err } return nil }
go
func (l *Lease) Complete(ctx context.Context) error { req := types.HttpNfcLeaseComplete{ This: l.Reference(), } _, err := methods.HttpNfcLeaseComplete(ctx, l.c, &req) if err != nil { return err } return nil }
[ "func", "(", "l", "*", "Lease", ")", "Complete", "(", "ctx", "context", ".", "Context", ")", "error", "{", "req", ":=", "types", ".", "HttpNfcLeaseComplete", "{", "This", ":", "l", ".", "Reference", "(", ")", ",", "}", "\n\n", "_", ",", "err", ":="...
// Complete wraps methods.Complete
[ "Complete", "wraps", "methods", ".", "Complete" ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/nfc/lease.go#L60-L71
train
vmware/govmomi
nfc/lease.go
GetManifest
func (l *Lease) GetManifest(ctx context.Context) error { req := types.HttpNfcLeaseGetManifest{ This: l.Reference(), } _, err := methods.HttpNfcLeaseGetManifest(ctx, l.c, &req) if err != nil { return err } return nil }
go
func (l *Lease) GetManifest(ctx context.Context) error { req := types.HttpNfcLeaseGetManifest{ This: l.Reference(), } _, err := methods.HttpNfcLeaseGetManifest(ctx, l.c, &req) if err != nil { return err } return nil }
[ "func", "(", "l", "*", "Lease", ")", "GetManifest", "(", "ctx", "context", ".", "Context", ")", "error", "{", "req", ":=", "types", ".", "HttpNfcLeaseGetManifest", "{", "This", ":", "l", ".", "Reference", "(", ")", ",", "}", "\n\n", "_", ",", "err", ...
// GetManifest wraps methods.GetManifest
[ "GetManifest", "wraps", "methods", ".", "GetManifest" ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/nfc/lease.go#L74-L85
train
vmware/govmomi
nfc/lease.go
Progress
func (l *Lease) Progress(ctx context.Context, percent int32) error { req := types.HttpNfcLeaseProgress{ This: l.Reference(), Percent: percent, } _, err := methods.HttpNfcLeaseProgress(ctx, l.c, &req) if err != nil { return err } return nil }
go
func (l *Lease) Progress(ctx context.Context, percent int32) error { req := types.HttpNfcLeaseProgress{ This: l.Reference(), Percent: percent, } _, err := methods.HttpNfcLeaseProgress(ctx, l.c, &req) if err != nil { return err } return nil }
[ "func", "(", "l", "*", "Lease", ")", "Progress", "(", "ctx", "context", ".", "Context", ",", "percent", "int32", ")", "error", "{", "req", ":=", "types", ".", "HttpNfcLeaseProgress", "{", "This", ":", "l", ".", "Reference", "(", ")", ",", "Percent", ...
// Progress wraps methods.Progress
[ "Progress", "wraps", "methods", ".", "Progress" ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/nfc/lease.go#L88-L100
train
vmware/govmomi
vapi/library/library.go
FindLibrary
func (c *Manager) FindLibrary(ctx context.Context, search Find) ([]string, error) { url := internal.URL(c, internal.LibraryPath).WithAction("find") spec := struct { Spec Find `json:"spec"` }{search} var res []string return res, c.Do(ctx, url.Request(http.MethodPost, spec), &res) }
go
func (c *Manager) FindLibrary(ctx context.Context, search Find) ([]string, error) { url := internal.URL(c, internal.LibraryPath).WithAction("find") spec := struct { Spec Find `json:"spec"` }{search} var res []string return res, c.Do(ctx, url.Request(http.MethodPost, spec), &res) }
[ "func", "(", "c", "*", "Manager", ")", "FindLibrary", "(", "ctx", "context", ".", "Context", ",", "search", "Find", ")", "(", "[", "]", "string", ",", "error", ")", "{", "url", ":=", "internal", ".", "URL", "(", "c", ",", "internal", ".", "LibraryP...
// FindLibrary returns one or more libraries that match the provided search // criteria. // // The provided name is case-insensitive. // // Either the name or type of library may be set to empty values in order // to search for all libraries, all libraries with a specific name, regardless // of type, or all libraries o...
[ "FindLibrary", "returns", "one", "or", "more", "libraries", "that", "match", "the", "provided", "search", "criteria", ".", "The", "provided", "name", "is", "case", "-", "insensitive", ".", "Either", "the", "name", "or", "type", "of", "library", "may", "be", ...
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/vapi/library/library.go#L83-L90
train
vmware/govmomi
vapi/library/library.go
CreateLibrary
func (c *Manager) CreateLibrary(ctx context.Context, library Library) (string, error) { if library.Type != "LOCAL" { return "", fmt.Errorf("unsupported library type: %q", library.Type) } spec := struct { Library Library `json:"create_spec"` }{library} url := internal.URL(c, internal.LocalLibraryPath) var res ...
go
func (c *Manager) CreateLibrary(ctx context.Context, library Library) (string, error) { if library.Type != "LOCAL" { return "", fmt.Errorf("unsupported library type: %q", library.Type) } spec := struct { Library Library `json:"create_spec"` }{library} url := internal.URL(c, internal.LocalLibraryPath) var res ...
[ "func", "(", "c", "*", "Manager", ")", "CreateLibrary", "(", "ctx", "context", ".", "Context", ",", "library", "Library", ")", "(", "string", ",", "error", ")", "{", "if", "library", ".", "Type", "!=", "\"", "\"", "{", "return", "\"", "\"", ",", "f...
// CreateLibrary creates a new library with the given Type, Name, // Description, and CategoryID.
[ "CreateLibrary", "creates", "a", "new", "library", "with", "the", "given", "Type", "Name", "Description", "and", "CategoryID", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/vapi/library/library.go#L94-L104
train
vmware/govmomi
vapi/library/library.go
DeleteLibrary
func (c *Manager) DeleteLibrary(ctx context.Context, library *Library) error { url := internal.URL(c, internal.LocalLibraryPath).WithID(library.ID) return c.Do(ctx, url.Request(http.MethodDelete), nil) }
go
func (c *Manager) DeleteLibrary(ctx context.Context, library *Library) error { url := internal.URL(c, internal.LocalLibraryPath).WithID(library.ID) return c.Do(ctx, url.Request(http.MethodDelete), nil) }
[ "func", "(", "c", "*", "Manager", ")", "DeleteLibrary", "(", "ctx", "context", ".", "Context", ",", "library", "*", "Library", ")", "error", "{", "url", ":=", "internal", ".", "URL", "(", "c", ",", "internal", ".", "LocalLibraryPath", ")", ".", "WithID...
// DeleteLibrary deletes an existing library.
[ "DeleteLibrary", "deletes", "an", "existing", "library", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/vapi/library/library.go#L107-L110
train
vmware/govmomi
vapi/library/library.go
ListLibraries
func (c *Manager) ListLibraries(ctx context.Context) ([]string, error) { url := internal.URL(c, internal.LibraryPath) var res []string return res, c.Do(ctx, url.Request(http.MethodGet), &res) }
go
func (c *Manager) ListLibraries(ctx context.Context) ([]string, error) { url := internal.URL(c, internal.LibraryPath) var res []string return res, c.Do(ctx, url.Request(http.MethodGet), &res) }
[ "func", "(", "c", "*", "Manager", ")", "ListLibraries", "(", "ctx", "context", ".", "Context", ")", "(", "[", "]", "string", ",", "error", ")", "{", "url", ":=", "internal", ".", "URL", "(", "c", ",", "internal", ".", "LibraryPath", ")", "\n", "var...
// ListLibraries returns a list of all content library IDs in the system.
[ "ListLibraries", "returns", "a", "list", "of", "all", "content", "library", "IDs", "in", "the", "system", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/vapi/library/library.go#L113-L117
train
vmware/govmomi
vapi/library/library.go
GetLibraryByID
func (c *Manager) GetLibraryByID(ctx context.Context, id string) (*Library, error) { url := internal.URL(c, internal.LibraryPath).WithID(id) var res Library return &res, c.Do(ctx, url.Request(http.MethodGet), &res) }
go
func (c *Manager) GetLibraryByID(ctx context.Context, id string) (*Library, error) { url := internal.URL(c, internal.LibraryPath).WithID(id) var res Library return &res, c.Do(ctx, url.Request(http.MethodGet), &res) }
[ "func", "(", "c", "*", "Manager", ")", "GetLibraryByID", "(", "ctx", "context", ".", "Context", ",", "id", "string", ")", "(", "*", "Library", ",", "error", ")", "{", "url", ":=", "internal", ".", "URL", "(", "c", ",", "internal", ".", "LibraryPath",...
// GetLibraryByID returns information on a library for the given ID.
[ "GetLibraryByID", "returns", "information", "on", "a", "library", "for", "the", "given", "ID", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/vapi/library/library.go#L120-L124
train
vmware/govmomi
vapi/library/library.go
GetLibraryByName
func (c *Manager) GetLibraryByName(ctx context.Context, name string) (*Library, error) { // Lookup by name libraries, err := c.GetLibraries(ctx) if err != nil { return nil, err } for i := range libraries { if libraries[i].Name == name { return &libraries[i], nil } } return nil, fmt.Errorf("library name ...
go
func (c *Manager) GetLibraryByName(ctx context.Context, name string) (*Library, error) { // Lookup by name libraries, err := c.GetLibraries(ctx) if err != nil { return nil, err } for i := range libraries { if libraries[i].Name == name { return &libraries[i], nil } } return nil, fmt.Errorf("library name ...
[ "func", "(", "c", "*", "Manager", ")", "GetLibraryByName", "(", "ctx", "context", ".", "Context", ",", "name", "string", ")", "(", "*", "Library", ",", "error", ")", "{", "// Lookup by name", "libraries", ",", "err", ":=", "c", ".", "GetLibraries", "(", ...
// GetLibraryByName returns information on a library for the given name.
[ "GetLibraryByName", "returns", "information", "on", "a", "library", "for", "the", "given", "name", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/vapi/library/library.go#L127-L139
train
vmware/govmomi
vapi/library/library.go
GetLibraries
func (c *Manager) GetLibraries(ctx context.Context) ([]Library, error) { ids, err := c.ListLibraries(ctx) if err != nil { return nil, fmt.Errorf("get libraries failed for: %s", err) } var libraries []Library for _, id := range ids { library, err := c.GetLibraryByID(ctx, id) if err != nil { return nil, fm...
go
func (c *Manager) GetLibraries(ctx context.Context) ([]Library, error) { ids, err := c.ListLibraries(ctx) if err != nil { return nil, fmt.Errorf("get libraries failed for: %s", err) } var libraries []Library for _, id := range ids { library, err := c.GetLibraryByID(ctx, id) if err != nil { return nil, fm...
[ "func", "(", "c", "*", "Manager", ")", "GetLibraries", "(", "ctx", "context", ".", "Context", ")", "(", "[", "]", "Library", ",", "error", ")", "{", "ids", ",", "err", ":=", "c", ".", "ListLibraries", "(", "ctx", ")", "\n", "if", "err", "!=", "ni...
// GetLibraries returns a list of all content library details in the system.
[ "GetLibraries", "returns", "a", "list", "of", "all", "content", "library", "details", "in", "the", "system", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/vapi/library/library.go#L142-L159
train
vmware/govmomi
simulator/property_collector.go
wrapValue
func wrapValue(rval reflect.Value, rtype reflect.Type) interface{} { pval := rval.Interface() if rval.Kind() == reflect.Slice { // Convert slice to types.ArrayOf* switch v := pval.(type) { case []string: pval = &types.ArrayOfString{ String: v, } case []uint8: pval = &types.ArrayOfByte{ Byte:...
go
func wrapValue(rval reflect.Value, rtype reflect.Type) interface{} { pval := rval.Interface() if rval.Kind() == reflect.Slice { // Convert slice to types.ArrayOf* switch v := pval.(type) { case []string: pval = &types.ArrayOfString{ String: v, } case []uint8: pval = &types.ArrayOfByte{ Byte:...
[ "func", "wrapValue", "(", "rval", "reflect", ".", "Value", ",", "rtype", "reflect", ".", "Type", ")", "interface", "{", "}", "{", "pval", ":=", "rval", ".", "Interface", "(", ")", "\n\n", "if", "rval", ".", "Kind", "(", ")", "==", "reflect", ".", "...
// wrapValue converts slice types to the appropriate ArrayOf type used in property collector responses.
[ "wrapValue", "converts", "slice", "types", "to", "the", "appropriate", "ArrayOf", "type", "used", "in", "property", "collector", "responses", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/simulator/property_collector.go#L113-L151
train
vmware/govmomi
simulator/property_collector.go
RetrieveProperties
func (pc *PropertyCollector) RetrieveProperties(ctx *Context, r *types.RetrieveProperties) soap.HasFault { body := &methods.RetrievePropertiesBody{} res := pc.RetrievePropertiesEx(ctx, &types.RetrievePropertiesEx{ This: r.This, SpecSet: r.SpecSet, }) if res.Fault() != nil { body.Fault_ = res.Fault() } e...
go
func (pc *PropertyCollector) RetrieveProperties(ctx *Context, r *types.RetrieveProperties) soap.HasFault { body := &methods.RetrievePropertiesBody{} res := pc.RetrievePropertiesEx(ctx, &types.RetrievePropertiesEx{ This: r.This, SpecSet: r.SpecSet, }) if res.Fault() != nil { body.Fault_ = res.Fault() } e...
[ "func", "(", "pc", "*", "PropertyCollector", ")", "RetrieveProperties", "(", "ctx", "*", "Context", ",", "r", "*", "types", ".", "RetrieveProperties", ")", "soap", ".", "HasFault", "{", "body", ":=", "&", "methods", ".", "RetrievePropertiesBody", "{", "}", ...
// RetrieveProperties is deprecated, but govmomi is still using it at the moment.
[ "RetrieveProperties", "is", "deprecated", "but", "govmomi", "is", "still", "using", "it", "at", "the", "moment", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/simulator/property_collector.go#L531-L548
train
vmware/govmomi
simulator/property_collector.go
WaitForUpdates
func (pc *PropertyCollector) WaitForUpdates(ctx *Context, r *types.WaitForUpdates) soap.HasFault { body := &methods.WaitForUpdatesBody{} res := pc.WaitForUpdatesEx(ctx, &types.WaitForUpdatesEx{ This: r.This, Version: r.Version, }) if res.Fault() != nil { body.Fault_ = res.Fault() } else { body.Res = &...
go
func (pc *PropertyCollector) WaitForUpdates(ctx *Context, r *types.WaitForUpdates) soap.HasFault { body := &methods.WaitForUpdatesBody{} res := pc.WaitForUpdatesEx(ctx, &types.WaitForUpdatesEx{ This: r.This, Version: r.Version, }) if res.Fault() != nil { body.Fault_ = res.Fault() } else { body.Res = &...
[ "func", "(", "pc", "*", "PropertyCollector", ")", "WaitForUpdates", "(", "ctx", "*", "Context", ",", "r", "*", "types", ".", "WaitForUpdates", ")", "soap", ".", "HasFault", "{", "body", ":=", "&", "methods", ".", "WaitForUpdatesBody", "{", "}", "\n\n", "...
// WaitForUpdates is deprecated, but pyvmomi is still using it at the moment.
[ "WaitForUpdates", "is", "deprecated", "but", "pyvmomi", "is", "still", "using", "it", "at", "the", "moment", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/simulator/property_collector.go#L759-L776
train
vmware/govmomi
simulator/property_collector.go
Fetch
func (pc *PropertyCollector) Fetch(ctx *Context, req *internal.Fetch) soap.HasFault { body := new(internal.FetchBody) if req.This == vim25.ServiceInstance && req.Prop == "content" { content := ctx.Map.content() // ovftool uses API version for 6.0 and fails when these fields are non-nil; TODO content.VStorageOb...
go
func (pc *PropertyCollector) Fetch(ctx *Context, req *internal.Fetch) soap.HasFault { body := new(internal.FetchBody) if req.This == vim25.ServiceInstance && req.Prop == "content" { content := ctx.Map.content() // ovftool uses API version for 6.0 and fails when these fields are non-nil; TODO content.VStorageOb...
[ "func", "(", "pc", "*", "PropertyCollector", ")", "Fetch", "(", "ctx", "*", "Context", ",", "req", "*", "internal", ".", "Fetch", ")", "soap", ".", "HasFault", "{", "body", ":=", "new", "(", "internal", ".", "FetchBody", ")", "\n\n", "if", "req", "."...
// Fetch is not documented in the vSphere SDK, but ovftool depends on it. // A Fetch request is converted to a RetrievePropertiesEx method call by vcsim.
[ "Fetch", "is", "not", "documented", "in", "the", "vSphere", "SDK", "but", "ovftool", "depends", "on", "it", ".", "A", "Fetch", "request", "is", "converted", "to", "a", "RetrievePropertiesEx", "method", "call", "by", "vcsim", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/simulator/property_collector.go#L780-L841
train
vmware/govmomi
object/datastore_path.go
FromString
func (p *DatastorePath) FromString(s string) bool { if s == "" { return false } s = strings.TrimSpace(s) if !strings.HasPrefix(s, "[") { return false } s = s[1:] ix := strings.Index(s, "]") if ix < 0 { return false } p.Datastore = s[:ix] p.Path = strings.TrimSpace(s[ix+1:]) return true }
go
func (p *DatastorePath) FromString(s string) bool { if s == "" { return false } s = strings.TrimSpace(s) if !strings.HasPrefix(s, "[") { return false } s = s[1:] ix := strings.Index(s, "]") if ix < 0 { return false } p.Datastore = s[:ix] p.Path = strings.TrimSpace(s[ix+1:]) return true }
[ "func", "(", "p", "*", "DatastorePath", ")", "FromString", "(", "s", "string", ")", "bool", "{", "if", "s", "==", "\"", "\"", "{", "return", "false", "\n", "}", "\n\n", "s", "=", "strings", ".", "TrimSpace", "(", "s", ")", "\n\n", "if", "!", "str...
// FromString parses a datastore path. // Returns true if the path could be parsed, false otherwise.
[ "FromString", "parses", "a", "datastore", "path", ".", "Returns", "true", "if", "the", "path", "could", "be", "parsed", "false", "otherwise", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/object/datastore_path.go#L33-L55
train
vmware/govmomi
object/datastore_path.go
String
func (p *DatastorePath) String() string { s := fmt.Sprintf("[%s]", p.Datastore) if p.Path == "" { return s } return strings.Join([]string{s, p.Path}, " ") }
go
func (p *DatastorePath) String() string { s := fmt.Sprintf("[%s]", p.Datastore) if p.Path == "" { return s } return strings.Join([]string{s, p.Path}, " ") }
[ "func", "(", "p", "*", "DatastorePath", ")", "String", "(", ")", "string", "{", "s", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "p", ".", "Datastore", ")", "\n\n", "if", "p", ".", "Path", "==", "\"", "\"", "{", "return", "s", "\n", "}",...
// String formats a datastore path.
[ "String", "formats", "a", "datastore", "path", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/object/datastore_path.go#L58-L66
train
vmware/govmomi
object/common.go
Name
func (c Common) Name() string { if c.InventoryPath == "" { return "" } return path.Base(c.InventoryPath) }
go
func (c Common) Name() string { if c.InventoryPath == "" { return "" } return path.Base(c.InventoryPath) }
[ "func", "(", "c", "Common", ")", "Name", "(", ")", "string", "{", "if", "c", ".", "InventoryPath", "==", "\"", "\"", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "path", ".", "Base", "(", "c", ".", "InventoryPath", ")", "\n", "}" ]
// Name returns the base name of the InventoryPath field
[ "Name", "returns", "the", "base", "name", "of", "the", "InventoryPath", "field" ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/object/common.go#L67-L72
train
vmware/govmomi
object/common.go
ObjectName
func (c Common) ObjectName(ctx context.Context) (string, error) { var o mo.ManagedEntity err := c.Properties(ctx, c.Reference(), []string{"name"}, &o) if err != nil { return "", err } if o.Name != "" { return o.Name, nil } // Network has its own "name" field... var n mo.Network err = c.Properties(ctx, ...
go
func (c Common) ObjectName(ctx context.Context) (string, error) { var o mo.ManagedEntity err := c.Properties(ctx, c.Reference(), []string{"name"}, &o) if err != nil { return "", err } if o.Name != "" { return o.Name, nil } // Network has its own "name" field... var n mo.Network err = c.Properties(ctx, ...
[ "func", "(", "c", "Common", ")", "ObjectName", "(", "ctx", "context", ".", "Context", ")", "(", "string", ",", "error", ")", "{", "var", "o", "mo", ".", "ManagedEntity", "\n\n", "err", ":=", "c", ".", "Properties", "(", "ctx", ",", "c", ".", "Refer...
// ObjectName returns the base name of the InventoryPath field if set, // otherwise fetches the mo.ManagedEntity.Name field via the property collector.
[ "ObjectName", "returns", "the", "base", "name", "of", "the", "InventoryPath", "field", "if", "set", "otherwise", "fetches", "the", "mo", ".", "ManagedEntity", ".", "Name", "field", "via", "the", "property", "collector", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/object/common.go#L80-L101
train
vmware/govmomi
session/manager.go
UserSession
func (sm *Manager) UserSession(ctx context.Context) (*types.UserSession, error) { var mgr mo.SessionManager pc := property.DefaultCollector(sm.client) err := pc.RetrieveOne(ctx, sm.Reference(), []string{"currentSession"}, &mgr) if err != nil { // It's OK if we can't retrieve properties because we're not authenti...
go
func (sm *Manager) UserSession(ctx context.Context) (*types.UserSession, error) { var mgr mo.SessionManager pc := property.DefaultCollector(sm.client) err := pc.RetrieveOne(ctx, sm.Reference(), []string{"currentSession"}, &mgr) if err != nil { // It's OK if we can't retrieve properties because we're not authenti...
[ "func", "(", "sm", "*", "Manager", ")", "UserSession", "(", "ctx", "context", ".", "Context", ")", "(", "*", "types", ".", "UserSession", ",", "error", ")", "{", "var", "mgr", "mo", ".", "SessionManager", "\n\n", "pc", ":=", "property", ".", "DefaultCo...
// UserSession retrieves and returns the SessionManager's CurrentSession field. // Nil is returned if the session is not authenticated.
[ "UserSession", "retrieves", "and", "returns", "the", "SessionManager", "s", "CurrentSession", "field", ".", "Nil", "is", "returned", "if", "the", "session", "is", "not", "authenticated", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/session/manager.go#L162-L180
train
vmware/govmomi
session/manager.go
SessionIsActive
func (sm *Manager) SessionIsActive(ctx context.Context) (bool, error) { if sm.userSession == nil { return false, nil } req := types.SessionIsActive{ This: sm.Reference(), SessionID: sm.userSession.Key, UserName: sm.userSession.UserName, } active, err := methods.SessionIsActive(ctx, sm.client, &req)...
go
func (sm *Manager) SessionIsActive(ctx context.Context) (bool, error) { if sm.userSession == nil { return false, nil } req := types.SessionIsActive{ This: sm.Reference(), SessionID: sm.userSession.Key, UserName: sm.userSession.UserName, } active, err := methods.SessionIsActive(ctx, sm.client, &req)...
[ "func", "(", "sm", "*", "Manager", ")", "SessionIsActive", "(", "ctx", "context", ".", "Context", ")", "(", "bool", ",", "error", ")", "{", "if", "sm", ".", "userSession", "==", "nil", "{", "return", "false", ",", "nil", "\n", "}", "\n\n", "req", "...
// SessionIsActive checks whether the session that was created at login is // still valid. This function only works against vCenter.
[ "SessionIsActive", "checks", "whether", "the", "session", "that", "was", "created", "at", "login", "is", "still", "valid", ".", "This", "function", "only", "works", "against", "vCenter", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/session/manager.go#L194-L211
train
vmware/govmomi
property/collector.go
DefaultCollector
func DefaultCollector(c *vim25.Client) *Collector { p := Collector{ roundTripper: c, reference: c.ServiceContent.PropertyCollector, } return &p }
go
func DefaultCollector(c *vim25.Client) *Collector { p := Collector{ roundTripper: c, reference: c.ServiceContent.PropertyCollector, } return &p }
[ "func", "DefaultCollector", "(", "c", "*", "vim25", ".", "Client", ")", "*", "Collector", "{", "p", ":=", "Collector", "{", "roundTripper", ":", "c", ",", "reference", ":", "c", ".", "ServiceContent", ".", "PropertyCollector", ",", "}", "\n\n", "return", ...
// DefaultCollector returns the session's default property collector.
[ "DefaultCollector", "returns", "the", "session", "s", "default", "property", "collector", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/property/collector.go#L41-L48
train
vmware/govmomi
property/collector.go
Create
func (p *Collector) Create(ctx context.Context) (*Collector, error) { req := types.CreatePropertyCollector{ This: p.Reference(), } res, err := methods.CreatePropertyCollector(ctx, p.roundTripper, &req) if err != nil { return nil, err } newp := Collector{ roundTripper: p.roundTripper, reference: res.R...
go
func (p *Collector) Create(ctx context.Context) (*Collector, error) { req := types.CreatePropertyCollector{ This: p.Reference(), } res, err := methods.CreatePropertyCollector(ctx, p.roundTripper, &req) if err != nil { return nil, err } newp := Collector{ roundTripper: p.roundTripper, reference: res.R...
[ "func", "(", "p", "*", "Collector", ")", "Create", "(", "ctx", "context", ".", "Context", ")", "(", "*", "Collector", ",", "error", ")", "{", "req", ":=", "types", ".", "CreatePropertyCollector", "{", "This", ":", "p", ".", "Reference", "(", ")", ","...
// Create creates a new session-specific Collector that can be used to // retrieve property updates independent of any other Collector.
[ "Create", "creates", "a", "new", "session", "-", "specific", "Collector", "that", "can", "be", "used", "to", "retrieve", "property", "updates", "independent", "of", "any", "other", "Collector", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/property/collector.go#L56-L72
train
vmware/govmomi
property/collector.go
Destroy
func (p *Collector) Destroy(ctx context.Context) error { req := types.DestroyPropertyCollector{ This: p.Reference(), } _, err := methods.DestroyPropertyCollector(ctx, p.roundTripper, &req) if err != nil { return err } p.reference = types.ManagedObjectReference{} return nil }
go
func (p *Collector) Destroy(ctx context.Context) error { req := types.DestroyPropertyCollector{ This: p.Reference(), } _, err := methods.DestroyPropertyCollector(ctx, p.roundTripper, &req) if err != nil { return err } p.reference = types.ManagedObjectReference{} return nil }
[ "func", "(", "p", "*", "Collector", ")", "Destroy", "(", "ctx", "context", ".", "Context", ")", "error", "{", "req", ":=", "types", ".", "DestroyPropertyCollector", "{", "This", ":", "p", ".", "Reference", "(", ")", ",", "}", "\n\n", "_", ",", "err",...
// Destroy destroys this Collector.
[ "Destroy", "destroys", "this", "Collector", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/property/collector.go#L75-L87
train
vmware/govmomi
property/wait.go
Add
func (f *WaitFilter) Add(obj types.ManagedObjectReference, kind string, ps []string, set ...types.BaseSelectionSpec) *WaitFilter { spec := types.ObjectSpec{ Obj: obj, SelectSet: set, } pset := types.PropertySpec{ Type: kind, PathSet: ps, } if len(ps) == 0 { pset.All = types.NewBool(true) } ...
go
func (f *WaitFilter) Add(obj types.ManagedObjectReference, kind string, ps []string, set ...types.BaseSelectionSpec) *WaitFilter { spec := types.ObjectSpec{ Obj: obj, SelectSet: set, } pset := types.PropertySpec{ Type: kind, PathSet: ps, } if len(ps) == 0 { pset.All = types.NewBool(true) } ...
[ "func", "(", "f", "*", "WaitFilter", ")", "Add", "(", "obj", "types", ".", "ManagedObjectReference", ",", "kind", "string", ",", "ps", "[", "]", "string", ",", "set", "...", "types", ".", "BaseSelectionSpec", ")", "*", "WaitFilter", "{", "spec", ":=", ...
// Add a new ObjectSpec and PropertySpec to the WaitFilter
[ "Add", "a", "new", "ObjectSpec", "and", "PropertySpec", "to", "the", "WaitFilter" ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/property/wait.go#L33-L53
train
vmware/govmomi
property/wait.go
Wait
func Wait(ctx context.Context, c *Collector, obj types.ManagedObjectReference, ps []string, f func([]types.PropertyChange) bool) error { filter := new(WaitFilter).Add(obj, obj.Type, ps) return WaitForUpdates(ctx, c, filter, func(updates []types.ObjectUpdate) bool { for _, update := range updates { if f(update.C...
go
func Wait(ctx context.Context, c *Collector, obj types.ManagedObjectReference, ps []string, f func([]types.PropertyChange) bool) error { filter := new(WaitFilter).Add(obj, obj.Type, ps) return WaitForUpdates(ctx, c, filter, func(updates []types.ObjectUpdate) bool { for _, update := range updates { if f(update.C...
[ "func", "Wait", "(", "ctx", "context", ".", "Context", ",", "c", "*", "Collector", ",", "obj", "types", ".", "ManagedObjectReference", ",", "ps", "[", "]", "string", ",", "f", "func", "(", "[", "]", "types", ".", "PropertyChange", ")", "bool", ")", "...
// Wait creates a new WaitFilter and calls the specified function for each ObjectUpdate via WaitForUpdates
[ "Wait", "creates", "a", "new", "WaitFilter", "and", "calls", "the", "specified", "function", "for", "each", "ObjectUpdate", "via", "WaitForUpdates" ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/property/wait.go#L56-L68
train
vmware/govmomi
govc/flags/network.go
Change
func (flag *NetworkFlag) Change(device types.BaseVirtualDevice, update types.BaseVirtualDevice) { current := device.(types.BaseVirtualEthernetCard).GetVirtualEthernetCard() changed := update.(types.BaseVirtualEthernetCard).GetVirtualEthernetCard() current.Backing = changed.Backing if changed.MacAddress != "" { ...
go
func (flag *NetworkFlag) Change(device types.BaseVirtualDevice, update types.BaseVirtualDevice) { current := device.(types.BaseVirtualEthernetCard).GetVirtualEthernetCard() changed := update.(types.BaseVirtualEthernetCard).GetVirtualEthernetCard() current.Backing = changed.Backing if changed.MacAddress != "" { ...
[ "func", "(", "flag", "*", "NetworkFlag", ")", "Change", "(", "device", "types", ".", "BaseVirtualDevice", ",", "update", "types", ".", "BaseVirtualDevice", ")", "{", "current", ":=", "device", ".", "(", "types", ".", "BaseVirtualEthernetCard", ")", ".", "Get...
// Change applies update backing and hardware address changes to the given network device.
[ "Change", "applies", "update", "backing", "and", "hardware", "address", "changes", "to", "the", "given", "network", "device", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/govc/flags/network.go#L134-L147
train
vmware/govmomi
object/extension_manager.go
GetExtensionManager
func GetExtensionManager(c *vim25.Client) (*ExtensionManager, error) { if c.ServiceContent.ExtensionManager == nil { return nil, ErrNotSupported } return NewExtensionManager(c), nil }
go
func GetExtensionManager(c *vim25.Client) (*ExtensionManager, error) { if c.ServiceContent.ExtensionManager == nil { return nil, ErrNotSupported } return NewExtensionManager(c), nil }
[ "func", "GetExtensionManager", "(", "c", "*", "vim25", ".", "Client", ")", "(", "*", "ExtensionManager", ",", "error", ")", "{", "if", "c", ".", "ServiceContent", ".", "ExtensionManager", "==", "nil", "{", "return", "nil", ",", "ErrNotSupported", "\n", "}"...
// GetExtensionManager wraps NewExtensionManager, returning ErrNotSupported // when the client is not connected to a vCenter instance.
[ "GetExtensionManager", "wraps", "NewExtensionManager", "returning", "ErrNotSupported", "when", "the", "client", "is", "not", "connected", "to", "a", "vCenter", "instance", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/object/extension_manager.go#L34-L39
train