Module: Elasticsearch::API::SnapshotLifecycleManagement::Actions

Defined in:
lib/elasticsearch/api/actions/snapshot_lifecycle_management/stop.rb,
lib/elasticsearch/api/actions/snapshot_lifecycle_management/start.rb,
lib/elasticsearch/api/actions/snapshot_lifecycle_management/get_stats.rb,
lib/elasticsearch/api/actions/snapshot_lifecycle_management/get_status.rb,
lib/elasticsearch/api/actions/snapshot_lifecycle_management/get_lifecycle.rb,
lib/elasticsearch/api/actions/snapshot_lifecycle_management/put_lifecycle.rb,
lib/elasticsearch/api/actions/snapshot_lifecycle_management/delete_lifecycle.rb,
lib/elasticsearch/api/actions/snapshot_lifecycle_management/execute_lifecycle.rb,
lib/elasticsearch/api/actions/snapshot_lifecycle_management/execute_retention.rb

Instance Method Summary collapse

Instance Method Details

#delete_lifecycle(arguments = {}) ⇒ Object

Delete a policy. Delete a snapshot lifecycle policy definition. This operation prevents any future snapshots from being taken but does not cancel in-progress snapshots or remove previously-taken snapshots.

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :policy_id (String)

    The id of the snapshot lifecycle policy to remove (Required)

  • :master_timeout (Time)

    The 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)

    The 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:



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
# File 'lib/elasticsearch/api/actions/snapshot_lifecycle_management/delete_lifecycle.rb', line 38

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 = Utils.process_params(arguments)

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

#execute_lifecycle(arguments = {}) ⇒ Object

Run a policy. Immediately create a snapshot according to the snapshot lifecycle policy without waiting for the scheduled time. The snapshot policy is normally applied according to its schedule, but you might want to manually run a policy before performing an upgrade or other maintenance.

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :policy_id (String)

    The id of the snapshot lifecycle policy to be executed (Required)

  • :master_timeout (Time)

    The 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)

    The 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:



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
# File 'lib/elasticsearch/api/actions/snapshot_lifecycle_management/execute_lifecycle.rb', line 38

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 = Utils.process_params(arguments)

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

#execute_retention(arguments = {}) ⇒ Object

Run a retention policy. Manually apply the retention policy to force immediate removal of snapshots that are expired according to the snapshot lifecycle policy retention rules. The retention policy is normally applied according to its schedule.

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :master_timeout (Time)

    The 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)

    The 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

See Also:



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

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 = Utils.process_params(arguments)

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

#get_lifecycle(arguments = {}) ⇒ Object

Get policy information. Get snapshot lifecycle policy definitions and information about the latest snapshot attempts.

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :policy_id (String, Array<String>)

    Comma-separated list of snapshot lifecycle policies to retrieve

  • :master_timeout (Time)

    The 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)

    The 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

See Also:



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/api/actions/snapshot_lifecycle_management/get_lifecycle.rb', line 37

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 = Utils.process_params(arguments)

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

#get_stats(arguments = {}) ⇒ Object

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

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :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

See Also:



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/elasticsearch/api/actions/snapshot_lifecycle_management/get_stats.rb', line 34

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 = Utils.process_params(arguments)

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

#get_status(arguments = {}) ⇒ Object

Get the snapshot lifecycle management status.

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :master_timeout (Time)

    The 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. To indicate that the request should never timeout, set it to -1. Server default: 30s.

  • :timeout (Time)

    The period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. To indicate that the request should never timeout, set it to -1. Server default: 30s.

  • :headers (Hash)

    Custom HTTP headers

See Also:



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

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 = Utils.process_params(arguments)

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

#put_lifecycle(arguments = {}) ⇒ Object

Create or update a policy. Create or update a snapshot lifecycle policy. If the policy already exists, this request increments the policy version. Only the latest version of a policy is stored.

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :policy_id (String)

    The identifier for the snapshot lifecycle policy you want to create or update. (Required)

  • :master_timeout (Time)

    The 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. To indicate that the request should never timeout, set it to -1. Server default: 30s.

  • :timeout (Time)

    The period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. To indicate that the request should never timeout, set it to -1. Server default: 30s.

  • :headers (Hash)

    Custom HTTP headers

  • :body (Hash)

    request body

Raises:

  • (ArgumentError)

See Also:



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
# File 'lib/elasticsearch/api/actions/snapshot_lifecycle_management/put_lifecycle.rb', line 42

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 = Utils.process_params(arguments)

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

#start(arguments = {}) ⇒ Object

Start snapshot lifecycle management. Snapshot lifecycle management (SLM) starts automatically when a cluster is formed. Manually starting SLM is necessary only if it has been stopped using the stop SLM API.

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :master_timeout (Time)

    The 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. To indicate that the request should never timeout, set it to -1. Server default: 30s.

  • :timeout (Time)

    The period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. To indicate that the request should never timeout, set it to -1. Server default: 30s.

  • :headers (Hash)

    Custom HTTP headers

See Also:



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/elasticsearch/api/actions/snapshot_lifecycle_management/start.rb', line 39

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 = {}) ⇒ Object

Stop snapshot lifecycle management. Stop all snapshot lifecycle management (SLM) operations and the SLM plugin. This API is useful when you are performing maintenance on a cluster and need to prevent SLM from performing any actions on your data streams or indices. Stopping SLM does not stop any snapshots that are in progress. You can manually trigger snapshots with the run snapshot lifecycle policy API even if SLM is stopped. The API returns a response as soon as the request is acknowledged, but the plugin might continue to run until in-progress operations complete and it can be safely stopped. Use the get snapshot lifecycle management status API to see if SLM is running.

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :master_timeout (Time)

    The 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. To indicate that the request should never timeout, set it to -1. Server default: 30s.

  • :timeout (Time)

    The period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. To indicate that the request should never timeout, set it to -1. Server default: 30s.

  • :headers (Hash)

    Custom HTTP headers

See Also:



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/elasticsearch/api/actions/snapshot_lifecycle_management/stop.rb', line 43

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