Esempio n. 1
0
        /// <summary>
        ///
        /// </summary>
        /// <exception cref="Koudenpa.Mackerel.Api.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="hostId"></param>
        /// <param name="hostStatus"></param>
        /// <returns>Task of ApiResponse</returns>
        public async System.Threading.Tasks.Task <ApiResponse> PostHostStatusAsync(string hostId, HostStatusRequest hostStatus)
        {
            Koudenpa.Mackerel.Api.Client.ApiResponse <ApiResponse> localVarResponse = await PostHostStatusAsyncWithHttpInfo(hostId, hostStatus);

            return(localVarResponse.Data);
        }
Esempio n. 2
0
        /// <summary>
        ///
        /// </summary>
        /// <exception cref="Koudenpa.Mackerel.Api.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="hostId"></param>
        /// <param name="hostStatus"></param>
        /// <returns>Task of ApiResponse (ApiResponse)</returns>
        public async System.Threading.Tasks.Task <Koudenpa.Mackerel.Api.Client.ApiResponse <ApiResponse> > PostHostStatusAsyncWithHttpInfo(string hostId, HostStatusRequest hostStatus)
        {
            // verify the required parameter 'hostId' is set
            if (hostId == null)
            {
                throw new Koudenpa.Mackerel.Api.Client.ApiException(400, "Missing required parameter 'hostId' when calling HostApi->PostHostStatus");
            }

            // verify the required parameter 'hostStatus' is set
            if (hostStatus == null)
            {
                throw new Koudenpa.Mackerel.Api.Client.ApiException(400, "Missing required parameter 'hostStatus' when calling HostApi->PostHostStatus");
            }


            Koudenpa.Mackerel.Api.Client.RequestOptions localVarRequestOptions = new Koudenpa.Mackerel.Api.Client.RequestOptions();

            String[] _contentTypes = new String[] {
                "application/json"
            };

            // to determine the Accept header
            String[] _accepts = new String[] {
                "application/json"
            };

            foreach (var _contentType in _contentTypes)
            {
                localVarRequestOptions.HeaderParameters.Add("Content-Type", _contentType);
            }

            foreach (var _accept in _accepts)
            {
                localVarRequestOptions.HeaderParameters.Add("Accept", _accept);
            }

            if (hostId != null)
            {
                localVarRequestOptions.PathParameters.Add("hostId", Koudenpa.Mackerel.Api.Client.ClientUtils.ParameterToString(hostId)); // path parameter
            }
            localVarRequestOptions.Data = hostStatus;

            // authentication (apiKey) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Api-Key")))
            {
                localVarRequestOptions.HeaderParameters.Add("X-Api-Key", this.Configuration.GetApiKeyWithPrefix("X-Api-Key"));
            }

            // make the HTTP request

            var localVarResponse = await this.AsynchronousClient.PostAsync <ApiResponse>("/hosts/{hostId}/status", localVarRequestOptions, this.Configuration);

            if (this.ExceptionFactory != null)
            {
                Exception _exception = this.ExceptionFactory("PostHostStatus", localVarResponse);
                if (_exception != null)
                {
                    throw _exception;
                }
            }

            return(localVarResponse);
        }
Esempio n. 3
0
 /// <summary>
 ///
 /// </summary>
 /// <exception cref="Koudenpa.Mackerel.Api.Client.ApiException">Thrown when fails to make API call</exception>
 /// <param name="hostId"></param>
 /// <param name="hostStatus"></param>
 /// <returns>ApiResponse</returns>
 public ApiResponse PostHostStatus(string hostId, HostStatusRequest hostStatus)
 {
     Koudenpa.Mackerel.Api.Client.ApiResponse <ApiResponse> localVarResponse = PostHostStatusWithHttpInfo(hostId, hostStatus);
     return(localVarResponse.Data);
 }