Module: ElasticsearchServerless::API::Cluster::Actions

Defined in:
lib/elasticsearch-serverless/api/cluster/info.rb,
lib/elasticsearch-serverless/api/cluster/get_component_template.rb,
lib/elasticsearch-serverless/api/cluster/put_component_template.rb,
lib/elasticsearch-serverless/api/cluster/delete_component_template.rb,
lib/elasticsearch-serverless/api/cluster/exists_component_template.rb

Instance Method Summary collapse

Instance Method Details

#delete_component_template(arguments = {}) ⇒ Object

Deletes a component template

Options Hash (arguments):

  • :name (String, Array<String>)

    Comma-separated list or wildcard expression of component template names used to limit the request. (Required)

  • :master_timeout (Time)

    Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. Server default: 30s.

  • :timeout (Time)

    Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. Server default: 30s.

  • :headers (Hash)

    Custom HTTP headers

Raises:

  • (ArgumentError)

See Also:



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/elasticsearch-serverless/api/cluster/delete_component_template.rb', line 34

def delete_component_template(arguments = {})
  raise ArgumentError, "Required argument 'name' missing" unless arguments[:name]

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

  body = nil

  _name = arguments.delete(:name)

  method = ElasticsearchServerless::API::HTTP_DELETE
  path   = "_component_template/#{Utils.listify(_name)}"
  params = Utils.process_params(arguments)

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

#exists_component_template(arguments = {}) ⇒ Object Also known as: exists_component_template?

Returns information about whether a particular component template exist

Options Hash (arguments):

  • :name (String, Array<String>)

    Comma-separated list of component template names used to limit the request. Wildcard (*) expressions are supported. (Required)

  • :master_timeout (Time)

    Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. Server default: 30s.

  • :local (Boolean)

    If true, the request retrieves information from the local node only. Defaults to false, which means information is retrieved from the master node.

  • :headers (Hash)

    Custom HTTP headers

Raises:

  • (ArgumentError)

See Also:



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/elasticsearch-serverless/api/cluster/exists_component_template.rb', line 34

def exists_component_template(arguments = {})
  raise ArgumentError, "Required argument 'name' missing" unless arguments[:name]

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

  body = nil

  _name = arguments.delete(:name)

  method = ElasticsearchServerless::API::HTTP_HEAD
  path   = "_component_template/#{Utils.listify(_name)}"
  params = Utils.process_params(arguments)

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

#get_component_template(arguments = {}) ⇒ Object

Returns one or more component templates

Options Hash (arguments):

  • :name (String)

    Comma-separated list of component template names used to limit the request. Wildcard (+*+) expressions are supported.

  • :flat_settings (Boolean)

    If true, returns settings in flat format.

  • :include_defaults (Boolean)

    Return all default configurations for the component template (default: false)

  • :local (Boolean)

    If true, the request retrieves information from the local node only. If false, information is retrieved from the master node.

  • :master_timeout (Time)

    Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. Server default: 30s.

  • :headers (Hash)

    Custom HTTP headers

See Also:



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/elasticsearch-serverless/api/cluster/get_component_template.rb', line 36

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

  body = nil

  _name = arguments.delete(:name)

  method = ElasticsearchServerless::API::HTTP_GET
  path   = if _name
             "_component_template/#{Utils.listify(_name)}"
           else
             "_component_template"
           end
  params = Utils.process_params(arguments)

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

#info(arguments = {}) ⇒ Object

Returns different information about the cluster.

Options Hash (arguments):

  • :target (String, Array<String>)

    Limits the information returned to the specific target. Supports a comma-separated list, such as http,ingest. (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
# File 'lib/elasticsearch-serverless/api/cluster/info.rb', line 32

def info(arguments = {})
  raise ArgumentError, "Required argument 'target' missing" unless arguments[:target]

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

  body = nil

  _target = arguments.delete(:target)

  method = ElasticsearchServerless::API::HTTP_GET
  path   = "_info/#{Utils.listify(_target)}"
  params = {}

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

#put_component_template(arguments = {}) ⇒ Object

Creates or updates a component template

Options Hash (arguments):

  • :name (String)

    Name of the component template to create. Elasticsearch includes the following built-in component templates: logs-mappings; ‘logs-settings+; metrics-mappings; metrics-settings;synthetics-mapping; synthetics-settings. Elastic Agent uses these templates to configure backing indices for its data streams. If you use Elastic Agent and want to overwrite one of these templates, set the version for your replacement template higher than the current version. If you don’t use Elastic Agent and want to disable all built-in component and index templates, set stack.templates.enabled to false using the cluster update settings API. (Required)

  • :create (Boolean)

    If true, this request cannot replace or update existing component templates.

  • :master_timeout (Time)

    Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. Server default: 30s.

  • :headers (Hash)

    Custom HTTP headers

  • :body (Hash)

    request body

Raises:

  • (ArgumentError)

See Also:



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/elasticsearch-serverless/api/cluster/put_component_template.rb', line 35

def put_component_template(arguments = {})
  raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
  raise ArgumentError, "Required argument 'name' missing" unless arguments[:name]

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

  body = arguments.delete(:body)

  _name = arguments.delete(:name)

  method = ElasticsearchServerless::API::HTTP_PUT
  path   = "_component_template/#{Utils.listify(_name)}"
  params = Utils.process_params(arguments)

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