github.com/swisscom/cloudfoundry-cli@v7.1.0+incompatible/command/v6/curl_command.go (about) 1 package v6 2 3 import ( 4 "code.cloudfoundry.org/cli/command" 5 "code.cloudfoundry.org/cli/command/flag" 6 "code.cloudfoundry.org/cli/command/translatableerror" 7 ) 8 9 type CurlCommand struct { 10 RequiredArgs flag.APIPath `positional-args:"yes"` 11 CustomHeaders []string `short:"H" description:"Custom headers to include in the request, flag can be specified multiple times"` 12 HTTPMethod string `short:"X" description:"HTTP method (GET,POST,PUT,DELETE,etc)"` 13 HTTPData flag.PathWithAt `short:"d" description:"HTTP data to include in the request body, or '@' followed by a file name to read the data from"` 14 FailOnHTTPError bool `short:"f" long:"fail" description:"Server errors return exit code 22"` 15 IncludeReponseHeaders bool `short:"i" description:"Include response headers in the output"` 16 OutputFile flag.Path `long:"output" description:"Write curl body to FILE instead of stdout"` 17 usage interface{} `usage:"CF_NAME curl PATH [-iv] [-X METHOD] [-H HEADER]... [-d DATA] [--output FILE]\n\n By default 'CF_NAME curl' will perform a GET to the specified PATH. If data\n is provided via -d, a POST will be performed instead, and the Content-Type\n will be set to application/json. You may override headers with -H and the\n request method with -X.\n\n For API documentation, please visit http://apidocs.cloudfoundry.org.\n\nEXAMPLES:\n CF_NAME curl \"/v2/apps\" -X GET -H \"Content-Type: application/x-www-form-urlencoded\" -d 'q=name:myapp'\n CF_NAME curl \"/v2/apps\" -d @/path/to/file"` 18 } 19 20 func (CurlCommand) Setup(config command.Config, ui command.UI) error { 21 return nil 22 } 23 24 func (CurlCommand) Execute(args []string) error { 25 return translatableerror.UnrefactoredCommandError{} 26 }