示例#1
0
        /// <summary>
        ///  create a TokenReview
        /// </summary>
        /// <exception cref="Kubernetes.DotNet.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 V1TokenReview</returns>
        public async System.Threading.Tasks.Task <V1TokenReview> CreateTokenReviewAsync(V1TokenReview body, string pretty = null)
        {
            ApiResponse <V1TokenReview> localVarResponse = await CreateTokenReviewAsyncWithHttpInfo(body, pretty);

            return(localVarResponse.Data);
        }
示例#2
0
        /// <summary>
        ///  create a TokenReview
        /// </summary>
        /// <exception cref="Kubernetes.DotNet.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 (V1TokenReview)</returns>
        public async System.Threading.Tasks.Task <ApiResponse <V1TokenReview> > CreateTokenReviewAsyncWithHttpInfo(V1TokenReview body, string pretty = null)
        {
            // verify the required parameter 'body' is set
            if (body == null)
            {
                throw new ApiException(400, "Missing required parameter 'body' when calling Authentication_v1Api->CreateTokenReview");
            }

            var    localVarPath         = "/apis/authentication.k8s.io/v1/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);
            }

            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 <V1TokenReview>(localVarStatusCode,
                                                   localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
                                                   (V1TokenReview)Configuration.ApiClient.Deserialize(localVarResponse, typeof(V1TokenReview))));
        }
示例#3
0
        /// <summary>
        ///  create a TokenReview
        /// </summary>
        /// <exception cref="Kubernetes.DotNet.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>V1TokenReview</returns>
        public V1TokenReview CreateTokenReview(V1TokenReview body, string pretty = null)
        {
            ApiResponse <V1TokenReview> localVarResponse = CreateTokenReviewWithHttpInfo(body, pretty);

            return(localVarResponse.Data);
        }