Skip to content
This repository has been archived by the owner on Jan 1, 2023. It is now read-only.

Commit

Permalink
add possibility to execute arbitrary request
Browse files Browse the repository at this point in the history
  • Loading branch information
floriankammermann committed Dec 3, 2017
1 parent e828198 commit b5e8b53
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions cmd/request.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package cmd

import (
"fmt"
"github.com/spf13/cobra"
"github.com/floriankammermann/vcloud-cli/vcdapi"
"github.com/spf13/viper"
)

var path string

var requestCmd = &cobra.Command{
Use: "request",
Short: "execute requests",
Long: "execute requests",
Run: func(cmd *cobra.Command, args []string) {

if len(path) > 0 {
url := viper.GetString("url")
user := viper.GetString("user")
password := viper.GetString("password")
org := viper.GetString("org")
vcdapi.GetAuthToken(url, user, password, org)
vcdapi.ExecRequest(url, path, nil)
} else {
fmt.Println("you have to provide the path")
}
},
}

func init() {
requestCmd.Flags().StringVarP(&path, "path", "n", "", "url to request")
RootCmd.AddCommand(requestCmd)
}

0 comments on commit b5e8b53

Please sign in to comment.