-
Notifications
You must be signed in to change notification settings - Fork 243
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #273 from Tinyblargon/Feature-Guest-Features
Feature: guest features
- Loading branch information
Showing
8 changed files
with
196 additions
and
11 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package guest | ||
|
||
import ( | ||
"github.com/Telmate/proxmox-api-go/cli" | ||
"github.com/Telmate/proxmox-api-go/proxmox" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var featureCmd = &cobra.Command{ | ||
Use: "feature GUESTID", | ||
Short: "Gets the available features of the specified guest", | ||
Args: cobra.ExactArgs(1), | ||
RunE: func(cmd *cobra.Command, args []string) (err error) { | ||
id := cli.ValidateIntIDset(args, "GuestID") | ||
vmr := proxmox.NewVmRef(id) | ||
c := cli.NewClient() | ||
err = c.CheckVmRef(vmr) | ||
if err != nil { | ||
return | ||
} | ||
features, err := proxmox.ListGuestFeatures(vmr, c) | ||
if err != nil { | ||
return | ||
} | ||
cli.PrintFormattedJson(guestCmd.OutOrStdout(), features) | ||
return | ||
}, | ||
} | ||
|
||
func init() { | ||
guestCmd.AddCommand(featureCmd) | ||
} |
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,15 @@ | ||
package guest | ||
|
||
import ( | ||
"github.com/Telmate/proxmox-api-go/cli/command/get" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var guestCmd = &cobra.Command{ | ||
Use: "guest", | ||
Short: "Commands to get information of guests on Proxmox", | ||
} | ||
|
||
func init() { | ||
get.GetCmd.AddCommand(guestCmd) | ||
} |
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