Module: ElasticsearchServerless::API::Logstash::Actions

Defined in:
lib/elasticsearch-serverless/api/logstash/get_pipeline.rb,
lib/elasticsearch-serverless/api/logstash/put_pipeline.rb,
lib/elasticsearch-serverless/api/logstash/delete_pipeline.rb

Instance Method Summary collapse

Instance Method Details

#delete_pipeline(arguments = {}) ⇒ Object

Deletes a pipeline used for Logstash Central Management.

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :id (String)

    Identifier for the pipeline. (Required)

  • :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
57
# File 'lib/elasticsearch-serverless/api/logstash/delete_pipeline.rb', line 32

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

  defined_params = [:id].inject({}) do |set_variables, variable|
    set_variables[variable] = arguments[variable] if arguments.key?(variable)
    set_variables
  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 = ElasticsearchServerless::API::HTTP_DELETE
  path   = "_logstash/pipeline/#{Utils.listify(_id)}"
  params = {}

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

#get_pipeline(arguments = {}) ⇒ Object

Retrieves pipelines used for Logstash Central Management.

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :id (String, Array)

    Comma-separated list of pipeline identifiers.

  • :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
59
# File 'lib/elasticsearch-serverless/api/logstash/get_pipeline.rb', line 32

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

  defined_params = [:id].inject({}) do |set_variables, variable|
    set_variables[variable] = arguments[variable] if arguments.key?(variable)
    set_variables
  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 = ElasticsearchServerless::API::HTTP_GET
  path   = if _id
             "_logstash/pipeline/#{Utils.listify(_id)}"
           else
             "_logstash/pipeline"
           end
  params = {}

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

#put_pipeline(arguments = {}) ⇒ Object

Creates or updates a pipeline used for Logstash Central Management.

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :id (String)

    Identifier for the pipeline. (Required)

  • :headers (Hash)

    Custom HTTP headers

  • :body (Hash)

    pipeline

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
59
# File 'lib/elasticsearch-serverless/api/logstash/put_pipeline.rb', line 33

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

  defined_params = [:id].inject({}) do |set_variables, variable|
    set_variables[variable] = arguments[variable] if arguments.key?(variable)
    set_variables
  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 = ElasticsearchServerless::API::HTTP_PUT
  path   = "_logstash/pipeline/#{Utils.listify(_id)}"
  params = {}

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