Module: ElasticsearchServerless::API::QueryRules::Actions

Defined in:
lib/elasticsearch-serverless/api/query_rules/test.rb,
lib/elasticsearch-serverless/api/query_rules/get_rule.rb,
lib/elasticsearch-serverless/api/query_rules/put_rule.rb,
lib/elasticsearch-serverless/api/query_rules/delete_rule.rb,
lib/elasticsearch-serverless/api/query_rules/get_ruleset.rb,
lib/elasticsearch-serverless/api/query_rules/put_ruleset.rb,
lib/elasticsearch-serverless/api/query_rules/list_rulesets.rb,
lib/elasticsearch-serverless/api/query_rules/delete_ruleset.rb

Instance Method Summary collapse

Instance Method Details

#delete_rule(arguments = {}) ⇒ Object

Deletes a query rule within a query ruleset.

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :ruleset_id (String)

    The unique identifier of the query ruleset containing the rule to delete (Required)

  • :rule_id (String)

    The unique identifier of the query rule within the specified ruleset to delete (Required)

  • :headers (Hash)

    Custom HTTP headers

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
60
61
# File 'lib/elasticsearch-serverless/api/query_rules/delete_rule.rb', line 33

def delete_rule(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || "query_rules.delete_rule" }

  defined_params = [:ruleset_id, :rule_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 'ruleset_id' missing" unless arguments[:ruleset_id]
  raise ArgumentError, "Required argument 'rule_id' missing" unless arguments[:rule_id]

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

  body = nil

  _ruleset_id = arguments.delete(:ruleset_id)

  _rule_id = arguments.delete(:rule_id)

  method = ElasticsearchServerless::API::HTTP_DELETE
  path   = "_query_rules/#{Utils.listify(_ruleset_id)}/_rule/#{Utils.listify(_rule_id)}"
  params = {}

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

#delete_ruleset(arguments = {}) ⇒ Object

Deletes a query ruleset.

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :ruleset_id (String)

    The unique identifier of the query ruleset to delete (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/query_rules/delete_ruleset.rb', line 32

def delete_ruleset(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || "query_rules.delete_ruleset" }

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

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

  body = nil

  _ruleset_id = arguments.delete(:ruleset_id)

  method = ElasticsearchServerless::API::HTTP_DELETE
  path   = "_query_rules/#{Utils.listify(_ruleset_id)}"
  params = {}

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

#get_rule(arguments = {}) ⇒ Object

Returns the details about a query rule within a query ruleset

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :ruleset_id (String)

    The unique identifier of the query ruleset containing the rule to retrieve (Required)

  • :rule_id (String)

    The unique identifier of the query rule within the specified ruleset to retrieve (Required)

  • :headers (Hash)

    Custom HTTP headers

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
60
61
# File 'lib/elasticsearch-serverless/api/query_rules/get_rule.rb', line 33

def get_rule(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || "query_rules.get_rule" }

  defined_params = [:ruleset_id, :rule_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 'ruleset_id' missing" unless arguments[:ruleset_id]
  raise ArgumentError, "Required argument 'rule_id' missing" unless arguments[:rule_id]

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

  body = nil

  _ruleset_id = arguments.delete(:ruleset_id)

  _rule_id = arguments.delete(:rule_id)

  method = ElasticsearchServerless::API::HTTP_GET
  path   = "_query_rules/#{Utils.listify(_ruleset_id)}/_rule/#{Utils.listify(_rule_id)}"
  params = {}

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

#get_ruleset(arguments = {}) ⇒ Object

Returns the details about a query ruleset

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :ruleset_id (String)

    The unique identifier of the query ruleset (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/query_rules/get_ruleset.rb', line 32

def get_ruleset(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || "query_rules.get_ruleset" }

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

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

  body = nil

  _ruleset_id = arguments.delete(:ruleset_id)

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

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

#list_rulesets(arguments = {}) ⇒ Object

Returns summarized information about existing query rulesets.

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :from (Integer)

    Starting offset (default: 0)

  • :size (Integer)

    specifies a max number of results to get

  • :headers (Hash)

    Custom HTTP headers

See Also:



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/elasticsearch-serverless/api/query_rules/list_rulesets.rb', line 33

def list_rulesets(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || "query_rules.list_rulesets" }

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

  body = nil

  method = ElasticsearchServerless::API::HTTP_GET
  path   = "_query_rules"
  params = Utils.process_params(arguments)

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

#put_rule(arguments = {}) ⇒ Object

Creates or updates a query rule within a query ruleset.

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :ruleset_id (String)

    The unique identifier of the query ruleset containing the rule to be created or updated (Required)

  • :rule_id (String)

    The unique identifier of the query rule within the specified ruleset to be created or updated (Required)

  • :headers (Hash)

    Custom HTTP headers

  • :body (Hash)

    request body

Raises:

  • (ArgumentError)

See Also:



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
60
61
62
63
# File 'lib/elasticsearch-serverless/api/query_rules/put_rule.rb', line 34

def put_rule(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || "query_rules.put_rule" }

  defined_params = [:ruleset_id, :rule_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 'ruleset_id' missing" unless arguments[:ruleset_id]
  raise ArgumentError, "Required argument 'rule_id' missing" unless arguments[:rule_id]

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

  body = arguments.delete(:body)

  _ruleset_id = arguments.delete(:ruleset_id)

  _rule_id = arguments.delete(:rule_id)

  method = ElasticsearchServerless::API::HTTP_PUT
  path   = "_query_rules/#{Utils.listify(_ruleset_id)}/_rule/#{Utils.listify(_rule_id)}"
  params = {}

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

#put_ruleset(arguments = {}) ⇒ Object

Creates or updates a query ruleset.

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :ruleset_id (String)

    The unique identifier of the query ruleset to be created or updated (Required)

  • :headers (Hash)

    Custom HTTP headers

  • :body (Hash)

    request body

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/query_rules/put_ruleset.rb', line 33

def put_ruleset(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || "query_rules.put_ruleset" }

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

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

  body = arguments.delete(:body)

  _ruleset_id = arguments.delete(:ruleset_id)

  method = ElasticsearchServerless::API::HTTP_PUT
  path   = "_query_rules/#{Utils.listify(_ruleset_id)}"
  params = {}

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

#test(arguments = {}) ⇒ Object

Creates or updates a query ruleset.

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :ruleset_id (String)

    The unique identifier of the query ruleset to be created or updated (Required)

  • :headers (Hash)

    Custom HTTP headers

  • :body (Hash)

    request body

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/query_rules/test.rb', line 33

def test(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || "query_rules.test" }

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

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

  body = arguments.delete(:body)

  _ruleset_id = arguments.delete(:ruleset_id)

  method = ElasticsearchServerless::API::HTTP_POST
  path   = "_query_rules/#{Utils.listify(_ruleset_id)}/_test"
  params = {}

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