|
| 1 | +# Licensed to Elasticsearch B.V. under one or more contributor |
| 2 | +# license agreements. See the NOTICE file distributed with |
| 3 | +# this work for additional information regarding copyright |
| 4 | +# ownership. Elasticsearch B.V. licenses this file to you under |
| 5 | +# the Apache License, Version 2.0 (the "License"); you may |
| 6 | +# not use this file except in compliance with the License. |
| 7 | +# You may obtain a copy of the License at |
| 8 | +# |
| 9 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +# |
| 11 | +# Unless required by applicable law or agreed to in writing, |
| 12 | +# software distributed under the License is distributed on an |
| 13 | +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 14 | +# KIND, either express or implied. See the License for the |
| 15 | +# specific language governing permissions and limitations |
| 16 | +# under the License. |
| 17 | +# |
| 18 | +# This code was automatically generated from the Elasticsearch Specification |
| 19 | +# See https://github.com/elastic/elasticsearch-specification |
| 20 | +# See Elasticsearch::ES_SPECIFICATION_COMMIT for commit hash. |
| 21 | +module Elasticsearch |
| 22 | + module API |
| 23 | + module Cat |
| 24 | + module Actions |
| 25 | + # Get circuit breakers statistics.IMPORTANT: CAT APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. |
| 26 | + # |
| 27 | + # @option arguments [String, Array<String>] :circuit_breaker_patterns A comma-separated list of regular-expressions to filter the circuit breakers in the output |
| 28 | + # @option arguments [String, Array<String>] :h A comma-separated list of columns names to display. It supports simple wildcards. |
| 29 | + # @option arguments [String, Array<String>] :s List of columns that determine how the table should be sorted. |
| 30 | + # Sorting defaults to ascending and can be changed by setting `:asc` |
| 31 | + # or `:desc` as a suffix to the column name. |
| 32 | + # @option arguments [Boolean] :local If `true`, the request computes the list of selected nodes from the |
| 33 | + # local cluster state. If `false` the list of selected nodes are computed |
| 34 | + # from the cluster state of the master node. In both cases the coordinating |
| 35 | + # node will send requests for further information to each selected node. |
| 36 | + # @option arguments [Time] :master_timeout Period to wait for a connection to the master node. Server default: 30s. |
| 37 | + # @option arguments [String] :format Specifies the format to return the columnar data in, can be set to |
| 38 | + # `text`, `json`, `cbor`, `yaml`, or `smile`. Server default: text. |
| 39 | + # @option arguments [Boolean] :help When set to `true` will output available columns. This option |
| 40 | + # can't be combined with any other query string option. |
| 41 | + # @option arguments [Boolean] :v When set to `true` will enable verbose output. |
| 42 | + # @option arguments [String] :bytes Sets the units for columns that contain a byte-size value. |
| 43 | + # Note that byte-size value units work in terms of powers of 1024. For instance `1kb` means 1024 bytes, not 1000 bytes. |
| 44 | + # If omitted, byte-size values are rendered with a suffix such as `kb`, `mb`, or `gb`, chosen such that the numeric value of the column is as small as possible whilst still being at least `1.0`. |
| 45 | + # If given, byte-size values are rendered as an integer with no suffix, representing the value of the column in the chosen unit. |
| 46 | + # Values that are not an exact multiple of the chosen unit are rounded down. |
| 47 | + # @option arguments [String] :time Sets the units for columns that contain a time duration. |
| 48 | + # If omitted, time duration values are rendered with a suffix such as `ms`, `s`, `m` or `h`, chosen such that the numeric value of the column is as small as possible whilst still being at least `1.0`. |
| 49 | + # If given, time duration values are rendered as an integer with no suffix. |
| 50 | + # Values that are not an exact multiple of the chosen unit are rounded down. |
| 51 | + # @option arguments [Boolean] :error_trace When set to `true` Elasticsearch will include the full stack trace of errors |
| 52 | + # when they occur. |
| 53 | + # @option arguments [String, Array<String>] :filter_path Comma-separated list of filters in dot notation which reduce the response |
| 54 | + # returned by Elasticsearch. |
| 55 | + # @option arguments [Boolean] :human When set to `true` will return statistics in a format suitable for humans. |
| 56 | + # For example `"exists_time": "1h"` for humans and |
| 57 | + # `"exists_time_in_millis": 3600000` for computers. When disabled the human |
| 58 | + # readable values will be omitted. This makes sense for responses being consumed |
| 59 | + # only by machines. |
| 60 | + # @option arguments [Boolean] :pretty If set to `true` the returned JSON will be "pretty-formatted". Only use |
| 61 | + # this option for debugging only. |
| 62 | + # @option arguments [Hash] :headers Custom HTTP headers |
| 63 | + # |
| 64 | + # @see https://www.elastic.co/docs/api/doc/elasticsearch#TODO |
| 65 | + # |
| 66 | + def circuit_breaker(arguments = {}) |
| 67 | + request_opts = { endpoint: arguments[:endpoint] || 'cat.circuit_breaker' } |
| 68 | + |
| 69 | + defined_params = [:circuit_breaker_patterns].each_with_object({}) do |variable, set_variables| |
| 70 | + set_variables[variable] = arguments[variable] if arguments.key?(variable) |
| 71 | + end |
| 72 | + request_opts[:defined_params] = defined_params unless defined_params.empty? |
| 73 | + |
| 74 | + arguments = arguments.clone |
| 75 | + headers = arguments.delete(:headers) || {} |
| 76 | + |
| 77 | + body = nil |
| 78 | + |
| 79 | + _circuit_breaker_patterns = arguments.delete(:circuit_breaker_patterns) |
| 80 | + |
| 81 | + method = Elasticsearch::API::HTTP_GET |
| 82 | + path = if _circuit_breaker_patterns |
| 83 | + "_cat/circuit_breaker/#{Utils.listify(_circuit_breaker_patterns)}" |
| 84 | + else |
| 85 | + '_cat/circuit_breaker' |
| 86 | + end |
| 87 | + params = Utils.process_params(arguments) |
| 88 | + |
| 89 | + Elasticsearch::API::Response.new( |
| 90 | + perform_request(method, path, params, body, headers, request_opts) |
| 91 | + ) |
| 92 | + end |
| 93 | + end |
| 94 | + end |
| 95 | + end |
| 96 | +end |
0 commit comments