-
Notifications
You must be signed in to change notification settings - Fork 0
/
switchm_ports.go
119 lines (108 loc) · 4 KB
/
switchm_ports.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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
package bigdog
// API Version: v9_1
import (
"context"
"encoding/json"
"net/http"
"net/url"
"time"
)
type SwitchMPortsService struct {
apiClient *VSZClient
}
func NewSwitchMPortsService(c *VSZClient) *SwitchMPortsService {
s := new(SwitchMPortsService)
s.apiClient = c
return s
}
func (ss *SwitchMService) SwitchMPortsService() *SwitchMPortsService {
return NewSwitchMPortsService(ss.apiClient)
}
// AddSwitchPortsDetails
//
// Use this API command to retrieve all the switch ports and its details currently managed by SmartZone.
//
// Operation ID: addSwitchPortsDetails
// Operation path: /switch/ports/details
// Success code: 200 (OK)
//
// Request body:
// - body *SwitchMCommonQueryCriteriaSuperSet
func (s *SwitchMPortsService) AddSwitchPortsDetails(ctx context.Context, body *SwitchMCommonQueryCriteriaSuperSet, mutators ...RequestMutator) (*SwitchMSwitchPortDetailsQueryResultListAPIResponse, error) {
var (
req *APIRequest
httpResp *http.Response
execDur time.Duration
resp APIResponse
err error
respFn = newSwitchMSwitchPortDetailsQueryResultListAPIResponse
)
req = apiRequestFromPool(APISourceVSZ, http.MethodPost, RouteSwitchMAddSwitchPortsDetails, true)
defer recycleAPIRequest(req)
req.Header.Set(headerKeyContentType, headerValueApplicationJSON)
req.Header.Set(headerKeyAccept, "*/*")
req.SetBody(body)
httpResp, execDur, err = s.apiClient.Do(ctx, req, mutators...)
resp, err = handleAPIResponse(req, http.StatusOK, httpResp, execDur, respFn, s.apiClient.autoHydrate, s.apiClient.ev, err)
return resp.(*SwitchMSwitchPortDetailsQueryResultListAPIResponse), err
}
// AddSwitchPortsDetailsExport
//
// Download CSV of Switch Port Details
//
// Operation ID: addSwitchPortsDetailsExport
// Operation path: /switch/ports/details/export
// Success code: 200 (OK)
//
// Request body:
// - body *SwitchMCommonQueryCriteriaSuperSet
func (s *SwitchMPortsService) AddSwitchPortsDetailsExport(ctx context.Context, body *SwitchMCommonQueryCriteriaSuperSet, mutators ...RequestMutator) (*FileAPIResponse, error) {
var (
req *APIRequest
httpResp *http.Response
execDur time.Duration
resp APIResponse
err error
respFn = newFileAPIResponse
)
req = apiRequestFromPool(APISourceVSZ, http.MethodPost, RouteSwitchMAddSwitchPortsDetailsExport, true)
defer recycleAPIRequest(req)
req.Header.Set(headerKeyContentType, "application/x-www-form-urlencoded")
req.Header.Set(headerKeyAccept, "*/*")
if b, err := json.Marshal(body); err != nil {
return resp.(*FileAPIResponse), err
} else {
req.SetBody(url.Values{"json": []string{string(b)}})
}
httpResp, execDur, err = s.apiClient.Do(ctx, req, mutators...)
resp, err = handleAPIResponse(req, http.StatusOK, httpResp, execDur, respFn, s.apiClient.autoHydrate, s.apiClient.ev, err)
return resp.(*FileAPIResponse), err
}
// AddSwitchPortsSummary
//
// Use this API command to retrieve ports summary based on status, speed of a switch, currently managed by SmartZone.
//
// Operation ID: addSwitchPortsSummary
// Operation path: /switch/ports/summary
// Success code: 200 (OK)
//
// Request body:
// - body *SwitchMCommonQueryCriteriaSuperSet
func (s *SwitchMPortsService) AddSwitchPortsSummary(ctx context.Context, body *SwitchMCommonQueryCriteriaSuperSet, mutators ...RequestMutator) (*SwitchMSwitchPortsSummaryQueryResultListAPIResponse, error) {
var (
req *APIRequest
httpResp *http.Response
execDur time.Duration
resp APIResponse
err error
respFn = newSwitchMSwitchPortsSummaryQueryResultListAPIResponse
)
req = apiRequestFromPool(APISourceVSZ, http.MethodPost, RouteSwitchMAddSwitchPortsSummary, true)
defer recycleAPIRequest(req)
req.Header.Set(headerKeyContentType, headerValueApplicationJSON)
req.Header.Set(headerKeyAccept, "*/*")
req.SetBody(body)
httpResp, execDur, err = s.apiClient.Do(ctx, req, mutators...)
resp, err = handleAPIResponse(req, http.StatusOK, httpResp, execDur, respFn, s.apiClient.autoHydrate, s.apiClient.ev, err)
return resp.(*SwitchMSwitchPortsSummaryQueryResultListAPIResponse), err
}