Ejemplo n.º 1
0
        /// <summary>
        ///  create a TokenReview
        /// </summary>
        /// <exception cref="io.kubernetes.csharp.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="body"></param>
        /// <param name="pretty">If &#39;true&#39;, then the output is pretty printed. (optional)</param>
        /// <returns>Task of V1beta1TokenReview</returns>
        public async System.Threading.Tasks.Task <V1beta1TokenReview> CreateTokenReviewAsync(V1beta1TokenReview body, string pretty = null)
        {
            ApiResponse <V1beta1TokenReview> localVarResponse = await CreateTokenReviewAsyncWithHttpInfo(body, pretty);

            return(localVarResponse.Data);
        }
Ejemplo n.º 2
0
        /// <summary>
        ///  create a TokenReview
        /// </summary>
        /// <exception cref="io.kubernetes.csharp.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="body"></param>
        /// <param name="pretty">If &#39;true&#39;, then the output is pretty printed. (optional)</param>
        /// <returns>Task of ApiResponse (V1beta1TokenReview)</returns>
        public async System.Threading.Tasks.Task <ApiResponse <V1beta1TokenReview> > CreateTokenReviewAsyncWithHttpInfo(V1beta1TokenReview body, string pretty = null)
        {
            // verify the required parameter 'body' is set
            if (body == null)
            {
                throw new ApiException(400, "Missing required parameter 'body' when calling AuthenticationV1beta1Api->CreateTokenReview");
            }

            var    localVarPath         = "/apis/authentication.k8s.io/v1beta1/tokenreviews";
            var    localVarPathParams   = new Dictionary <String, String>();
            var    localVarQueryParams  = new Dictionary <String, String>();
            var    localVarHeaderParams = new Dictionary <String, String>(Configuration.DefaultHeader);
            var    localVarFormParams   = new Dictionary <String, String>();
            var    localVarFileParams   = new Dictionary <String, FileParameter>();
            Object localVarPostBody     = null;

            // to determine the Content-Type header
            String[] localVarHttpContentTypes = new String[] {
                "*/*"
            };
            String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

            // to determine the Accept header
            String[] localVarHttpHeaderAccepts = new String[] {
                "application/json",
                "application/yaml",
                "application/vnd.kubernetes.protobuf"
            };
            String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);

            if (localVarHttpHeaderAccept != null)
            {
                localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
            }

            // set "format" to json by default
            // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
            localVarPathParams.Add("format", "json");
            if (pretty != null)
            {
                localVarQueryParams.Add("pretty", Configuration.ApiClient.ParameterToString(pretty));                 // query parameter
            }
            if (body != null && body.GetType() != typeof(byte[]))
            {
                localVarPostBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter
            }
            else
            {
                localVarPostBody = body; // byte array
            }

            // authentication (BearerToken) required
            if (!String.IsNullOrEmpty(Configuration.GetApiKeyWithPrefix("authorization")))
            {
                localVarHeaderParams["authorization"] = Configuration.GetApiKeyWithPrefix("authorization");
            }

            // make the HTTP request
            IRestResponse localVarResponse = (IRestResponse)await Configuration.ApiClient.CallApiAsync(localVarPath,
                                                                                                       Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
                                                                                                       localVarPathParams, localVarHttpContentType);

            int localVarStatusCode = (int)localVarResponse.StatusCode;

            if (ExceptionFactory != null)
            {
                Exception exception = ExceptionFactory("CreateTokenReview", localVarResponse);
                if (exception != null)
                {
                    throw exception;
                }
            }

            return(new ApiResponse <V1beta1TokenReview>(localVarStatusCode,
                                                        localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
                                                        (V1beta1TokenReview)Configuration.ApiClient.Deserialize(localVarResponse, typeof(V1beta1TokenReview))));
        }
Ejemplo n.º 3
0
        /// <summary>
        ///  create a TokenReview
        /// </summary>
        /// <exception cref="io.kubernetes.csharp.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="body"></param>
        /// <param name="pretty">If &#39;true&#39;, then the output is pretty printed. (optional)</param>
        /// <returns>V1beta1TokenReview</returns>
        public V1beta1TokenReview CreateTokenReview(V1beta1TokenReview body, string pretty = null)
        {
            ApiResponse <V1beta1TokenReview> localVarResponse = CreateTokenReviewWithHttpInfo(body, pretty);

            return(localVarResponse.Data);
        }