Exemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <exception cref="Koudenpa.Mackerel.Api.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="hostId"></param>
        /// <returns>ApiResponse of HostResponse</returns>
        public Koudenpa.Mackerel.Api.Client.ApiResponse <HostResponse> GetHostWithHttpInfo(string hostId)
        {
            // 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->GetHost");
            }

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

            String[] _contentTypes = new String[] {
            };

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

            var localVarContentType = Koudenpa.Mackerel.Api.Client.ClientUtils.SelectHeaderContentType(_contentTypes);

            if (localVarContentType != null)
            {
                localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
            }

            var localVarAccept = Koudenpa.Mackerel.Api.Client.ClientUtils.SelectHeaderAccept(_accepts);

            if (localVarAccept != null)
            {
                localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
            }

            if (hostId != null)
            {
                localVarRequestOptions.PathParameters.Add("hostId", Koudenpa.Mackerel.Api.Client.ClientUtils.ParameterToString(hostId)); // path parameter
            }
            // 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 = this.Client.Get <HostResponse>("/hosts/{hostId}", localVarRequestOptions, this.Configuration);

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

            return(localVarResponse);
        }
        /// <summary>
        ///
        /// </summary>
        /// <exception cref="Koudenpa.Mackerel.Api.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="hostMetrics"></param>
        /// <returns>ApiResponse of ApiResponse</returns>
        public Koudenpa.Mackerel.Api.Client.ApiResponse <ApiResponse> PostHostMetricWithHttpInfo(List <HostMetricValue> hostMetrics)
        {
            // verify the required parameter 'hostMetrics' is set
            if (hostMetrics == null)
            {
                throw new Koudenpa.Mackerel.Api.Client.ApiException(400, "Missing required parameter 'hostMetrics' when calling HostMetricApi->PostHostMetric");
            }

            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"
            };

            var localVarContentType = Koudenpa.Mackerel.Api.Client.ClientUtils.SelectHeaderContentType(_contentTypes);

            if (localVarContentType != null)
            {
                localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
            }

            var localVarAccept = Koudenpa.Mackerel.Api.Client.ClientUtils.SelectHeaderAccept(_accepts);

            if (localVarAccept != null)
            {
                localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
            }

            localVarRequestOptions.Data = hostMetrics;

            // 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 = this.Client.Post <ApiResponse>("/tsdb", localVarRequestOptions, this.Configuration);

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

            return(localVarResponse);
        }
        /// <summary>
        ///
        /// </summary>
        /// <exception cref="Koudenpa.Mackerel.Api.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="hostMetrics"></param>
        /// <returns>Task of ApiResponse (ApiResponse)</returns>
        public async System.Threading.Tasks.Task <Koudenpa.Mackerel.Api.Client.ApiResponse <ApiResponse> > PostHostMetricAsyncWithHttpInfo(List <HostMetricValue> hostMetrics)
        {
            // verify the required parameter 'hostMetrics' is set
            if (hostMetrics == null)
            {
                throw new Koudenpa.Mackerel.Api.Client.ApiException(400, "Missing required parameter 'hostMetrics' when calling HostMetricApi->PostHostMetric");
            }


            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);
            }

            localVarRequestOptions.Data = hostMetrics;

            // 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>("/tsdb", localVarRequestOptions, this.Configuration);

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

            return(localVarResponse);
        }
        /// <summary>
        ///
        /// </summary>
        /// <exception cref="Koudenpa.Mackerel.Api.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="withClosed"> (optional)</param>
        /// <param name="nextId"> (optional)</param>
        /// <param name="limit"> (optional)</param>
        /// <returns>Task of ApiResponse (AlertsResponse)</returns>
        public async System.Threading.Tasks.Task <Koudenpa.Mackerel.Api.Client.ApiResponse <AlertsResponse> > GetAlertsAsyncWithHttpInfo(bool?withClosed = default(bool?), string nextId = default(string), decimal?limit = default(decimal?))
        {
            Koudenpa.Mackerel.Api.Client.RequestOptions localVarRequestOptions = new Koudenpa.Mackerel.Api.Client.RequestOptions();

            String[] _contentTypes = new String[] {
            };

            // 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 (withClosed != null)
            {
                foreach (var _kvp in Koudenpa.Mackerel.Api.Client.ClientUtils.ParameterToMultiMap("", "withClosed", withClosed))
                {
                    foreach (var _kvpValue in _kvp.Value)
                    {
                        localVarRequestOptions.QueryParameters.Add(_kvp.Key, _kvpValue);
                    }
                }
            }
            if (nextId != null)
            {
                foreach (var _kvp in Koudenpa.Mackerel.Api.Client.ClientUtils.ParameterToMultiMap("", "nextId", nextId))
                {
                    foreach (var _kvpValue in _kvp.Value)
                    {
                        localVarRequestOptions.QueryParameters.Add(_kvp.Key, _kvpValue);
                    }
                }
            }
            if (limit != null)
            {
                foreach (var _kvp in Koudenpa.Mackerel.Api.Client.ClientUtils.ParameterToMultiMap("", "limit", limit))
                {
                    foreach (var _kvpValue in _kvp.Value)
                    {
                        localVarRequestOptions.QueryParameters.Add(_kvp.Key, _kvpValue);
                    }
                }
            }

            // 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.GetAsync <AlertsResponse>("/alerts", localVarRequestOptions, this.Configuration);

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

            return(localVarResponse);
        }
