id
int32
0
167k
repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
listlengths
21
1.41k
docstring
stringlengths
6
2.61k
docstring_tokens
listlengths
3
215
sha
stringlengths
40
40
url
stringlengths
85
252
21,300
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
21,301
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
21,302
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
21,303
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
21,304
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
21,305
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
21,306
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
21,307
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
21,308
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
21,309
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
21,310
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
21,311
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
21,312
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
21,313
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
21,314
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
21,315
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
21,316
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
21,317
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
21,318
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
21,319
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
21,320
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
21,321
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
21,322
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
21,323
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
21,324
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
21,325
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
21,326
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
21,327
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
21,328
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
21,329
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
21,330
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
21,331
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
21,332
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
21,333
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
21,334
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
21,335
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
21,336
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
21,337
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
21,338
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
21,339
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
21,340
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
21,341
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
21,342
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
21,343
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
21,344
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
21,345
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
21,346
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
21,347
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
21,348
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
21,349
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
21,350
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
21,351
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
21,352
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
21,353
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
21,354
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
21,355
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
21,356
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
21,357
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
21,358
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
21,359
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
21,360
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
21,361
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
21,362
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
21,363
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
21,364
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
21,365
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
21,366
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
21,367
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
21,368
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
21,369
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
21,370
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
21,371
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
21,372
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
21,373
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
21,374
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
21,375
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
21,376
vmware/govmomi
simulator/datacenter.go
NewDatacenter
func NewDatacenter(f *Folder) *Datacenter { dc := &Datacenter{ isESX: f.Self == esx.RootFolder.Self, } if dc.isESX { dc.Datacenter = esx.Datacenter } f.putChild(dc) dc.createFolders() return dc }
go
func NewDatacenter(f *Folder) *Datacenter { dc := &Datacenter{ isESX: f.Self == esx.RootFolder.Self, } if dc.isESX { dc.Datacenter = esx.Datacenter } f.putChild(dc) dc.createFolders() return dc }
[ "func", "NewDatacenter", "(", "f", "*", "Folder", ")", "*", "Datacenter", "{", "dc", ":=", "&", "Datacenter", "{", "isESX", ":", "f", ".", "Self", "==", "esx", ".", "RootFolder", ".", "Self", ",", "}", "\n\n", "if", "dc", ".", "isESX", "{", "dc", ...
// NewDatacenter creates a Datacenter and its child folders.
[ "NewDatacenter", "creates", "a", "Datacenter", "and", "its", "child", "folders", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/simulator/datacenter.go#L36-L50
21,377
vmware/govmomi
vapi/tags/tags.go
CreateTag
func (c *Manager) CreateTag(ctx context.Context, tag *Tag) (string, error) { // create avoids the annoyance of CreateTag requiring a "description" key to be included in the request, // even though the field value can be empty. type create struct { Name string `json:"name"` Description string `json:"descri...
go
func (c *Manager) CreateTag(ctx context.Context, tag *Tag) (string, error) { // create avoids the annoyance of CreateTag requiring a "description" key to be included in the request, // even though the field value can be empty. type create struct { Name string `json:"name"` Description string `json:"descri...
[ "func", "(", "c", "*", "Manager", ")", "CreateTag", "(", "ctx", "context", ".", "Context", ",", "tag", "*", "Tag", ")", "(", "string", ",", "error", ")", "{", "// create avoids the annoyance of CreateTag requiring a \"description\" key to be included in the request,", ...
// CreateTag creates a new tag with the given Name, Description and CategoryID.
[ "CreateTag", "creates", "a", "new", "tag", "with", "the", "given", "Name", "Description", "and", "CategoryID", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/vapi/tags/tags.go#L69-L96
21,378
vmware/govmomi
vapi/tags/tags.go
UpdateTag
func (c *Manager) UpdateTag(ctx context.Context, tag *Tag) error { spec := struct { Tag Tag `json:"update_spec"` }{ Tag: Tag{ Name: tag.Name, Description: tag.Description, }, } url := internal.URL(c, internal.TagPath).WithID(tag.ID) return c.Do(ctx, url.Request(http.MethodPatch, spec), nil) }
go
func (c *Manager) UpdateTag(ctx context.Context, tag *Tag) error { spec := struct { Tag Tag `json:"update_spec"` }{ Tag: Tag{ Name: tag.Name, Description: tag.Description, }, } url := internal.URL(c, internal.TagPath).WithID(tag.ID) return c.Do(ctx, url.Request(http.MethodPatch, spec), nil) }
[ "func", "(", "c", "*", "Manager", ")", "UpdateTag", "(", "ctx", "context", ".", "Context", ",", "tag", "*", "Tag", ")", "error", "{", "spec", ":=", "struct", "{", "Tag", "Tag", "`json:\"update_spec\"`", "\n", "}", "{", "Tag", ":", "Tag", "{", "Name",...
// UpdateTag can update one or both of the tag Description and Name fields.
[ "UpdateTag", "can", "update", "one", "or", "both", "of", "the", "tag", "Description", "and", "Name", "fields", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/vapi/tags/tags.go#L99-L110
21,379
vmware/govmomi
vapi/tags/tags.go
DeleteTag
func (c *Manager) DeleteTag(ctx context.Context, tag *Tag) error { url := internal.URL(c, internal.TagPath).WithID(tag.ID) return c.Do(ctx, url.Request(http.MethodDelete), nil) }
go
func (c *Manager) DeleteTag(ctx context.Context, tag *Tag) error { url := internal.URL(c, internal.TagPath).WithID(tag.ID) return c.Do(ctx, url.Request(http.MethodDelete), nil) }
[ "func", "(", "c", "*", "Manager", ")", "DeleteTag", "(", "ctx", "context", ".", "Context", ",", "tag", "*", "Tag", ")", "error", "{", "url", ":=", "internal", ".", "URL", "(", "c", ",", "internal", ".", "TagPath", ")", ".", "WithID", "(", "tag", ...
// DeleteTag deletes an existing tag.
[ "DeleteTag", "deletes", "an", "existing", "tag", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/vapi/tags/tags.go#L113-L116
21,380
vmware/govmomi
vapi/tags/tags.go
GetTag
func (c *Manager) GetTag(ctx context.Context, id string) (*Tag, error) { if isName(id) { tags, err := c.GetTags(ctx) if err != nil { return nil, err } for i := range tags { if tags[i].Name == id { return &tags[i], nil } } } url := internal.URL(c, internal.TagPath).WithID(id) var res Tag re...
go
func (c *Manager) GetTag(ctx context.Context, id string) (*Tag, error) { if isName(id) { tags, err := c.GetTags(ctx) if err != nil { return nil, err } for i := range tags { if tags[i].Name == id { return &tags[i], nil } } } url := internal.URL(c, internal.TagPath).WithID(id) var res Tag re...
[ "func", "(", "c", "*", "Manager", ")", "GetTag", "(", "ctx", "context", ".", "Context", ",", "id", "string", ")", "(", "*", "Tag", ",", "error", ")", "{", "if", "isName", "(", "id", ")", "{", "tags", ",", "err", ":=", "c", ".", "GetTags", "(", ...
// GetTag fetches the tag information for the given identifier. // The id parameter can be a Tag ID or Tag Name.
[ "GetTag", "fetches", "the", "tag", "information", "for", "the", "given", "identifier", ".", "The", "id", "parameter", "can", "be", "a", "Tag", "ID", "or", "Tag", "Name", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/vapi/tags/tags.go#L120-L138
21,381
vmware/govmomi
vapi/tags/tags.go
GetTagForCategory
func (c *Manager) GetTagForCategory(ctx context.Context, id, category string) (*Tag, error) { if category == "" { return c.GetTag(ctx, id) } ids, err := c.ListTagsForCategory(ctx, category) if err != nil { return nil, err } for _, tagid := range ids { tag, err := c.GetTag(ctx, tagid) if err != nil { ...
go
func (c *Manager) GetTagForCategory(ctx context.Context, id, category string) (*Tag, error) { if category == "" { return c.GetTag(ctx, id) } ids, err := c.ListTagsForCategory(ctx, category) if err != nil { return nil, err } for _, tagid := range ids { tag, err := c.GetTag(ctx, tagid) if err != nil { ...
[ "func", "(", "c", "*", "Manager", ")", "GetTagForCategory", "(", "ctx", "context", ".", "Context", ",", "id", ",", "category", "string", ")", "(", "*", "Tag", ",", "error", ")", "{", "if", "category", "==", "\"", "\"", "{", "return", "c", ".", "Get...
// GetTagForCategory fetches the tag information for the given identifier in the given category.
[ "GetTagForCategory", "fetches", "the", "tag", "information", "for", "the", "given", "identifier", "in", "the", "given", "category", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/vapi/tags/tags.go#L141-L162
21,382
vmware/govmomi
vapi/tags/tags.go
ListTags
func (c *Manager) ListTags(ctx context.Context) ([]string, error) { url := internal.URL(c, internal.TagPath) var res []string return res, c.Do(ctx, url.Request(http.MethodGet), &res) }
go
func (c *Manager) ListTags(ctx context.Context) ([]string, error) { url := internal.URL(c, internal.TagPath) var res []string return res, c.Do(ctx, url.Request(http.MethodGet), &res) }
[ "func", "(", "c", "*", "Manager", ")", "ListTags", "(", "ctx", "context", ".", "Context", ")", "(", "[", "]", "string", ",", "error", ")", "{", "url", ":=", "internal", ".", "URL", "(", "c", ",", "internal", ".", "TagPath", ")", "\n", "var", "res...
// ListTags returns all tag IDs in the system.
[ "ListTags", "returns", "all", "tag", "IDs", "in", "the", "system", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/vapi/tags/tags.go#L165-L169
21,383
vmware/govmomi
vapi/tags/tags.go
GetTags
func (c *Manager) GetTags(ctx context.Context) ([]Tag, error) { ids, err := c.ListTags(ctx) if err != nil { return nil, fmt.Errorf("get tags failed for: %s", err) } var tags []Tag for _, id := range ids { tag, err := c.GetTag(ctx, id) if err != nil { return nil, fmt.Errorf("get category %s failed for %s"...
go
func (c *Manager) GetTags(ctx context.Context) ([]Tag, error) { ids, err := c.ListTags(ctx) if err != nil { return nil, fmt.Errorf("get tags failed for: %s", err) } var tags []Tag for _, id := range ids { tag, err := c.GetTag(ctx, id) if err != nil { return nil, fmt.Errorf("get category %s failed for %s"...
[ "func", "(", "c", "*", "Manager", ")", "GetTags", "(", "ctx", "context", ".", "Context", ")", "(", "[", "]", "Tag", ",", "error", ")", "{", "ids", ",", "err", ":=", "c", ".", "ListTags", "(", "ctx", ")", "\n", "if", "err", "!=", "nil", "{", "...
// GetTags fetches an array of tag information in the system.
[ "GetTags", "fetches", "an", "array", "of", "tag", "information", "in", "the", "system", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/vapi/tags/tags.go#L172-L189
21,384
vmware/govmomi
vim25/soap/client.go
NewServiceClient
func (c *Client) NewServiceClient(path string, namespace string) *Client { vc := c.URL() u, err := url.Parse(path) if err != nil { log.Panicf("url.Parse(%q): %s", path, err) } if u.Host == "" { u.Scheme = vc.Scheme u.Host = vc.Host } client := NewClient(u, c.k) client.Namespace = "urn:" + namespace if c...
go
func (c *Client) NewServiceClient(path string, namespace string) *Client { vc := c.URL() u, err := url.Parse(path) if err != nil { log.Panicf("url.Parse(%q): %s", path, err) } if u.Host == "" { u.Scheme = vc.Scheme u.Host = vc.Host } client := NewClient(u, c.k) client.Namespace = "urn:" + namespace if c...
[ "func", "(", "c", "*", "Client", ")", "NewServiceClient", "(", "path", "string", ",", "namespace", "string", ")", "*", "Client", "{", "vc", ":=", "c", ".", "URL", "(", ")", "\n", "u", ",", "err", ":=", "url", ".", "Parse", "(", "path", ")", "\n",...
// NewServiceClient creates a NewClient with the given URL.Path and namespace.
[ "NewServiceClient", "creates", "a", "NewClient", "with", "the", "given", "URL", ".", "Path", "and", "namespace", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/vim25/soap/client.go#L159-L200
21,385
vmware/govmomi
vim25/soap/client.go
hostAddr
func hostAddr(addr string) string { _, port := splitHostPort(addr) if port == "" { return addr + ":443" } return addr }
go
func hostAddr(addr string) string { _, port := splitHostPort(addr) if port == "" { return addr + ":443" } return addr }
[ "func", "hostAddr", "(", "addr", "string", ")", "string", "{", "_", ",", "port", ":=", "splitHostPort", "(", "addr", ")", "\n", "if", "port", "==", "\"", "\"", "{", "return", "addr", "+", "\"", "\"", "\n", "}", "\n", "return", "addr", "\n", "}" ]
// Add default https port if missing
[ "Add", "default", "https", "port", "if", "missing" ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/vim25/soap/client.go#L229-L235
21,386
vmware/govmomi
vim25/soap/client.go
Thumbprint
func (c *Client) Thumbprint(host string) string { host = hostAddr(host) c.hostsMu.Lock() defer c.hostsMu.Unlock() return c.hosts[host] }
go
func (c *Client) Thumbprint(host string) string { host = hostAddr(host) c.hostsMu.Lock() defer c.hostsMu.Unlock() return c.hosts[host] }
[ "func", "(", "c", "*", "Client", ")", "Thumbprint", "(", "host", "string", ")", "string", "{", "host", "=", "hostAddr", "(", "host", ")", "\n", "c", ".", "hostsMu", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "hostsMu", ".", "Unlock", "(", ")...
// Thumbprint returns the certificate thumbprint for the given host if known to this client.
[ "Thumbprint", "returns", "the", "certificate", "thumbprint", "for", "the", "given", "host", "if", "known", "to", "this", "client", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/vim25/soap/client.go#L256-L261
21,387
vmware/govmomi
vim25/soap/client.go
LoadThumbprints
func (c *Client) LoadThumbprints(file string) error { if file == "" { return nil } for _, name := range filepath.SplitList(file) { err := c.loadThumbprints(name) if err != nil { return err } } return nil }
go
func (c *Client) LoadThumbprints(file string) error { if file == "" { return nil } for _, name := range filepath.SplitList(file) { err := c.loadThumbprints(name) if err != nil { return err } } return nil }
[ "func", "(", "c", "*", "Client", ")", "LoadThumbprints", "(", "file", "string", ")", "error", "{", "if", "file", "==", "\"", "\"", "{", "return", "nil", "\n", "}", "\n\n", "for", "_", ",", "name", ":=", "range", "filepath", ".", "SplitList", "(", "...
// LoadThumbprints from file with the give name. // If name is empty or name does not exist this function will return nil.
[ "LoadThumbprints", "from", "file", "with", "the", "give", "name", ".", "If", "name", "is", "empty", "or", "name", "does", "not", "exist", "this", "function", "will", "return", "nil", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/vim25/soap/client.go#L265-L278
21,388
vmware/govmomi
vim25/soap/client.go
WithHeader
func (c *Client) WithHeader(ctx context.Context, header Header) context.Context { return context.WithValue(ctx, headerContext{}, header) }
go
func (c *Client) WithHeader(ctx context.Context, header Header) context.Context { return context.WithValue(ctx, headerContext{}, header) }
[ "func", "(", "c", "*", "Client", ")", "WithHeader", "(", "ctx", "context", ".", "Context", ",", "header", "Header", ")", "context", ".", "Context", "{", "return", "context", ".", "WithValue", "(", "ctx", ",", "headerContext", "{", "}", ",", "header", "...
// WithHeader can be used to modify the outgoing request soap.Header fields.
[ "WithHeader", "can", "be", "used", "to", "modify", "the", "outgoing", "request", "soap", ".", "Header", "fields", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/vim25/soap/client.go#L511-L513
21,389
vmware/govmomi
vim25/soap/client.go
Upload
func (c *Client) Upload(ctx context.Context, f io.Reader, u *url.URL, param *Upload) error { var err error if param.Progress != nil { pr := progress.NewReader(ctx, param.Progress, f, param.ContentLength) f = pr // Mark progress reader as done when returning from this function. defer func() { pr.Done(err)...
go
func (c *Client) Upload(ctx context.Context, f io.Reader, u *url.URL, param *Upload) error { var err error if param.Progress != nil { pr := progress.NewReader(ctx, param.Progress, f, param.ContentLength) f = pr // Mark progress reader as done when returning from this function. defer func() { pr.Done(err)...
[ "func", "(", "c", "*", "Client", ")", "Upload", "(", "ctx", "context", ".", "Context", ",", "f", "io", ".", "Reader", ",", "u", "*", "url", ".", "URL", ",", "param", "*", "Upload", ")", "error", "{", "var", "err", "error", "\n\n", "if", "param", ...
// Upload PUTs the local file to the given URL
[ "Upload", "PUTs", "the", "local", "file", "to", "the", "given", "URL" ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/vim25/soap/client.go#L625-L671
21,390
vmware/govmomi
vim25/soap/client.go
UploadFile
func (c *Client) UploadFile(ctx context.Context, file string, u *url.URL, param *Upload) error { if param == nil { p := DefaultUpload // Copy since we set ContentLength param = &p } s, err := os.Stat(file) if err != nil { return err } f, err := os.Open(filepath.Clean(file)) if err != nil { return err ...
go
func (c *Client) UploadFile(ctx context.Context, file string, u *url.URL, param *Upload) error { if param == nil { p := DefaultUpload // Copy since we set ContentLength param = &p } s, err := os.Stat(file) if err != nil { return err } f, err := os.Open(filepath.Clean(file)) if err != nil { return err ...
[ "func", "(", "c", "*", "Client", ")", "UploadFile", "(", "ctx", "context", ".", "Context", ",", "file", "string", ",", "u", "*", "url", ".", "URL", ",", "param", "*", "Upload", ")", "error", "{", "if", "param", "==", "nil", "{", "p", ":=", "Defau...
// UploadFile PUTs the local file to the given URL
[ "UploadFile", "PUTs", "the", "local", "file", "to", "the", "given", "URL" ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/vim25/soap/client.go#L674-L694
21,391
vmware/govmomi
vim25/soap/client.go
DownloadRequest
func (c *Client) DownloadRequest(ctx context.Context, u *url.URL, param *Download) (*http.Response, error) { req, err := http.NewRequest(param.Method, u.String(), nil) if err != nil { return nil, err } req = req.WithContext(ctx) for k, v := range param.Headers { req.Header.Add(k, v) } if param.Ticket != n...
go
func (c *Client) DownloadRequest(ctx context.Context, u *url.URL, param *Download) (*http.Response, error) { req, err := http.NewRequest(param.Method, u.String(), nil) if err != nil { return nil, err } req = req.WithContext(ctx) for k, v := range param.Headers { req.Header.Add(k, v) } if param.Ticket != n...
[ "func", "(", "c", "*", "Client", ")", "DownloadRequest", "(", "ctx", "context", ".", "Context", ",", "u", "*", "url", ".", "URL", ",", "param", "*", "Download", ")", "(", "*", "http", ".", "Response", ",", "error", ")", "{", "req", ",", "err", ":...
// DownloadRequest wraps http.Client.Do, returning the http.Response without checking its StatusCode
[ "DownloadRequest", "wraps", "http", ".", "Client", ".", "Do", "returning", "the", "http", ".", "Response", "without", "checking", "its", "StatusCode" ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/vim25/soap/client.go#L709-L726
21,392
vmware/govmomi
vim25/soap/client.go
Download
func (c *Client) Download(ctx context.Context, u *url.URL, param *Download) (io.ReadCloser, int64, error) { res, err := c.DownloadRequest(ctx, u, param) if err != nil { return nil, 0, err } switch res.StatusCode { case http.StatusOK: default: err = errors.New(res.Status) } if err != nil { return nil, 0,...
go
func (c *Client) Download(ctx context.Context, u *url.URL, param *Download) (io.ReadCloser, int64, error) { res, err := c.DownloadRequest(ctx, u, param) if err != nil { return nil, 0, err } switch res.StatusCode { case http.StatusOK: default: err = errors.New(res.Status) } if err != nil { return nil, 0,...
[ "func", "(", "c", "*", "Client", ")", "Download", "(", "ctx", "context", ".", "Context", ",", "u", "*", "url", ".", "URL", ",", "param", "*", "Download", ")", "(", "io", ".", "ReadCloser", ",", "int64", ",", "error", ")", "{", "res", ",", "err", ...
// Download GETs the remote file from the given URL
[ "Download", "GETs", "the", "remote", "file", "from", "the", "given", "URL" ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/vim25/soap/client.go#L729-L748
21,393
vmware/govmomi
vim25/soap/client.go
DownloadFile
func (c *Client) DownloadFile(ctx context.Context, file string, u *url.URL, param *Download) error { var err error if param == nil { param = &DefaultDownload } rc, contentLength, err := c.Download(ctx, u, param) if err != nil { return err } return c.WriteFile(ctx, file, rc, contentLength, param.Progress, p...
go
func (c *Client) DownloadFile(ctx context.Context, file string, u *url.URL, param *Download) error { var err error if param == nil { param = &DefaultDownload } rc, contentLength, err := c.Download(ctx, u, param) if err != nil { return err } return c.WriteFile(ctx, file, rc, contentLength, param.Progress, p...
[ "func", "(", "c", "*", "Client", ")", "DownloadFile", "(", "ctx", "context", ".", "Context", ",", "file", "string", ",", "u", "*", "url", ".", "URL", ",", "param", "*", "Download", ")", "error", "{", "var", "err", "error", "\n", "if", "param", "=="...
// DownloadFile GETs the given URL to a local file
[ "DownloadFile", "GETs", "the", "given", "URL", "to", "a", "local", "file" ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/vim25/soap/client.go#L788-L800
21,394
vmware/govmomi
toolbox/process.go
WithIO
func (p *Process) WithIO() *Process { p.IO = &ProcessIO{ Out: new(bytes.Buffer), Err: new(bytes.Buffer), } return p }
go
func (p *Process) WithIO() *Process { p.IO = &ProcessIO{ Out: new(bytes.Buffer), Err: new(bytes.Buffer), } return p }
[ "func", "(", "p", "*", "Process", ")", "WithIO", "(", ")", "*", "Process", "{", "p", ".", "IO", "=", "&", "ProcessIO", "{", "Out", ":", "new", "(", "bytes", ".", "Buffer", ")", ",", "Err", ":", "new", "(", "bytes", ".", "Buffer", ")", ",", "}...
// WithIO enables toolbox Process IO without file system disk IO.
[ "WithIO", "enables", "toolbox", "Process", "IO", "without", "file", "system", "disk", "IO", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/toolbox/process.go#L110-L117
21,395
vmware/govmomi
toolbox/process.go
NewProcessManager
func NewProcessManager() *ProcessManager { // We use pseudo PIDs that don't conflict with OS PIDs, so they can live in the same table. // For the pseudo PIDs, we use a sync.Pool rather than a plain old counter to avoid the unlikely, // but possible wrapping should such a counter exceed MaxInt64. pid := int64(32768)...
go
func NewProcessManager() *ProcessManager { // We use pseudo PIDs that don't conflict with OS PIDs, so they can live in the same table. // For the pseudo PIDs, we use a sync.Pool rather than a plain old counter to avoid the unlikely, // but possible wrapping should such a counter exceed MaxInt64. pid := int64(32768)...
[ "func", "NewProcessManager", "(", ")", "*", "ProcessManager", "{", "// We use pseudo PIDs that don't conflict with OS PIDs, so they can live in the same table.", "// For the pseudo PIDs, we use a sync.Pool rather than a plain old counter to avoid the unlikely,", "// but possible wrapping should su...
// NewProcessManager creates a new ProcessManager instance.
[ "NewProcessManager", "creates", "a", "new", "ProcessManager", "instance", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/toolbox/process.go#L221-L236
21,396
vmware/govmomi
toolbox/process.go
Start
func (m *ProcessManager) Start(r *vix.StartProgramRequest, p *Process) (int64, error) { p.Name = r.ProgramPath p.Args = r.Arguments // Owner is cosmetic, but useful for example with: govc guest.ps -U $uid if p.Owner == "" { p.Owner = defaultOwner } p.StartTime = time.Now().Unix() p.ctx, p.Kill = context.Wit...
go
func (m *ProcessManager) Start(r *vix.StartProgramRequest, p *Process) (int64, error) { p.Name = r.ProgramPath p.Args = r.Arguments // Owner is cosmetic, but useful for example with: govc guest.ps -U $uid if p.Owner == "" { p.Owner = defaultOwner } p.StartTime = time.Now().Unix() p.ctx, p.Kill = context.Wit...
[ "func", "(", "m", "*", "ProcessManager", ")", "Start", "(", "r", "*", "vix", ".", "StartProgramRequest", ",", "p", "*", "Process", ")", "(", "int64", ",", "error", ")", "{", "p", ".", "Name", "=", "r", ".", "ProgramPath", "\n", "p", ".", "Args", ...
// Start calls the Process.Start function, returning the pid on success or an error. // A goroutine is started that calls the Process.Wait function. After Process.Wait has // returned, the ProcessState EndTime and ExitCode fields are set. The process state can be // queried via ListProcessesInGuest until it is remove...
[ "Start", "calls", "the", "Process", ".", "Start", "function", "returning", "the", "pid", "on", "success", "or", "an", "error", ".", "A", "goroutine", "is", "started", "that", "calls", "the", "Process", ".", "Wait", "function", ".", "After", "Process", ".",...
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/toolbox/process.go#L242-L303
21,397
vmware/govmomi
toolbox/process.go
Kill
func (m *ProcessManager) Kill(pid int64) bool { m.mu.Lock() entry, ok := m.entries[pid] m.mu.Unlock() if ok { entry.Kill() return true } return false }
go
func (m *ProcessManager) Kill(pid int64) bool { m.mu.Lock() entry, ok := m.entries[pid] m.mu.Unlock() if ok { entry.Kill() return true } return false }
[ "func", "(", "m", "*", "ProcessManager", ")", "Kill", "(", "pid", "int64", ")", "bool", "{", "m", ".", "mu", ".", "Lock", "(", ")", "\n", "entry", ",", "ok", ":=", "m", ".", "entries", "[", "pid", "]", "\n", "m", ".", "mu", ".", "Unlock", "("...
// Kill cancels the Process Context. // Returns true if pid exists in the process table, false otherwise.
[ "Kill", "cancels", "the", "Process", "Context", ".", "Returns", "true", "if", "pid", "exists", "in", "the", "process", "table", "false", "otherwise", "." ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/toolbox/process.go#L307-L318
21,398
vmware/govmomi
toolbox/process.go
ListProcesses
func (m *ProcessManager) ListProcesses(pids []int64) []byte { w := new(bytes.Buffer) m.mu.Lock() if len(pids) == 0 { for _, p := range m.entries { _, _ = w.WriteString(p.toXML()) } } else { for _, id := range pids { p, ok := m.entries[id] if !ok { continue } _, _ = w.WriteString(p.toXML(...
go
func (m *ProcessManager) ListProcesses(pids []int64) []byte { w := new(bytes.Buffer) m.mu.Lock() if len(pids) == 0 { for _, p := range m.entries { _, _ = w.WriteString(p.toXML()) } } else { for _, id := range pids { p, ok := m.entries[id] if !ok { continue } _, _ = w.WriteString(p.toXML(...
[ "func", "(", "m", "*", "ProcessManager", ")", "ListProcesses", "(", "pids", "[", "]", "int64", ")", "[", "]", "byte", "{", "w", ":=", "new", "(", "bytes", ".", "Buffer", ")", "\n\n", "m", ".", "mu", ".", "Lock", "(", ")", "\n\n", "if", "len", "...
// ListProcesses marshals the ProcessState for the given pids. // If no pids are specified, all current processes are included. // The return value can be used for responding to a VixMsgListProcessesExRequest.
[ "ListProcesses", "marshals", "the", "ProcessState", "for", "the", "given", "pids", ".", "If", "no", "pids", "are", "specified", "all", "current", "processes", "are", "included", ".", "The", "return", "value", "can", "be", "used", "for", "responding", "to", "...
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/toolbox/process.go#L323-L346
21,399
vmware/govmomi
toolbox/process.go
Stat
func (m *ProcessManager) Stat(u *url.URL) (os.FileInfo, error) { name := path.Join("/proc", u.Path) info, err := os.Stat(name) if err == nil && info.Size() == 0 { // This is a real /proc file return &procFileInfo{info}, nil } dir, file := path.Split(u.Path) pid, err := strconv.ParseInt(path.Base(dir), 10, ...
go
func (m *ProcessManager) Stat(u *url.URL) (os.FileInfo, error) { name := path.Join("/proc", u.Path) info, err := os.Stat(name) if err == nil && info.Size() == 0 { // This is a real /proc file return &procFileInfo{info}, nil } dir, file := path.Split(u.Path) pid, err := strconv.ParseInt(path.Base(dir), 10, ...
[ "func", "(", "m", "*", "ProcessManager", ")", "Stat", "(", "u", "*", "url", ".", "URL", ")", "(", "os", ".", "FileInfo", ",", "error", ")", "{", "name", ":=", "path", ".", "Join", "(", "\"", "\"", ",", "u", ".", "Path", ")", "\n\n", "info", "...
// Stat implements hgfs.FileHandler.Stat
[ "Stat", "implements", "hgfs", ".", "FileHandler", ".", "Stat" ]
fc3f0e9d2275df0e497a80917807a7c72d3c35bc
https://github.com/vmware/govmomi/blob/fc3f0e9d2275df0e497a80917807a7c72d3c35bc/toolbox/process.go#L359-L424