Module: Elasticsearch::API::Logstash::Actions

Included in:
LogstashClient
Defined in:
lib/elasticsearch/api/namespace/logstash.rb,
lib/elasticsearch/api/actions/logstash/get_pipeline.rb,
lib/elasticsearch/api/actions/logstash/put_pipeline.rb,
lib/elasticsearch/api/actions/logstash/delete_pipeline.rb

Instance Method Summary collapse

Instance Method Details

#delete_pipeline(arguments = {}) ⇒ Object

Deletes Logstash Pipelines used by Central Management

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :id (String)

    The ID of the Pipeline

  • :headers (Hash)

    Custom HTTP headers

Raises:

  • (ArgumentError)

See Also:



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/elasticsearch/api/actions/logstash/delete_pipeline.rb', line 32

def delete_pipeline(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || 'logstash.delete_pipeline' }

  defined_params = [:id].each_with_object({}) do |variable, set_variables|
    set_variables[variable] = arguments[variable] if arguments.key?(variable)
  end
  request_opts[:defined_params] = defined_params unless defined_params.empty?

  raise ArgumentError, "Required argument 'id' missing" unless arguments[:id]

  arguments = arguments.clone
  headers = arguments.delete(:headers) || {}

  body = nil

  _id = arguments.delete(:id)

  method = Elasticsearch::API::HTTP_DELETE
  path   = "_logstash/pipeline/#{Utils.__listify(_id)}"
  params = {}

  Elasticsearch::API::Response.new(
    perform_request(method, path, params, body, headers, request_opts)
  )
end

#get_pipeline(arguments = {}) ⇒ Object

Retrieves Logstash Pipelines used by Central Management

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :id (String)

    A comma-separated list of Pipeline IDs

  • :headers (Hash)

    Custom HTTP headers

See Also:



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/elasticsearch/api/actions/logstash/get_pipeline.rb', line 32

def get_pipeline(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || 'logstash.get_pipeline' }

  defined_params = [:id].each_with_object({}) do |variable, set_variables|
    set_variables[variable] = arguments[variable] if arguments.key?(variable)
  end
  request_opts[:defined_params] = defined_params unless defined_params.empty?

  arguments = arguments.clone
  headers = arguments.delete(:headers) || {}

  body = nil

  _id = arguments.delete(:id)

  method = Elasticsearch::API::HTTP_GET
  path   = if _id
             "_logstash/pipeline/#{Utils.__listify(_id)}"
           else
             '_logstash/pipeline'
           end
  params = {}

  Elasticsearch::API::Response.new(
    perform_request(method, path, params, body, headers, request_opts)
  )
end

#put_pipeline(arguments = {}) ⇒ Object

Adds and updates Logstash Pipelines used for Central Management

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :id (String)

    The ID of the Pipeline

  • :headers (Hash)

    Custom HTTP headers

  • :body (Hash)

    The Pipeline to add or update (Required)

Raises:

  • (ArgumentError)

See Also:



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/elasticsearch/api/actions/logstash/put_pipeline.rb', line 33

def put_pipeline(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || 'logstash.put_pipeline' }

  defined_params = [:id].each_with_object({}) do |variable, set_variables|
    set_variables[variable] = arguments[variable] if arguments.key?(variable)
  end
  request_opts[:defined_params] = defined_params unless defined_params.empty?

  raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
  raise ArgumentError, "Required argument 'id' missing" unless arguments[:id]

  arguments = arguments.clone
  headers = arguments.delete(:headers) || {}

  body = arguments.delete(:body)

  _id = arguments.delete(:id)

  method = Elasticsearch::API::HTTP_PUT
  path   = "_logstash/pipeline/#{Utils.__listify(_id)}"
  params = {}

  Elasticsearch::API::Response.new(
    perform_request(method, path, params, body, headers, request_opts)
  )
end