Exemplo n.º 5
0
        /// <summary>
        ///
        /// </summary>
        /// <exception cref="Koudenpa.Mackerel.Api.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="service">optional サービス名。 (optional)</param>
        /// <param name="role">サービス内のロール名。複数指定可能(結果は各ロールに所属するホスト群の和集合となります)。serviceが指定されていない場合は無効です。 (optional)</param>
        /// <param name="name">optional ホスト名。 (optional)</param>
        /// <param name="status">optional ホストのステータスを絞り込む。複数指定可能。デフォルトは working と standbyです。 (optional)</param>
        /// <param name="customIdentifier">optional ホスト情報の登録やホスト情報の更新で登録したユーザー独自の識別子。 (optional)</param>
        /// <returns>Task of ApiResponse (HostsResponse)</returns>
        public async System.Threading.Tasks.Task <Koudenpa.Mackerel.Api.Client.ApiResponse <HostsResponse> > GetHostsAsyncWithHttpInfo(string service = default(string), string role = default(string), string name = default(string), string status = default(string), string customIdentifier = default(string))
        {
            Koudenpa.Mackerel.Api.Client.RequestOptions localVarRequestOptions = new Koudenpa.Mackerel.Api.Client.RequestOptions();

            String[] _contentTypes = new String[] {
            };

            // 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 (service != null)
            {
                foreach (var _kvp in Koudenpa.Mackerel.Api.Client.ClientUtils.ParameterToMultiMap("", "service", service))
                {
                    foreach (var _kvpValue in _kvp.Value)
                    {
                        localVarRequestOptions.QueryParameters.Add(_kvp.Key, _kvpValue);
                    }
                }
            }
            if (role != null)
            {
                foreach (var _kvp in Koudenpa.Mackerel.Api.Client.ClientUtils.ParameterToMultiMap("", "role", role))
                {
                    foreach (var _kvpValue in _kvp.Value)
                    {
                        localVarRequestOptions.QueryParameters.Add(_kvp.Key, _kvpValue);
                    }
                }
            }
            if (name != null)
            {
                foreach (var _kvp in Koudenpa.Mackerel.Api.Client.ClientUtils.ParameterToMultiMap("", "name", name))
                {
                    foreach (var _kvpValue in _kvp.Value)
                    {
                        localVarRequestOptions.QueryParameters.Add(_kvp.Key, _kvpValue);
                    }
                }
            }
            if (status != null)
            {
                foreach (var _kvp in Koudenpa.Mackerel.Api.Client.ClientUtils.ParameterToMultiMap("", "status", status))
                {
                    foreach (var _kvpValue in _kvp.Value)
                    {
                        localVarRequestOptions.QueryParameters.Add(_kvp.Key, _kvpValue);
                    }
                }
            }
            if (customIdentifier != null)
            {
                foreach (var _kvp in Koudenpa.Mackerel.Api.Client.ClientUtils.ParameterToMultiMap("", "customIdentifier", customIdentifier))
                {
                    foreach (var _kvpValue in _kvp.Value)
                    {
                        localVarRequestOptions.QueryParameters.Add(_kvp.Key, _kvpValue);
                    }
                }
            }

            // 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.GetAsync <HostsResponse>("/hosts", localVarRequestOptions, this.Configuration);

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

            return(localVarResponse);
        }