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

Included in:
SnapshotLifecycleManagementClient
Defined in:
lib/elasticsearch/api/namespace/snapshot_lifecycle_management.rb,
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

Deletes an existing snapshot lifecycle policy.

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

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

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

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

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

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

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :headers (Hash)

    Custom HTTP headers

See Also:



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# 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 = {}) ⇒ Object

Retrieves one or more 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 (List)

    Comma-separated list of snapshot lifecycle policies to retrieve

  • :headers (Hash)

    Custom HTTP headers

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

Returns 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):

  • :headers (Hash)

    Custom HTTP headers

See Also:



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# 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 = {}) ⇒ Object

Retrieves the status of snapshot lifecycle management (SLM).

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :headers (Hash)

    Custom HTTP headers

See Also:



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# 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 = {}) ⇒ Object

Creates or updates a snapshot lifecycle policy.

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :policy_id (String)

    The id of the snapshot lifecycle policy

  • :headers (Hash)

    Custom HTTP headers

  • :body (Hash)

    The snapshot lifecycle policy definition to register

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

Turns on snapshot lifecycle management (SLM).

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :headers (Hash)

    Custom HTTP headers

See Also:



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/elasticsearch/api/actions/snapshot_lifecycle_management/start.rb', line 31

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 = {}

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

#stop(arguments = {}) ⇒ Object

Turns off snapshot lifecycle management (SLM).

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :headers (Hash)

    Custom HTTP headers

See Also:



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/elasticsearch/api/actions/snapshot_lifecycle_management/stop.rb', line 31

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 = {}

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