-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: vCenter entity type constants (#360)
## Issue N/A ## Description Make all vCenter entity types constants. Signed-off-by: Tyler Gillson <tyler.gillson@gmail.com>
- Loading branch information
1 parent
f9b63d8
commit 3fb6f51
Showing
18 changed files
with
178 additions
and
171 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// Package vcenter contains vCenter object types. | ||
package vcenter | ||
|
||
// Account contains vCenter account details. | ||
type Account struct { | ||
// Insecure controls whether to validate the vCenter server's certificate. | ||
Insecure bool `json:"insecure" yaml:"insecure"` | ||
|
||
// Password is the vCenter password. | ||
Password string `json:"password" yaml:"password"` | ||
|
||
// Username is the vCenter username. | ||
Username string `json:"username" yaml:"username"` | ||
|
||
// Host is the vCenter URL. | ||
Host string `json:"host" yaml:"host"` | ||
} | ||
|
||
// Entity represents a vCenter entity, referenceable via govmomi. | ||
type Entity int | ||
|
||
// nolint:revive | ||
const ( | ||
Cluster Entity = iota | ||
Datacenter | ||
Datastore | ||
Folder | ||
Host | ||
Network | ||
ResourcePool | ||
VApp | ||
VCenterRoot | ||
VDS | ||
VM | ||
) | ||
|
||
// String converts an Entity to a string. | ||
func (e Entity) String() string { | ||
names := []string{ | ||
"cluster", | ||
"datacenter", | ||
"datastore", | ||
"folder", | ||
"host", | ||
"network", | ||
"resourcepool", | ||
"vapp", | ||
"", | ||
"vds", | ||
"vm", | ||
} | ||
if e > VM || e < Cluster { | ||
return "Unknown" | ||
} | ||
return names[e] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.