MCPcopy Create free account
hub / github.com/cloudwan/gohan / getPostCommand

Method getPostCommand

cli/client/commands.go:126–148  ·  view source on GitHub ↗
(s *schema.Schema)

Source from the content-addressed store, hash-verified

124}
125
126func (gohanClientCLI *GohanClientCLI) getPostCommand(s *schema.Schema) gohanCommand {
127 return gohanCommand{
128 Name: fmt.Sprintf("%s create", s.ID),
129 Schema: s,
130 Action: func(args []string) (string, error) {
131 argsMap, err := gohanClientCLI.handleArguments(args, s)
132 if err != nil {
133 return "", err
134 }
135 parsedArgs, err := gohanClientCLI.handleRelationArguments(s, argsMap)
136 if err != nil {
137 return "", err
138 }
139 opts := gophercloud.RequestOpts{
140 JSONBody: parsedArgs,
141 OkCodes: []int{201, 202, 400},
142 }
143 url := fmt.Sprintf("%s%s", gohanClientCLI.opts.gohanEndpointURL, s.URL)
144 result, err := gohanClientCLI.request("POST", url, &opts)
145 return gohanClientCLI.formatOutput(s, result), err
146 },
147 }
148}
149
150func (gohanClientCLI *GohanClientCLI) getPutCommand(s *schema.Schema) gohanCommand {
151 return gohanCommand{

Callers 2

getCommandsMethod · 0.95
client_test.goFile · 0.80

Calls 4

handleArgumentsMethod · 0.95
requestMethod · 0.95
formatOutputMethod · 0.95

Tested by

no test coverage detected