Skip to content

Commit

Permalink
Merge pull request #12 from openfresh/feature/add-metadata-instance-type
Browse files Browse the repository at this point in the history
Add fetchcmd for instance type
  • Loading branch information
stormcat24 authored Jan 28, 2018
2 parents 7b6565d + 808dc13 commit a73f385
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions cmd/metadata/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ var (
func init() {
MetadataCmd.AddCommand(regionCmd)
MetadataCmd.AddCommand(instanceIdCmd)
MetadataCmd.AddCommand(instanceTypeCmd)
}
24 changes: 24 additions & 0 deletions cmd/metadata/instance_type.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package metadata

import (
"fmt"

"github.com/spf13/cobra"
)

var (
instanceTypeCmd = &cobra.Command{
Use: "instance-type",
Short: "get own EC2 instance type",
RunE: func(cmd *cobra.Command, args []string) error {

instanceType, err := client.GetMetadata("instance-type")
if err != nil {
return err
}

fmt.Println(instanceType)
return nil
},
}
)

0 comments on commit a73f385

Please sign in to comment.