module Elasticsearch::API::SnapshotLifecycleManagement::Actions

Public Instance Methods

delete_lifecycle(arguments = {}) click to toggle source

Deletes an existing snapshot lifecycle policy.

@option arguments [String] :policy_id The id of the snapshot lifecycle policy to remove @option arguments [Hash] :headers Custom HTTP headers

@see www.elastic.co/guide/en/elasticsearch/reference/8.16/slm-api-delete-policy.html

# File lib/elasticsearch/api/actions/snapshot_lifecycle_management/delete_lifecycle.rb, line 32
def delete_lifecycle(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || 'slm.delete_lifecycle' }

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

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

  body = nil

  _policy_id = arguments.delete(:policy_id)

  method = Elasticsearch::API::HTTP_DELETE
  path   = "_slm/policy/#{Utils.__listify(_policy_id)}"
  params = {}

  Elasticsearch::API::Response.new(
    perform_request(method, path, params, body, headers, request_opts)
  )
end
execute_lifecycle(arguments = {}) click to toggle source

Immediately creates a snapshot according to the lifecycle policy, without waiting for the scheduled time.

@option arguments [String] :policy_id The id of the snapshot lifecycle policy to be executed @option arguments [Hash] :headers Custom HTTP headers

@see www.elastic.co/guide/en/elasticsearch/reference/8.16/slm-api-execute-lifecycle.html

# File lib/elasticsearch/api/actions/snapshot_lifecycle_management/execute_lifecycle.rb, line 32
def execute_lifecycle(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || 'slm.execute_lifecycle' }

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

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

  body = nil

  _policy_id = arguments.delete(:policy_id)

  method = Elasticsearch::API::HTTP_PUT
  path   = "_slm/policy/#{Utils.__listify(_policy_id)}/_execute"
  params = {}

  Elasticsearch::API::Response.new(
    perform_request(method, path, params, body, headers, request_opts)
  )
end
execute_retention(arguments = {}) click to toggle source

Deletes any snapshots that are expired according to the policy’s retention rules.

@option arguments [Hash] :headers Custom HTTP headers

@see www.elastic.co/guide/en/elasticsearch/reference/8.16/slm-api-execute-retention.html

# File lib/elasticsearch/api/actions/snapshot_lifecycle_management/execute_retention.rb, line 31
def execute_retention(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || 'slm.execute_retention' }

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

  body   = nil

  method = Elasticsearch::API::HTTP_POST
  path   = '_slm/_execute_retention'
  params = {}

  Elasticsearch::API::Response.new(
    perform_request(method, path, params, body, headers, request_opts)
  )
end
get_lifecycle(arguments = {}) click to toggle source

Retrieves one or more snapshot lifecycle policy definitions and information about the latest snapshot attempts.

@option arguments [List] :policy_id Comma-separated list of snapshot lifecycle policies to retrieve @option arguments [Hash] :headers Custom HTTP headers

@see www.elastic.co/guide/en/elasticsearch/reference/8.16/slm-api-get-policy.html

# File lib/elasticsearch/api/actions/snapshot_lifecycle_management/get_lifecycle.rb, line 32
def get_lifecycle(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || 'slm.get_lifecycle' }

  defined_params = [:policy_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

  _policy_id = arguments.delete(:policy_id)

  method = Elasticsearch::API::HTTP_GET
  path   = if _policy_id
             "_slm/policy/#{Utils.__listify(_policy_id)}"
           else
             '_slm/policy'
           end
  params = {}

  Elasticsearch::API::Response.new(
    perform_request(method, path, params, body, headers, request_opts)
  )
end
get_stats(arguments = {}) click to toggle source

Returns global and policy-level statistics about actions taken by snapshot lifecycle management.

@option arguments [Hash] :headers Custom HTTP headers

@see www.elastic.co/guide/en/elasticsearch/reference/8.16/slm-api-get-stats.html

# File lib/elasticsearch/api/actions/snapshot_lifecycle_management/get_stats.rb, line 31
def get_stats(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || 'slm.get_stats' }

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

  body   = nil

  method = Elasticsearch::API::HTTP_GET
  path   = '_slm/stats'
  params = {}

  Elasticsearch::API::Response.new(
    perform_request(method, path, params, body, headers, request_opts)
  )
end
get_status(arguments = {}) click to toggle source

Retrieves the status of snapshot lifecycle management (SLM).

@option arguments [Hash] :headers Custom HTTP headers

@see www.elastic.co/guide/en/elasticsearch/reference/8.16/slm-api-get-status.html

# File lib/elasticsearch/api/actions/snapshot_lifecycle_management/get_status.rb, line 31
def get_status(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || 'slm.get_status' }

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

  body   = nil

  method = Elasticsearch::API::HTTP_GET
  path   = '_slm/status'
  params = {}

  Elasticsearch::API::Response.new(
    perform_request(method, path, params, body, headers, request_opts)
  )
end
put_lifecycle(arguments = {}) click to toggle source

Creates or updates a snapshot lifecycle policy.

@option arguments [String] :policy_id The id of the snapshot lifecycle policy @option arguments [Hash] :headers Custom HTTP headers @option arguments [Hash] :body The snapshot lifecycle policy definition to register

@see www.elastic.co/guide/en/elasticsearch/reference/8.16/slm-api-put-policy.html

# File lib/elasticsearch/api/actions/snapshot_lifecycle_management/put_lifecycle.rb, line 33
def put_lifecycle(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || 'slm.put_lifecycle' }

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

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

  body = arguments.delete(:body)

  _policy_id = arguments.delete(:policy_id)

  method = Elasticsearch::API::HTTP_PUT
  path   = "_slm/policy/#{Utils.__listify(_policy_id)}"
  params = {}

  Elasticsearch::API::Response.new(
    perform_request(method, path, params, body, headers, request_opts)
  )
end
start(arguments = {}) click to toggle source

Turns on snapshot lifecycle management (SLM).

@option arguments [Time] :master_timeout Timeout for processing on master node @option arguments [Time] :timeout Timeout for acknowledgement of update from all nodes in cluster @option arguments [Hash] :headers Custom HTTP headers

@see www.elastic.co/guide/en/elasticsearch/reference/8.16/slm-api-start.html

# File lib/elasticsearch/api/actions/snapshot_lifecycle_management/start.rb, line 33
def start(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || 'slm.start' }

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

  body   = nil

  method = Elasticsearch::API::HTTP_POST
  path   = '_slm/start'
  params = Utils.process_params(arguments)

  Elasticsearch::API::Response.new(
    perform_request(method, path, params, body, headers, request_opts)
  )
end
stop(arguments = {}) click to toggle source

Turns off snapshot lifecycle management (SLM).

@option arguments [Time] :master_timeout Timeout for processing on master node @option arguments [Time] :timeout Timeout for acknowledgement of update from all nodes in cluster @option arguments [Hash] :headers Custom HTTP headers

@see www.elastic.co/guide/en/elasticsearch/reference/8.16/slm-api-stop.html

# File lib/elasticsearch/api/actions/snapshot_lifecycle_management/stop.rb, line 33
def stop(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || 'slm.stop' }

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

  body   = nil

  method = Elasticsearch::API::HTTP_POST
  path   = '_slm/stop'
  params = Utils.process_params(arguments)

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