-
Notifications
You must be signed in to change notification settings - Fork 0
/
switchm_portcapacity.go
131 lines (113 loc) · 3.32 KB
/
switchm_portcapacity.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
120
121
122
123
124
125
126
127
128
129
130
131
package bigdog
// API Version: v9_1
import (
"context"
"errors"
"io"
"net/http"
"time"
)
type SwitchMPortCapacityService struct {
apiClient *VSZClient
}
func NewSwitchMPortCapacityService(c *VSZClient) *SwitchMPortCapacityService {
s := new(SwitchMPortCapacityService)
s.apiClient = c
return s
}
func (ss *SwitchMService) SwitchMPortCapacityService() *SwitchMPortCapacityService {
return NewSwitchMPortCapacityService(ss.apiClient)
}
// SwitchMPortCapacityCapacities
//
// Definition: portCapacity_capacities
type SwitchMPortCapacityCapacities struct {
// Capacity
// Port Speed Capacity
Capacity *string `json:"capacity,omitempty"`
}
func NewSwitchMPortCapacityCapacities() *SwitchMPortCapacityCapacities {
m := new(SwitchMPortCapacityCapacities)
return m
}
// SwitchMPortCapacityResult
//
// Definition: portCapacity_result
type SwitchMPortCapacityResult struct {
// Extra
// Extra field
Extra interface{} `json:"extra,omitempty"`
// FirstIndex
// The first data index for current reulst
FirstIndex *int `json:"firstIndex,omitempty"`
// HasMore
// Indicator of remaining data
HasMore *bool `json:"hasMore,omitempty"`
List []*SwitchMPortCapacityCapacities `json:"list,omitempty"`
// RawDataTotalCount
// Total Data Count
RawDataTotalCount *int `json:"rawDataTotalCount,omitempty"`
// TotalCount
// Total Data Count
TotalCount *int `json:"totalCount,omitempty"`
}
type SwitchMPortCapacityResultAPIResponse struct {
*RawAPIResponse
Data *SwitchMPortCapacityResult
}
func newSwitchMPortCapacityResultAPIResponse(src APISource, meta APIResponseMeta, body io.ReadCloser) APIResponse {
r := new(SwitchMPortCapacityResultAPIResponse)
r.RawAPIResponse = newRawAPIResponse(src, meta, body).(*RawAPIResponse)
return r
}
func (r *SwitchMPortCapacityResultAPIResponse) Hydrate() (interface{}, error) {
r.mu.Lock()
defer r.mu.Unlock()
if r.err != nil {
if errors.Is(r.err, ErrResponseHydrated) {
return r.Data, nil
}
return nil, r.err
}
data := new(SwitchMPortCapacityResult)
if err := r.doHydrate(data); err != nil {
return nil, err
}
r.Data = data
return r.Data, nil
}
func NewSwitchMPortCapacityResult() *SwitchMPortCapacityResult {
m := new(SwitchMPortCapacityResult)
return m
}
// FindPortCapacity
//
// Use this API command to Retrieve Switch Port Capacity List.
//
// Operation ID: findPortCapacity
// Operation path: /portCapacity
// Success code: 200 (OK)
//
// Required parameters:
// - model string
// - required
// - portIdentifier string
// - required
func (s *SwitchMPortCapacityService) FindPortCapacity(ctx context.Context, model string, portIdentifier string, mutators ...RequestMutator) (*SwitchMPortCapacityResultAPIResponse, error) {
var (
req *APIRequest
httpResp *http.Response
execDur time.Duration
resp APIResponse
err error
respFn = newSwitchMPortCapacityResultAPIResponse
)
req = apiRequestFromPool(APISourceVSZ, http.MethodGet, RouteSwitchMFindPortCapacity, true)
defer recycleAPIRequest(req)
req.Header.Set(headerKeyAccept, "*/*")
req.QueryParams.Set("model", model)
req.QueryParams.Set("portIdentifier", portIdentifier)
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.(*SwitchMPortCapacityResultAPIResponse), err
}