/
get_file_system_info_operation.go
91 lines (74 loc) · 2.5 KB
/
get_file_system_info_operation.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
// Code generated by go-swagger;
package cli
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"encoding/json"
"fmt"
"github.com/umutbasal/antmedia/client/management_rest_service"
"github.com/go-openapi/swag"
"github.com/spf13/cobra"
)
// makeOperationManagementRestServiceGetFileSystemInfoCmd returns a cmd to handle operation getFileSystemInfo
func makeOperationManagementRestServiceGetFileSystemInfoCmd() (*cobra.Command, error) {
cmd := &cobra.Command{
Use: "getFileSystemInfo",
Short: ``,
RunE: runOperationManagementRestServiceGetFileSystemInfo,
}
if err := registerOperationManagementRestServiceGetFileSystemInfoParamFlags(cmd); err != nil {
return nil, err
}
return cmd, nil
}
// runOperationManagementRestServiceGetFileSystemInfo uses cmd flags to call endpoint api
func runOperationManagementRestServiceGetFileSystemInfo(cmd *cobra.Command, args []string) error {
appCli, err := makeClient(cmd, args)
if err != nil {
return err
}
// retrieve flag values from cmd and fill params
params := management_rest_service.NewGetFileSystemInfoParams()
if dryRun {
logDebugf("dry-run flag specified. Skip sending request.")
return nil
}
// make request and then print result
msgStr, err := parseOperationManagementRestServiceGetFileSystemInfoResult(appCli.ManagementRestService.GetFileSystemInfo(params))
if err != nil {
return err
}
if !debug {
fmt.Println(msgStr)
}
return nil
}
// registerOperationManagementRestServiceGetFileSystemInfoParamFlags registers all flags needed to fill params
func registerOperationManagementRestServiceGetFileSystemInfoParamFlags(cmd *cobra.Command) error {
return nil
}
// parseOperationManagementRestServiceGetFileSystemInfoResult parses request result and return the string content
func parseOperationManagementRestServiceGetFileSystemInfoResult(resp0 *management_rest_service.GetFileSystemInfoOK, respErr error) (string, error) {
if respErr != nil {
var iResp0 interface{} = respErr
resp0, ok := iResp0.(*management_rest_service.GetFileSystemInfoOK)
if ok {
if !swag.IsZero(resp0) && !swag.IsZero(resp0.Payload) {
msgStr, err := json.Marshal(resp0.Payload)
if err != nil {
return "", err
}
return string(msgStr), nil
}
}
return "", respErr
}
if !swag.IsZero(resp0) && !swag.IsZero(resp0.Payload) {
msgStr, err := json.Marshal(resp0.Payload)
if err != nil {
return "", err
}
return string(msgStr), nil
}
return "", nil
}