Settings:
export KUBERNETES_BRANCH="release-1.10"
export CLIENT_VERSION="0.1.0a1"
export PACKAGE_NAME="client"
961 lines
42 KiB
Go
961 lines
42 KiB
Go
/*
|
|
* Kubernetes
|
|
*
|
|
* No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
|
|
*
|
|
* API version: v1.10.0
|
|
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
|
|
*/
|
|
|
|
package client
|
|
|
|
import (
|
|
"io/ioutil"
|
|
"net/url"
|
|
"net/http"
|
|
"strings"
|
|
"golang.org/x/net/context"
|
|
"encoding/json"
|
|
"fmt"
|
|
)
|
|
|
|
// Linger please
|
|
var (
|
|
_ context.Context
|
|
)
|
|
|
|
type ApiregistrationV1beta1ApiService service
|
|
|
|
|
|
/* ApiregistrationV1beta1ApiService
|
|
create an APIService
|
|
* @param ctx context.Context for authentication, logging, tracing, etc.
|
|
@param body
|
|
@param optional (nil or map[string]interface{}) with one or more of:
|
|
@param "pretty" (string) If 'true', then the output is pretty printed.
|
|
@return V1beta1ApiService*/
|
|
func (a *ApiregistrationV1beta1ApiService) CreateAPIService(ctx context.Context, body V1beta1ApiService, localVarOptionals map[string]interface{}) (V1beta1ApiService, *http.Response, error) {
|
|
var (
|
|
localVarHttpMethod = strings.ToUpper("Post")
|
|
localVarPostBody interface{}
|
|
localVarFileName string
|
|
localVarFileBytes []byte
|
|
successPayload V1beta1ApiService
|
|
)
|
|
|
|
// create path and map variables
|
|
localVarPath := a.client.cfg.BasePath + "/apis/apiregistration.k8s.io/v1beta1/apiservices"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
if err := typeCheckParameter(localVarOptionals["pretty"], "string", "pretty"); err != nil {
|
|
return successPayload, nil, err
|
|
}
|
|
|
|
if localVarTempParam, localVarOk := localVarOptionals["pretty"].(string); localVarOk {
|
|
localVarQueryParams.Add("pretty", parameterToString(localVarTempParam, ""))
|
|
}
|
|
// 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",
|
|
}
|
|
|
|
// set Accept header
|
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
|
if localVarHttpHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
|
}
|
|
// body params
|
|
localVarPostBody = &body
|
|
if ctx != nil {
|
|
// API Key Authentication
|
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
|
var key string
|
|
if auth.Prefix != "" {
|
|
key = auth.Prefix + " " + auth.Key
|
|
} else {
|
|
key = auth.Key
|
|
}
|
|
localVarHeaderParams["authorization"] = key
|
|
}
|
|
}
|
|
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 {
|
|
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
|
return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
|
}
|
|
|
|
if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil {
|
|
return successPayload, localVarHttpResponse, err
|
|
}
|
|
|
|
|
|
return successPayload, localVarHttpResponse, err
|
|
}
|
|
|
|
/* ApiregistrationV1beta1ApiService
|
|
delete an APIService
|
|
* @param ctx context.Context for authentication, logging, tracing, etc.
|
|
@param name name of the APIService
|
|
@param body
|
|
@param optional (nil or map[string]interface{}) with one or more of:
|
|
@param "pretty" (string) If 'true', then the output is pretty printed.
|
|
@param "gracePeriodSeconds" (int32) The duration in seconds before the object should be deleted. Value must be non-negative integer. The value zero indicates delete immediately. If this value is nil, the default grace period for the specified type will be used. Defaults to a per object value if not specified. zero means delete immediately.
|
|
@param "orphanDependents" (bool) Deprecated: please use the PropagationPolicy, this field will be deprecated in 1.7. Should the dependent objects be orphaned. If true/false, the \"orphan\" finalizer will be added to/removed from the object's finalizers list. Either this field or PropagationPolicy may be set, but not both.
|
|
@param "propagationPolicy" (string) Whether and how garbage collection will be performed. Either this field or OrphanDependents may be set, but not both. The default policy is decided by the existing finalizer set in the metadata.finalizers and the resource-specific default policy. Acceptable values are: 'Orphan' - orphan the dependents; 'Background' - allow the garbage collector to delete the dependents in the background; 'Foreground' - a cascading policy that deletes all dependents in the foreground.
|
|
@return V1Status*/
|
|
func (a *ApiregistrationV1beta1ApiService) DeleteAPIService(ctx context.Context, name string, body V1DeleteOptions, localVarOptionals map[string]interface{}) (V1Status, *http.Response, error) {
|
|
var (
|
|
localVarHttpMethod = strings.ToUpper("Delete")
|
|
localVarPostBody interface{}
|
|
localVarFileName string
|
|
localVarFileBytes []byte
|
|
successPayload V1Status
|
|
)
|
|
|
|
// create path and map variables
|
|
localVarPath := a.client.cfg.BasePath + "/apis/apiregistration.k8s.io/v1beta1/apiservices/{name}"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"name"+"}", fmt.Sprintf("%v", name), -1)
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
if err := typeCheckParameter(localVarOptionals["pretty"], "string", "pretty"); err != nil {
|
|
return successPayload, nil, err
|
|
}
|
|
if err := typeCheckParameter(localVarOptionals["gracePeriodSeconds"], "int32", "gracePeriodSeconds"); err != nil {
|
|
return successPayload, nil, err
|
|
}
|
|
if err := typeCheckParameter(localVarOptionals["orphanDependents"], "bool", "orphanDependents"); err != nil {
|
|
return successPayload, nil, err
|
|
}
|
|
if err := typeCheckParameter(localVarOptionals["propagationPolicy"], "string", "propagationPolicy"); err != nil {
|
|
return successPayload, nil, err
|
|
}
|
|
|
|
if localVarTempParam, localVarOk := localVarOptionals["pretty"].(string); localVarOk {
|
|
localVarQueryParams.Add("pretty", parameterToString(localVarTempParam, ""))
|
|
}
|
|
if localVarTempParam, localVarOk := localVarOptionals["gracePeriodSeconds"].(int32); localVarOk {
|
|
localVarQueryParams.Add("gracePeriodSeconds", parameterToString(localVarTempParam, ""))
|
|
}
|
|
if localVarTempParam, localVarOk := localVarOptionals["orphanDependents"].(bool); localVarOk {
|
|
localVarQueryParams.Add("orphanDependents", parameterToString(localVarTempParam, ""))
|
|
}
|
|
if localVarTempParam, localVarOk := localVarOptionals["propagationPolicy"].(string); localVarOk {
|
|
localVarQueryParams.Add("propagationPolicy", parameterToString(localVarTempParam, ""))
|
|
}
|
|
// 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",
|
|
}
|
|
|
|
// set Accept header
|
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
|
if localVarHttpHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
|
}
|
|
// body params
|
|
localVarPostBody = &body
|
|
if ctx != nil {
|
|
// API Key Authentication
|
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
|
var key string
|
|
if auth.Prefix != "" {
|
|
key = auth.Prefix + " " + auth.Key
|
|
} else {
|
|
key = auth.Key
|
|
}
|
|
localVarHeaderParams["authorization"] = key
|
|
}
|
|
}
|
|
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 {
|
|
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
|
return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
|
}
|
|
|
|
if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil {
|
|
return successPayload, localVarHttpResponse, err
|
|
}
|
|
|
|
|
|
return successPayload, localVarHttpResponse, err
|
|
}
|
|
|
|
/* ApiregistrationV1beta1ApiService
|
|
delete collection of APIService
|
|
* @param ctx context.Context for authentication, logging, tracing, etc.
|
|
@param optional (nil or map[string]interface{}) with one or more of:
|
|
@param "pretty" (string) If 'true', then the output is pretty printed.
|
|
@param "continue_" (string) 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.
|
|
@param "fieldSelector" (string) A selector to restrict the list of returned objects by their fields. Defaults to everything.
|
|
@param "includeUninitialized" (bool) If true, partially initialized resources are included in the response.
|
|
@param "labelSelector" (string) A selector to restrict the list of returned objects by their labels. Defaults to everything.
|
|
@param "limit" (int32) 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.
|
|
@param "resourceVersion" (string) 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.
|
|
@param "timeoutSeconds" (int32) Timeout for the list/watch call. This limits the duration of the call, regardless of any activity or inactivity.
|
|
@param "watch" (bool) Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion.
|
|
@return V1Status*/
|
|
func (a *ApiregistrationV1beta1ApiService) DeleteCollectionAPIService(ctx context.Context, localVarOptionals map[string]interface{}) (V1Status, *http.Response, error) {
|
|
var (
|
|
localVarHttpMethod = strings.ToUpper("Delete")
|
|
localVarPostBody interface{}
|
|
localVarFileName string
|
|
localVarFileBytes []byte
|
|
successPayload V1Status
|
|
)
|
|
|
|
// create path and map variables
|
|
localVarPath := a.client.cfg.BasePath + "/apis/apiregistration.k8s.io/v1beta1/apiservices"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
if err := typeCheckParameter(localVarOptionals["pretty"], "string", "pretty"); err != nil {
|
|
return successPayload, nil, err
|
|
}
|
|
if err := typeCheckParameter(localVarOptionals["continue_"], "string", "continue_"); err != nil {
|
|
return successPayload, nil, err
|
|
}
|
|
if err := typeCheckParameter(localVarOptionals["fieldSelector"], "string", "fieldSelector"); err != nil {
|
|
return successPayload, nil, err
|
|
}
|
|
if err := typeCheckParameter(localVarOptionals["includeUninitialized"], "bool", "includeUninitialized"); err != nil {
|
|
return successPayload, nil, err
|
|
}
|
|
if err := typeCheckParameter(localVarOptionals["labelSelector"], "string", "labelSelector"); err != nil {
|
|
return successPayload, nil, err
|
|
}
|
|
if err := typeCheckParameter(localVarOptionals["limit"], "int32", "limit"); err != nil {
|
|
return successPayload, nil, err
|
|
}
|
|
if err := typeCheckParameter(localVarOptionals["resourceVersion"], "string", "resourceVersion"); err != nil {
|
|
return successPayload, nil, err
|
|
}
|
|
if err := typeCheckParameter(localVarOptionals["timeoutSeconds"], "int32", "timeoutSeconds"); err != nil {
|
|
return successPayload, nil, err
|
|
}
|
|
if err := typeCheckParameter(localVarOptionals["watch"], "bool", "watch"); err != nil {
|
|
return successPayload, nil, err
|
|
}
|
|
|
|
if localVarTempParam, localVarOk := localVarOptionals["pretty"].(string); localVarOk {
|
|
localVarQueryParams.Add("pretty", parameterToString(localVarTempParam, ""))
|
|
}
|
|
if localVarTempParam, localVarOk := localVarOptionals["continue_"].(string); localVarOk {
|
|
localVarQueryParams.Add("continue", parameterToString(localVarTempParam, ""))
|
|
}
|
|
if localVarTempParam, localVarOk := localVarOptionals["fieldSelector"].(string); localVarOk {
|
|
localVarQueryParams.Add("fieldSelector", parameterToString(localVarTempParam, ""))
|
|
}
|
|
if localVarTempParam, localVarOk := localVarOptionals["includeUninitialized"].(bool); localVarOk {
|
|
localVarQueryParams.Add("includeUninitialized", parameterToString(localVarTempParam, ""))
|
|
}
|
|
if localVarTempParam, localVarOk := localVarOptionals["labelSelector"].(string); localVarOk {
|
|
localVarQueryParams.Add("labelSelector", parameterToString(localVarTempParam, ""))
|
|
}
|
|
if localVarTempParam, localVarOk := localVarOptionals["limit"].(int32); localVarOk {
|
|
localVarQueryParams.Add("limit", parameterToString(localVarTempParam, ""))
|
|
}
|
|
if localVarTempParam, localVarOk := localVarOptionals["resourceVersion"].(string); localVarOk {
|
|
localVarQueryParams.Add("resourceVersion", parameterToString(localVarTempParam, ""))
|
|
}
|
|
if localVarTempParam, localVarOk := localVarOptionals["timeoutSeconds"].(int32); localVarOk {
|
|
localVarQueryParams.Add("timeoutSeconds", parameterToString(localVarTempParam, ""))
|
|
}
|
|
if localVarTempParam, localVarOk := localVarOptionals["watch"].(bool); localVarOk {
|
|
localVarQueryParams.Add("watch", parameterToString(localVarTempParam, ""))
|
|
}
|
|
// 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",
|
|
}
|
|
|
|
// set Accept header
|
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
|
if localVarHttpHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
|
}
|
|
if ctx != nil {
|
|
// API Key Authentication
|
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
|
var key string
|
|
if auth.Prefix != "" {
|
|
key = auth.Prefix + " " + auth.Key
|
|
} else {
|
|
key = auth.Key
|
|
}
|
|
localVarHeaderParams["authorization"] = key
|
|
}
|
|
}
|
|
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 {
|
|
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
|
return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
|
}
|
|
|
|
if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil {
|
|
return successPayload, localVarHttpResponse, err
|
|
}
|
|
|
|
|
|
return successPayload, localVarHttpResponse, err
|
|
}
|
|
|
|
/* ApiregistrationV1beta1ApiService
|
|
get available resources
|
|
* @param ctx context.Context for authentication, logging, tracing, etc.
|
|
@return V1ApiResourceList*/
|
|
func (a *ApiregistrationV1beta1ApiService) GetAPIResources(ctx context.Context) (V1ApiResourceList, *http.Response, error) {
|
|
var (
|
|
localVarHttpMethod = strings.ToUpper("Get")
|
|
localVarPostBody interface{}
|
|
localVarFileName string
|
|
localVarFileBytes []byte
|
|
successPayload V1ApiResourceList
|
|
)
|
|
|
|
// create path and map variables
|
|
localVarPath := a.client.cfg.BasePath + "/apis/apiregistration.k8s.io/v1beta1/"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
|
|
// to determine the Content-Type header
|
|
localVarHttpContentTypes := []string{ "application/json", "application/yaml", "application/vnd.kubernetes.protobuf", }
|
|
|
|
// 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",
|
|
}
|
|
|
|
// set Accept header
|
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
|
if localVarHttpHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
|
}
|
|
if ctx != nil {
|
|
// API Key Authentication
|
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
|
var key string
|
|
if auth.Prefix != "" {
|
|
key = auth.Prefix + " " + auth.Key
|
|
} else {
|
|
key = auth.Key
|
|
}
|
|
localVarHeaderParams["authorization"] = key
|
|
}
|
|
}
|
|
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 {
|
|
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
|
return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
|
}
|
|
|
|
if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil {
|
|
return successPayload, localVarHttpResponse, err
|
|
}
|
|
|
|
|
|
return successPayload, localVarHttpResponse, err
|
|
}
|
|
|
|
/* ApiregistrationV1beta1ApiService
|
|
list or watch objects of kind APIService
|
|
* @param ctx context.Context for authentication, logging, tracing, etc.
|
|
@param optional (nil or map[string]interface{}) with one or more of:
|
|
@param "pretty" (string) If 'true', then the output is pretty printed.
|
|
@param "continue_" (string) 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.
|
|
@param "fieldSelector" (string) A selector to restrict the list of returned objects by their fields. Defaults to everything.
|
|
@param "includeUninitialized" (bool) If true, partially initialized resources are included in the response.
|
|
@param "labelSelector" (string) A selector to restrict the list of returned objects by their labels. Defaults to everything.
|
|
@param "limit" (int32) 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.
|
|
@param "resourceVersion" (string) 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.
|
|
@param "timeoutSeconds" (int32) Timeout for the list/watch call. This limits the duration of the call, regardless of any activity or inactivity.
|
|
@param "watch" (bool) Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion.
|
|
@return V1beta1ApiServiceList*/
|
|
func (a *ApiregistrationV1beta1ApiService) ListAPIService(ctx context.Context, localVarOptionals map[string]interface{}) (V1beta1ApiServiceList, *http.Response, error) {
|
|
var (
|
|
localVarHttpMethod = strings.ToUpper("Get")
|
|
localVarPostBody interface{}
|
|
localVarFileName string
|
|
localVarFileBytes []byte
|
|
successPayload V1beta1ApiServiceList
|
|
)
|
|
|
|
// create path and map variables
|
|
localVarPath := a.client.cfg.BasePath + "/apis/apiregistration.k8s.io/v1beta1/apiservices"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
if err := typeCheckParameter(localVarOptionals["pretty"], "string", "pretty"); err != nil {
|
|
return successPayload, nil, err
|
|
}
|
|
if err := typeCheckParameter(localVarOptionals["continue_"], "string", "continue_"); err != nil {
|
|
return successPayload, nil, err
|
|
}
|
|
if err := typeCheckParameter(localVarOptionals["fieldSelector"], "string", "fieldSelector"); err != nil {
|
|
return successPayload, nil, err
|
|
}
|
|
if err := typeCheckParameter(localVarOptionals["includeUninitialized"], "bool", "includeUninitialized"); err != nil {
|
|
return successPayload, nil, err
|
|
}
|
|
if err := typeCheckParameter(localVarOptionals["labelSelector"], "string", "labelSelector"); err != nil {
|
|
return successPayload, nil, err
|
|
}
|
|
if err := typeCheckParameter(localVarOptionals["limit"], "int32", "limit"); err != nil {
|
|
return successPayload, nil, err
|
|
}
|
|
if err := typeCheckParameter(localVarOptionals["resourceVersion"], "string", "resourceVersion"); err != nil {
|
|
return successPayload, nil, err
|
|
}
|
|
if err := typeCheckParameter(localVarOptionals["timeoutSeconds"], "int32", "timeoutSeconds"); err != nil {
|
|
return successPayload, nil, err
|
|
}
|
|
if err := typeCheckParameter(localVarOptionals["watch"], "bool", "watch"); err != nil {
|
|
return successPayload, nil, err
|
|
}
|
|
|
|
if localVarTempParam, localVarOk := localVarOptionals["pretty"].(string); localVarOk {
|
|
localVarQueryParams.Add("pretty", parameterToString(localVarTempParam, ""))
|
|
}
|
|
if localVarTempParam, localVarOk := localVarOptionals["continue_"].(string); localVarOk {
|
|
localVarQueryParams.Add("continue", parameterToString(localVarTempParam, ""))
|
|
}
|
|
if localVarTempParam, localVarOk := localVarOptionals["fieldSelector"].(string); localVarOk {
|
|
localVarQueryParams.Add("fieldSelector", parameterToString(localVarTempParam, ""))
|
|
}
|
|
if localVarTempParam, localVarOk := localVarOptionals["includeUninitialized"].(bool); localVarOk {
|
|
localVarQueryParams.Add("includeUninitialized", parameterToString(localVarTempParam, ""))
|
|
}
|
|
if localVarTempParam, localVarOk := localVarOptionals["labelSelector"].(string); localVarOk {
|
|
localVarQueryParams.Add("labelSelector", parameterToString(localVarTempParam, ""))
|
|
}
|
|
if localVarTempParam, localVarOk := localVarOptionals["limit"].(int32); localVarOk {
|
|
localVarQueryParams.Add("limit", parameterToString(localVarTempParam, ""))
|
|
}
|
|
if localVarTempParam, localVarOk := localVarOptionals["resourceVersion"].(string); localVarOk {
|
|
localVarQueryParams.Add("resourceVersion", parameterToString(localVarTempParam, ""))
|
|
}
|
|
if localVarTempParam, localVarOk := localVarOptionals["timeoutSeconds"].(int32); localVarOk {
|
|
localVarQueryParams.Add("timeoutSeconds", parameterToString(localVarTempParam, ""))
|
|
}
|
|
if localVarTempParam, localVarOk := localVarOptionals["watch"].(bool); localVarOk {
|
|
localVarQueryParams.Add("watch", parameterToString(localVarTempParam, ""))
|
|
}
|
|
// 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 ctx != nil {
|
|
// API Key Authentication
|
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
|
var key string
|
|
if auth.Prefix != "" {
|
|
key = auth.Prefix + " " + auth.Key
|
|
} else {
|
|
key = auth.Key
|
|
}
|
|
localVarHeaderParams["authorization"] = key
|
|
}
|
|
}
|
|
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 {
|
|
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
|
return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
|
}
|
|
|
|
if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil {
|
|
return successPayload, localVarHttpResponse, err
|
|
}
|
|
|
|
|
|
return successPayload, localVarHttpResponse, err
|
|
}
|
|
|
|
/* ApiregistrationV1beta1ApiService
|
|
partially update the specified APIService
|
|
* @param ctx context.Context for authentication, logging, tracing, etc.
|
|
@param name name of the APIService
|
|
@param body
|
|
@param optional (nil or map[string]interface{}) with one or more of:
|
|
@param "pretty" (string) If 'true', then the output is pretty printed.
|
|
@return V1beta1ApiService*/
|
|
func (a *ApiregistrationV1beta1ApiService) PatchAPIService(ctx context.Context, name string, body interface{}, localVarOptionals map[string]interface{}) (V1beta1ApiService, *http.Response, error) {
|
|
var (
|
|
localVarHttpMethod = strings.ToUpper("Patch")
|
|
localVarPostBody interface{}
|
|
localVarFileName string
|
|
localVarFileBytes []byte
|
|
successPayload V1beta1ApiService
|
|
)
|
|
|
|
// create path and map variables
|
|
localVarPath := a.client.cfg.BasePath + "/apis/apiregistration.k8s.io/v1beta1/apiservices/{name}"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"name"+"}", fmt.Sprintf("%v", name), -1)
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
if err := typeCheckParameter(localVarOptionals["pretty"], "string", "pretty"); err != nil {
|
|
return successPayload, nil, err
|
|
}
|
|
|
|
if localVarTempParam, localVarOk := localVarOptionals["pretty"].(string); localVarOk {
|
|
localVarQueryParams.Add("pretty", parameterToString(localVarTempParam, ""))
|
|
}
|
|
// to determine the Content-Type header
|
|
localVarHttpContentTypes := []string{ "application/json-patch+json", "application/merge-patch+json", "application/strategic-merge-patch+json", }
|
|
|
|
// 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",
|
|
}
|
|
|
|
// set Accept header
|
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
|
if localVarHttpHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
|
}
|
|
// body params
|
|
localVarPostBody = &body
|
|
if ctx != nil {
|
|
// API Key Authentication
|
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
|
var key string
|
|
if auth.Prefix != "" {
|
|
key = auth.Prefix + " " + auth.Key
|
|
} else {
|
|
key = auth.Key
|
|
}
|
|
localVarHeaderParams["authorization"] = key
|
|
}
|
|
}
|
|
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 {
|
|
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
|
return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
|
}
|
|
|
|
if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil {
|
|
return successPayload, localVarHttpResponse, err
|
|
}
|
|
|
|
|
|
return successPayload, localVarHttpResponse, err
|
|
}
|
|
|
|
/* ApiregistrationV1beta1ApiService
|
|
read the specified APIService
|
|
* @param ctx context.Context for authentication, logging, tracing, etc.
|
|
@param name name of the APIService
|
|
@param optional (nil or map[string]interface{}) with one or more of:
|
|
@param "pretty" (string) If 'true', then the output is pretty printed.
|
|
@param "exact" (bool) Should the export be exact. Exact export maintains cluster-specific fields like 'Namespace'.
|
|
@param "export" (bool) Should this value be exported. Export strips fields that a user can not specify.
|
|
@return V1beta1ApiService*/
|
|
func (a *ApiregistrationV1beta1ApiService) ReadAPIService(ctx context.Context, name string, localVarOptionals map[string]interface{}) (V1beta1ApiService, *http.Response, error) {
|
|
var (
|
|
localVarHttpMethod = strings.ToUpper("Get")
|
|
localVarPostBody interface{}
|
|
localVarFileName string
|
|
localVarFileBytes []byte
|
|
successPayload V1beta1ApiService
|
|
)
|
|
|
|
// create path and map variables
|
|
localVarPath := a.client.cfg.BasePath + "/apis/apiregistration.k8s.io/v1beta1/apiservices/{name}"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"name"+"}", fmt.Sprintf("%v", name), -1)
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
if err := typeCheckParameter(localVarOptionals["pretty"], "string", "pretty"); err != nil {
|
|
return successPayload, nil, err
|
|
}
|
|
if err := typeCheckParameter(localVarOptionals["exact"], "bool", "exact"); err != nil {
|
|
return successPayload, nil, err
|
|
}
|
|
if err := typeCheckParameter(localVarOptionals["export"], "bool", "export"); err != nil {
|
|
return successPayload, nil, err
|
|
}
|
|
|
|
if localVarTempParam, localVarOk := localVarOptionals["pretty"].(string); localVarOk {
|
|
localVarQueryParams.Add("pretty", parameterToString(localVarTempParam, ""))
|
|
}
|
|
if localVarTempParam, localVarOk := localVarOptionals["exact"].(bool); localVarOk {
|
|
localVarQueryParams.Add("exact", parameterToString(localVarTempParam, ""))
|
|
}
|
|
if localVarTempParam, localVarOk := localVarOptionals["export"].(bool); localVarOk {
|
|
localVarQueryParams.Add("export", parameterToString(localVarTempParam, ""))
|
|
}
|
|
// 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",
|
|
}
|
|
|
|
// set Accept header
|
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
|
if localVarHttpHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
|
}
|
|
if ctx != nil {
|
|
// API Key Authentication
|
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
|
var key string
|
|
if auth.Prefix != "" {
|
|
key = auth.Prefix + " " + auth.Key
|
|
} else {
|
|
key = auth.Key
|
|
}
|
|
localVarHeaderParams["authorization"] = key
|
|
}
|
|
}
|
|
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 {
|
|
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
|
return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
|
}
|
|
|
|
if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil {
|
|
return successPayload, localVarHttpResponse, err
|
|
}
|
|
|
|
|
|
return successPayload, localVarHttpResponse, err
|
|
}
|
|
|
|
/* ApiregistrationV1beta1ApiService
|
|
replace the specified APIService
|
|
* @param ctx context.Context for authentication, logging, tracing, etc.
|
|
@param name name of the APIService
|
|
@param body
|
|
@param optional (nil or map[string]interface{}) with one or more of:
|
|
@param "pretty" (string) If 'true', then the output is pretty printed.
|
|
@return V1beta1ApiService*/
|
|
func (a *ApiregistrationV1beta1ApiService) ReplaceAPIService(ctx context.Context, name string, body V1beta1ApiService, localVarOptionals map[string]interface{}) (V1beta1ApiService, *http.Response, error) {
|
|
var (
|
|
localVarHttpMethod = strings.ToUpper("Put")
|
|
localVarPostBody interface{}
|
|
localVarFileName string
|
|
localVarFileBytes []byte
|
|
successPayload V1beta1ApiService
|
|
)
|
|
|
|
// create path and map variables
|
|
localVarPath := a.client.cfg.BasePath + "/apis/apiregistration.k8s.io/v1beta1/apiservices/{name}"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"name"+"}", fmt.Sprintf("%v", name), -1)
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
if err := typeCheckParameter(localVarOptionals["pretty"], "string", "pretty"); err != nil {
|
|
return successPayload, nil, err
|
|
}
|
|
|
|
if localVarTempParam, localVarOk := localVarOptionals["pretty"].(string); localVarOk {
|
|
localVarQueryParams.Add("pretty", parameterToString(localVarTempParam, ""))
|
|
}
|
|
// 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",
|
|
}
|
|
|
|
// set Accept header
|
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
|
if localVarHttpHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
|
}
|
|
// body params
|
|
localVarPostBody = &body
|
|
if ctx != nil {
|
|
// API Key Authentication
|
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
|
var key string
|
|
if auth.Prefix != "" {
|
|
key = auth.Prefix + " " + auth.Key
|
|
} else {
|
|
key = auth.Key
|
|
}
|
|
localVarHeaderParams["authorization"] = key
|
|
}
|
|
}
|
|
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 {
|
|
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
|
return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
|
}
|
|
|
|
if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil {
|
|
return successPayload, localVarHttpResponse, err
|
|
}
|
|
|
|
|
|
return successPayload, localVarHttpResponse, err
|
|
}
|
|
|
|
/* ApiregistrationV1beta1ApiService
|
|
replace status of the specified APIService
|
|
* @param ctx context.Context for authentication, logging, tracing, etc.
|
|
@param name name of the APIService
|
|
@param body
|
|
@param optional (nil or map[string]interface{}) with one or more of:
|
|
@param "pretty" (string) If 'true', then the output is pretty printed.
|
|
@return V1beta1ApiService*/
|
|
func (a *ApiregistrationV1beta1ApiService) ReplaceAPIServiceStatus(ctx context.Context, name string, body V1beta1ApiService, localVarOptionals map[string]interface{}) (V1beta1ApiService, *http.Response, error) {
|
|
var (
|
|
localVarHttpMethod = strings.ToUpper("Put")
|
|
localVarPostBody interface{}
|
|
localVarFileName string
|
|
localVarFileBytes []byte
|
|
successPayload V1beta1ApiService
|
|
)
|
|
|
|
// create path and map variables
|
|
localVarPath := a.client.cfg.BasePath + "/apis/apiregistration.k8s.io/v1beta1/apiservices/{name}/status"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"name"+"}", fmt.Sprintf("%v", name), -1)
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
if err := typeCheckParameter(localVarOptionals["pretty"], "string", "pretty"); err != nil {
|
|
return successPayload, nil, err
|
|
}
|
|
|
|
if localVarTempParam, localVarOk := localVarOptionals["pretty"].(string); localVarOk {
|
|
localVarQueryParams.Add("pretty", parameterToString(localVarTempParam, ""))
|
|
}
|
|
// 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",
|
|
}
|
|
|
|
// set Accept header
|
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
|
if localVarHttpHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
|
}
|
|
// body params
|
|
localVarPostBody = &body
|
|
if ctx != nil {
|
|
// API Key Authentication
|
|
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
|
var key string
|
|
if auth.Prefix != "" {
|
|
key = auth.Prefix + " " + auth.Key
|
|
} else {
|
|
key = auth.Key
|
|
}
|
|
localVarHeaderParams["authorization"] = key
|
|
}
|
|
}
|
|
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 {
|
|
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)
|
|
return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes)
|
|
}
|
|
|
|
if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil {
|
|
return successPayload, localVarHttpResponse, err
|
|
}
|
|
|
|
|
|
return successPayload, localVarHttpResponse, err
|
|
}
|
|
|