/
api_resource_quota.go
229 lines (196 loc) · 10.1 KB
/
api_resource_quota.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
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
/*
Arvancloud PaaS REST API
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
API version: v1.11
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package paas
import (
"bytes"
"context"
"io"
"net/http"
"net/url"
"strings"
)
// ResourceQuotaAPIService ResourceQuotaAPI service
type ResourceQuotaAPIService service
type ApiListNamespacedResourceQuotaRequest struct {
ctx context.Context
ApiService *ResourceQuotaAPIService
namespace string
pretty *string
labelSelector *string
fieldSelector *string
includeUninitialized *bool
watch *bool
resourceVersion *string
timeoutSeconds *int32
limit *int32
continue_ *string
}
// If 'true', then the output is pretty printed.
func (r ApiListNamespacedResourceQuotaRequest) Pretty(pretty string) ApiListNamespacedResourceQuotaRequest {
r.pretty = &pretty
return r
}
// A selector to restrict the list of returned objects by their labels. Defaults to everything.
func (r ApiListNamespacedResourceQuotaRequest) LabelSelector(labelSelector string) ApiListNamespacedResourceQuotaRequest {
r.labelSelector = &labelSelector
return r
}
// A selector to restrict the list of returned objects by their fields. Defaults to everything.
func (r ApiListNamespacedResourceQuotaRequest) FieldSelector(fieldSelector string) ApiListNamespacedResourceQuotaRequest {
r.fieldSelector = &fieldSelector
return r
}
// If true, partially initialized resources are included in the response.
func (r ApiListNamespacedResourceQuotaRequest) IncludeUninitialized(includeUninitialized bool) ApiListNamespacedResourceQuotaRequest {
r.includeUninitialized = &includeUninitialized
return r
}
// Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion.
func (r ApiListNamespacedResourceQuotaRequest) Watch(watch bool) ApiListNamespacedResourceQuotaRequest {
r.watch = &watch
return r
}
// When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history. When specified for list: - if unset, then the result is returned from remote storage based on quorum-read flag; - if it's 0, then we simply return what we currently have in cache, no guarantee; - if set to non zero, then the result is at least as fresh as given rv.
func (r ApiListNamespacedResourceQuotaRequest) ResourceVersion(resourceVersion string) ApiListNamespacedResourceQuotaRequest {
r.resourceVersion = &resourceVersion
return r
}
// Timeout for the list/watch call. This limits the duration of the call, regardless of any activity or inactivity.
func (r ApiListNamespacedResourceQuotaRequest) TimeoutSeconds(timeoutSeconds int32) ApiListNamespacedResourceQuotaRequest {
r.timeoutSeconds = &timeoutSeconds
return r
}
// limit is a maximum number of responses to return for a list call. If more items exist, the server will set the `continue` field on the list metadata to a value that can be used with the same initial query to retrieve the next set of results. Setting a limit may return fewer than the requested amount of items (up to zero items) in the event all requested objects are filtered out and clients should only use the presence of the continue field to determine whether more results are available. Servers may choose not to support the limit argument and will return all of the available results. If limit is specified and the continue field is empty, clients may assume that no more results are available. This field is not supported if watch is true. The server guarantees that the objects returned when using continue will be identical to issuing a single list call without a limit - that is, no objects created, modified, or deleted after the first request is issued will be included in any subsequent continued requests. This is sometimes referred to as a consistent snapshot, and ensures that a client that is using limit to receive smaller chunks of a very large result can ensure they see all possible objects. If objects are updated during a chunked list the version of the object that was present at the time the first list result was calculated is returned.
func (r ApiListNamespacedResourceQuotaRequest) Limit(limit int32) ApiListNamespacedResourceQuotaRequest {
r.limit = &limit
return r
}
// The continue option should be set when retrieving more results from the server. Since this value is server defined, clients may only use the continue value from a previous query result with identical query parameters (except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server the server will respond with a 410 ResourceExpired error indicating the client must restart their list without the continue field. This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications.
func (r ApiListNamespacedResourceQuotaRequest) Continue_(continue_ string) ApiListNamespacedResourceQuotaRequest {
r.continue_ = &continue_
return r
}
func (r ApiListNamespacedResourceQuotaRequest) Execute() (*V1ResourceQuotaList, *http.Response, error) {
return r.ApiService.ListNamespacedResourceQuotaExecute(r)
}
/*
ListNamespacedResourceQuota list or watch objects of kind ResourceQuota
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param namespace object name and auth scope, such as for teams and projects
@return ApiListNamespacedResourceQuotaRequest
*/
func (a *ResourceQuotaAPIService) ListNamespacedResourceQuota(ctx context.Context, namespace string) ApiListNamespacedResourceQuotaRequest {
return ApiListNamespacedResourceQuotaRequest{
ApiService: a,
ctx: ctx,
namespace: namespace,
}
}
// Execute executes the request
// @return V1ResourceQuotaList
func (a *ResourceQuotaAPIService) ListNamespacedResourceQuotaExecute(r ApiListNamespacedResourceQuotaRequest) (*V1ResourceQuotaList, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
formFiles []formFile
localVarReturnValue *V1ResourceQuotaList
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ResourceQuotaAPIService.ListNamespacedResourceQuota")
if err != nil {
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/api/v1/namespaces/{namespace}/resourcequotas"
localVarPath = strings.Replace(localVarPath, "{"+"namespace"+"}", url.PathEscape(parameterValueToString(r.namespace, "namespace")), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if r.pretty != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "")
}
if r.labelSelector != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "labelSelector", r.labelSelector, "")
}
if r.fieldSelector != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "fieldSelector", r.fieldSelector, "")
}
if r.includeUninitialized != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "includeUninitialized", r.includeUninitialized, "")
}
if r.watch != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "watch", r.watch, "")
}
if r.resourceVersion != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "resourceVersion", r.resourceVersion, "")
}
if r.timeoutSeconds != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "timeoutSeconds", r.timeoutSeconds, "")
}
if r.limit != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "")
}
if r.continue_ != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "continue", r.continue_, "")
}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}
// set Content-Type header
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHTTPHeaderAccepts := []string{"application/json", "application/yaml", "application/vnd.kubernetes.protobuf", "application/json;stream=watch", "application/vnd.kubernetes.protobuf;stream=watch"}
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
if r.ctx != nil {
// API Key Authentication
if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {
if apiKey, ok := auth["ApiKeyAuth"]; ok {
var key string
if apiKey.Prefix != "" {
key = apiKey.Prefix + " " + apiKey.Key
} else {
key = apiKey.Key
}
localVarHeaderParams["Authorization"] = key
}
}
}
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return localVarReturnValue, nil, err
}
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, localVarHTTPResponse, err
}
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarReturnValue, localVarHTTPResponse, err
}
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHTTPResponse.Status,
}
return localVarReturnValue, localVarHTTPResponse, newErr
}
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: err.Error(),
}
return localVarReturnValue, localVarHTTPResponse, newErr
}
return localVarReturnValue, localVarHTTPResponse, nil
}