Module: Elasticsearch::API::Fleet::Actions

Included in:
FleetClient
Defined in:
lib/elasticsearch/api/namespace/fleet.rb,
lib/elasticsearch/api/actions/fleet/search.rb,
lib/elasticsearch/api/actions/fleet/msearch.rb,
lib/elasticsearch/api/actions/fleet/get_secret.rb,
lib/elasticsearch/api/actions/fleet/post_secret.rb,
lib/elasticsearch/api/actions/fleet/delete_secret.rb,
lib/elasticsearch/api/actions/fleet/global_checkpoints.rb

Instance Method Summary collapse

Instance Method Details

#delete_secret(arguments = {}) ⇒ Object

Deletes a secret stored by Fleet. This functionality is Experimental and may be changed or removed completely in a future release. Elastic will take a best effort approach to fix any issues, but experimental features are not subject to the support SLA of official GA features.

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :id (String)

    The ID of the secret

  • :headers (Hash)

    Custom HTTP headers

Raises:

  • (ArgumentError)

See Also:

  • [TODO]


36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/elasticsearch/api/actions/fleet/delete_secret.rb', line 36

def delete_secret(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || 'fleet.delete_secret' }

  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   = "_fleet/secret/#{Utils.__listify(_id)}"
  params = {}

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

#get_secret(arguments = {}) ⇒ Object

Retrieves a secret stored by Fleet. This functionality is Experimental and may be changed or removed completely in a future release. Elastic will take a best effort approach to fix any issues, but experimental features are not subject to the support SLA of official GA features.

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :id (String)

    The ID of the secret

  • :headers (Hash)

    Custom HTTP headers

Raises:

  • (ArgumentError)

See Also:

  • [TODO]


36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/elasticsearch/api/actions/fleet/get_secret.rb', line 36

def get_secret(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || 'fleet.get_secret' }

  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_GET
  path   = "_fleet/secret/#{Utils.__listify(_id)}"
  params = {}

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

#global_checkpoints(arguments = {}) ⇒ Object

Returns the current global checkpoints for an index. This API is design for internal use by the fleet server project.

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :index (String)

    The name of the index.

  • :wait_for_advance (Boolean)

    Whether to wait for the global checkpoint to advance past the specified current checkpoints

  • :wait_for_index (Boolean)

    Whether to wait for the target index to exist and all primary shards be active

  • :checkpoints (List)

    Comma separated list of checkpoints

  • :timeout (Time)

    Timeout to wait for global checkpoint to advance

  • :headers (Hash)

    Custom HTTP headers

Raises:

  • (ArgumentError)

See Also:



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/elasticsearch/api/actions/fleet/global_checkpoints.rb', line 36

def global_checkpoints(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || 'fleet.global_checkpoints' }

  defined_params = [:index].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 'index' missing" unless arguments[:index]

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

  body   = nil

  _index = arguments.delete(:index)

  method = Elasticsearch::API::HTTP_GET
  path   = "#{Utils.__listify(_index)}/_fleet/global_checkpoints"
  params = Utils.process_params(arguments)

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

#msearch(arguments = {}) ⇒ Object

Multi Search API where the search will only be executed after specified checkpoints are available due to a refresh. This API is designed for internal use by the fleet server project. This functionality is Experimental and may be changed or removed completely in a future release. Elastic will take a best effort approach to fix any issues, but experimental features are not subject to the support SLA of official GA features.

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :index (String)

    The index name to use as the default

  • :headers (Hash)

    Custom HTTP headers

  • :body (Hash)

    The request definitions (metadata-fleet search request definition pairs), separated by newlines (Required)

Raises:

  • (ArgumentError)

See Also:

  • [TODO]


37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/elasticsearch/api/actions/fleet/msearch.rb', line 37

def msearch(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || 'fleet.msearch' }

  defined_params = [:index].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]

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

  body   = arguments.delete(:body)

  _index = arguments.delete(:index)

  method = Elasticsearch::API::HTTP_POST
  path   = if _index
             "#{Utils.__listify(_index)}/_fleet/_fleet_msearch"
           else
             '_fleet/_fleet_msearch'
           end
  params = {}

  if body.is_a?(Array) && body.any? { |d| d.has_key? :search }
    payload = body
              .each_with_object([]) do |item, sum|
                meta = item
                data = meta.delete(:search)

                sum << meta
                sum << data
              end
              .map { |item| Elasticsearch::API.serializer.dump(item) }
    payload << '' unless payload.empty?
    payload = payload.join("\n")
  elsif body.is_a?(Array)
    payload = body.map { |d| d.is_a?(String) ? d : Elasticsearch::API.serializer.dump(d) }
    payload << '' unless payload.empty?
    payload = payload.join("\n")
  else
    payload = body
  end

  headers.merge!('Content-Type' => 'application/x-ndjson')
  Elasticsearch::API::Response.new(
    perform_request(method, path, params, payload, headers, request_opts)
  )
end

#post_secret(arguments = {}) ⇒ Object

Creates a secret stored by Fleet. This functionality is Experimental and may be changed or removed completely in a future release. Elastic will take a best effort approach to fix any issues, but experimental features are not subject to the support SLA of official GA features.

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :headers (Hash)

    Custom HTTP headers

  • :body (Hash)

    The secret value to store (Required)

Raises:

  • (ArgumentError)

See Also:

  • [TODO]


36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/elasticsearch/api/actions/fleet/post_secret.rb', line 36

def post_secret(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || 'fleet.post_secret' }

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

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

  body   = arguments.delete(:body)

  method = Elasticsearch::API::HTTP_POST
  path   = '_fleet/secret'
  params = {}

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

#search(arguments = {}) ⇒ Object

Search API where the search will only be executed after specified checkpoints are available due to a refresh. This API is designed for internal use by the fleet server project. This functionality is Experimental and may be changed or removed completely in a future release. Elastic will take a best effort approach to fix any issues, but experimental features are not subject to the support SLA of official GA features.

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :index (String)

    The index name to search.

  • :wait_for_checkpoints (List)

    Comma separated list of checkpoints, one per shard

  • :wait_for_checkpoints_timeout (Time)

    Explicit wait_for_checkpoints timeout

  • :allow_partial_search_results (Boolean)

    Indicate if an error should be returned if there is a partial search failure or timeout

  • :headers (Hash)

    Custom HTTP headers

  • :body (Hash)

    The search definition using the Query DSL

Raises:

  • (ArgumentError)

See Also:

  • [TODO]


40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/elasticsearch/api/actions/fleet/search.rb', line 40

def search(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || 'fleet.search' }

  defined_params = [:index].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 'index' missing" unless arguments[:index]

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

  body = arguments.delete(:body)

  _index = arguments.delete(:index)

  method = if body
             Elasticsearch::API::HTTP_POST
           else
             Elasticsearch::API::HTTP_GET
           end

  path = "#{Utils.__listify(_index)}/_fleet/_fleet_search"
  params = Utils.process_params(arguments)

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