Skip to content

Commit

Permalink
Add object destroy and rename commands
Browse files Browse the repository at this point in the history
- Remove datacenter.destroy command (use object.destroy instead)

- Remove folder.destroy command (use object.destroy instead)

- Rename folder.move_into -> object.mv
  • Loading branch information
dougm committed Oct 25, 2016
1 parent 22f02a3 commit 4fc9deb
Show file tree
Hide file tree
Showing 20 changed files with 302 additions and 300 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# changelog

### unreleased
### 0.10.1 (2016-10-25)

* Add object.DistributedVirtualPortgroup.Reconfigure method

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

A Go library for interacting with VMware vSphere APIs (ESXi and/or vCenter).

For `govc`, a CLI built on top of govmomi, check out the [govc](./govc) directory.
For `govc`, a CLI built on top of govmomi, check out the [govc](./govc) directory and [USAGE](./govc/USAGE.md) document.

## Compatibility

Expand Down
10 changes: 9 additions & 1 deletion govc/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
# changelog

### unreleased
### 0.10.1 (2016-10-25)

* Add object.destroy and object.rename commands

* Remove datacenter.destroy command (use object.destroy instead)

* Remove folder.destroy command (use object.destroy instead)

* Rename folder.move_into -> object.mv

* Add dvs.portgroup.change command

Expand Down
97 changes: 46 additions & 51 deletions govc/USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,14 +140,6 @@ Options:
-folder= Inventory folder [GOVC_FOLDER]
```

## datacenter.destroy

```
Usage: govc datacenter.destroy [OPTIONS] PATH...
Options:
```

## datacenter.info

```
Expand Down Expand Up @@ -306,8 +298,8 @@ Copy SOURCE from the local system to DEST on DS.
If SOURCE name is "-", read source from stdin.
Examples:
govc datasore.upload -ds datastore1 ./config.iso vm-name/config.iso
genisoimage ... | govc datasore.upload -ds datastore1 - vm-name/config.iso
govc datastore.upload -ds datastore1 ./config.iso vm-name/config.iso
genisoimage ... | govc datastore.upload -ds datastore1 - vm-name/config.iso
Options:
-ds= Datastore [GOVC_DATASTORE]
Expand Down Expand Up @@ -360,8 +352,8 @@ Eject media from CD-ROM device.
If device is not specified, the first CD-ROM device is used.
Examples:
govc device.floppy.eject -vm vm-1
govc device.floppy.eject -vm vm-1 -device floppy-1
govc device.cdrom.eject -vm vm-1
govc device.cdrom.eject -vm vm-1 -device floppy-1
Options:
-device= CD-ROM device name
Expand Down Expand Up @@ -678,7 +670,8 @@ Usage: govc events [OPTIONS] [PATH]...
Display events.
Examples:
govc events vm1 vm2
govc events vm/my-vm1 vm/my-vm2
govc events /dc1/vm/* /dc2/vm/*
govc ls -t HostSystem host/* | xargs govc events | grep -i vsan
Options:
Expand Down Expand Up @@ -807,16 +800,6 @@ Options:
-pod=false Create folder(s) of type StoragePod (DatastoreCluster)
```

## folder.destroy

```
Usage: govc folder.destroy [OPTIONS] FOLDER...
Destroy one or more FOLDERs.
Options:
```

## folder.info

```
Expand All @@ -825,34 +808,6 @@ Usage: govc folder.info [OPTIONS] [PATH]...
Options:
```

## folder.moveinto

```
Usage: govc folder.moveinto [OPTIONS] PATH...
Move managed entities into this folder.
Examples:
govc folder.moveinto -folder /dc1/folder-foo /dc2/folder-bar/*
Options:
-folder= Inventory folder [GOVC_FOLDER]
```

## folder.rename

```
Usage: govc folder.rename [OPTIONS] NAME
Rename an existing folder with NAME.
Examples:
govc folder.rename -folder /dc1/vm/folder-foo folder-bar
Options:
-folder= Inventory folder [GOVC_FOLDER]
```

## guest.chmod

```
Expand Down Expand Up @@ -1656,6 +1611,46 @@ Options:
-t= Object type
```

## object.destroy

```
Usage: govc object.destroy [OPTIONS] PATH...
Destroy managed objects.
Examples:
govc object.destroy /dc1/network/dvs /dc1/host/cluster
Options:
```

## object.mv

```
Usage: govc object.mv [OPTIONS] PATH... FOLDER
Move managed entities to FOLDER.
Examples:
govc folder.create /dc1/host/example
govc object.mv /dc2/host/*.example.com /dc1/host/example
Options:
```

## object.rename

```
Usage: govc object.rename [OPTIONS] PATH NAME
Rename managed objects.
Examples:
govc object.rename /dc1/network/dvs1 Switch1
Options:
```

## permissions.ls

```
Expand Down
83 changes: 0 additions & 83 deletions govc/datacenter/destroy.go

This file was deleted.

4 changes: 2 additions & 2 deletions govc/datastore/upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ func (cmd *upload) Description() string {
If SOURCE name is "-", read source from stdin.
Examples:
govc datasore.upload -ds datastore1 ./config.iso vm-name/config.iso
genisoimage ... | govc datasore.upload -ds datastore1 - vm-name/config.iso`
govc datastore.upload -ds datastore1 ./config.iso vm-name/config.iso
genisoimage ... | govc datastore.upload -ds datastore1 - vm-name/config.iso`
}

func (cmd *upload) Run(ctx context.Context, f *flag.FlagSet) error {
Expand Down
4 changes: 2 additions & 2 deletions govc/device/cdrom/eject.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ func (cmd *eject) Description() string {
If device is not specified, the first CD-ROM device is used.
Examples:
govc device.floppy.eject -vm vm-1
govc device.floppy.eject -vm vm-1 -device floppy-1`
govc device.cdrom.eject -vm vm-1
govc device.cdrom.eject -vm vm-1 -device floppy-1`
}

func (cmd *eject) Run(ctx context.Context, f *flag.FlagSet) error {
Expand Down
3 changes: 2 additions & 1 deletion govc/events/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ func (cmd *events) Description() string {
return `Display events.
Examples:
govc events vm1 vm2
govc events vm/my-vm1 vm/my-vm2
govc events /dc1/vm/* /dc2/vm/*
govc ls -t HostSystem host/* | xargs govc events | grep -i vsan`
}

Expand Down
4 changes: 4 additions & 0 deletions govc/flags/datacenter.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,10 @@ func (flag *DatacenterFlag) ManagedObjects(ctx context.Context, args []string) (
return nil, err
}

if len(elements) == 0 {
return nil, fmt.Errorf("object '%s' not found", arg)
}

for _, e := range elements {
refs = append(refs, e.Object.Reference())
}
Expand Down
86 changes: 0 additions & 86 deletions govc/folder/move_into.go

This file was deleted.

Loading

0 comments on commit 4fc9deb

Please sign in to comment.