Settings:
export KUBERNETES_BRANCH="release-1.10"
export CLIENT_VERSION="0.1.0a1"
export PACKAGE_NAME="client"
106 lines
2.9 KiB
Go
106 lines
2.9 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"
|
|
)
|
|
|
|
// Linger please
|
|
var (
|
|
_ context.Context
|
|
)
|
|
|
|
type ApiregistrationApiService service
|
|
|
|
|
|
/* ApiregistrationApiService
|
|
get information of a group
|
|
* @param ctx context.Context for authentication, logging, tracing, etc.
|
|
@return V1ApiGroup*/
|
|
func (a *ApiregistrationApiService) GetAPIGroup(ctx context.Context) (V1ApiGroup, *http.Response, error) {
|
|
var (
|
|
localVarHttpMethod = strings.ToUpper("Get")
|
|
localVarPostBody interface{}
|
|
localVarFileName string
|
|
localVarFileBytes []byte
|
|
successPayload V1ApiGroup
|
|
)
|
|
|
|
// create path and map variables
|
|
localVarPath := a.client.cfg.BasePath + "/apis/apiregistration.k8s.io/"
|
|
|
|
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
|
|
}
|
|
|