forked from vmware/go-vmware-nsxt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
error_resolver_api.go
203 lines (169 loc) · 6.88 KB
/
error_resolver_api.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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
/* Copyright © 2017 VMware, Inc. All Rights Reserved.
SPDX-License-Identifier: BSD-2-Clause
Generated by: https://github.com/swagger-api/swagger-codegen.git */
package nsxt
import (
"context"
"encoding/json"
"fmt"
"github.com/vmware/go-vmware-nsxt/errorresolver"
"net/http"
"net/url"
"strings"
)
// Linger please
var (
_ context.Context
)
type ErrorResolverApiService service
/* ErrorResolverApiService Fetches metadata about the given error_id
Returns some metadata about the given error_id. This includes information of whether there is a resolver present for the given error_id and its associated user input data
* @param ctx context.Context Authentication Context
@param errorId
@return errorresolver.ErrorResolverInfo*/
func (a *ErrorResolverApiService) GetErrorResolverInfo(ctx context.Context, errorId string) (errorresolver.ErrorResolverInfo, *http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Get")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
successPayload errorresolver.ErrorResolverInfo
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/error-resolver/{error_id}"
localVarPath = strings.Replace(localVarPath, "{"+"error_id"+"}", fmt.Sprintf("%v", errorId), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
// to determine the Content-Type header
localVarHttpContentTypes := []string{"application/json"}
// set Content-Type header
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{
"application/json",
}
// set Accept header
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
if err != nil {
return successPayload, nil, err
}
localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return successPayload, localVarHttpResponse, err
}
defer localVarHttpResponse.Body.Close()
if localVarHttpResponse.StatusCode >= 300 {
return successPayload, localVarHttpResponse, reportError(localVarHttpResponse.Status)
}
if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil {
return successPayload, localVarHttpResponse, err
}
return successPayload, localVarHttpResponse, err
}
/* ErrorResolverApiService Fetches a list of metadata for all the registered error resolvers
Returns a list of metadata for all the error resolvers registered.
* @param ctx context.Context Authentication Context
@return errorresolver.ErrorResolverInfoList*/
func (a *ErrorResolverApiService) ListErrorResolverInfo(ctx context.Context) (errorresolver.ErrorResolverInfoList, *http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Get")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
successPayload errorresolver.ErrorResolverInfoList
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/error-resolver"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
// to determine the Content-Type header
localVarHttpContentTypes := []string{"application/json"}
// set Content-Type header
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{
"application/json",
}
// set Accept header
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
if err != nil {
return successPayload, nil, err
}
localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return successPayload, localVarHttpResponse, err
}
defer localVarHttpResponse.Body.Close()
if localVarHttpResponse.StatusCode >= 300 {
return successPayload, localVarHttpResponse, reportError(localVarHttpResponse.Status)
}
if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil {
return successPayload, localVarHttpResponse, err
}
return successPayload, localVarHttpResponse, err
}
/* ErrorResolverApiService Resolves the error
Invokes the corresponding error resolver for the given error(s) present in the payload
* @param ctx context.Context Authentication Context
@param errorresolver.errorResolverMetadataList
@return */
func (a *ErrorResolverApiService) ResolveErrorResolveError(ctx context.Context, errorResolverMetadataList errorresolver.ErrorResolverMetadataList) (*http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Post")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/error-resolver?action=resolve_error"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
// to determine the Content-Type header
localVarHttpContentTypes := []string{"application/json"}
// set Content-Type header
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{
"application/json",
}
// set Accept header
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}
// body params
localVarPostBody = &errorResolverMetadataList
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
if err != nil {
return nil, err
}
localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return localVarHttpResponse, err
}
defer localVarHttpResponse.Body.Close()
if localVarHttpResponse.StatusCode >= 300 {
return localVarHttpResponse, reportError(localVarHttpResponse.Status)
}
return localVarHttpResponse, err
}