Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exported FindSnapshot() Method #715

Merged
merged 2 commits into from
May 4, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions object/virtual_machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -518,11 +518,11 @@ func (m snapshotMap) add(parent string, tree []types.VirtualMachineSnapshotTree)
}
}

// findSnapshot supports snapshot lookup by name, where name can be:
// FindSnapshot supports snapshot lookup by name, where name can be:
// 1) snapshot ManagedObjectReference.Value (unique)
// 2) snapshot name (may not be unique)
// 3) snapshot tree path (may not be unique)
func (v VirtualMachine) findSnapshot(ctx context.Context, name string) (Reference, error) {
func (v VirtualMachine) FindSnapshot(ctx context.Context, name string) (Reference, error) {
var o mo.VirtualMachine

err := v.Properties(ctx, v.Reference(), []string{"snapshot"}, &o)
Expand Down Expand Up @@ -550,7 +550,7 @@ func (v VirtualMachine) findSnapshot(ctx context.Context, name string) (Referenc

// RemoveSnapshot removes a named snapshot
func (v VirtualMachine) RemoveSnapshot(ctx context.Context, name string, removeChildren bool, consolidate *bool) (*Task, error) {
snapshot, err := v.findSnapshot(ctx, name)
snapshot, err := v.FindSnapshot(ctx, name)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -586,7 +586,7 @@ func (v VirtualMachine) RevertToCurrentSnapshot(ctx context.Context, suppressPow

// RevertToSnapshot reverts to a named snapshot
func (v VirtualMachine) RevertToSnapshot(ctx context.Context, name string, suppressPowerOn bool) (*Task, error) {
snapshot, err := v.findSnapshot(ctx, name)
snapshot, err := v.FindSnapshot(ctx, name)
if err != nil {
return nil, err
}
Expand Down