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

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

Defined Under Namespace

Modules: ParamsRegistry

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:



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

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

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

  arguments = arguments.clone

  _policy_id = arguments.delete(:policy_id)

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

  body = nil
  perform_request(method, path, params, body, headers).body
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:



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

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

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

  arguments = arguments.clone

  _policy_id = arguments.delete(:policy_id)

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

  body = nil
  perform_request(method, path, params, body, headers).body
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:



29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/elasticsearch/xpack/api/actions/snapshot_lifecycle_management/execute_retention.rb', line 29

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

  arguments = arguments.clone

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

  body = nil
  perform_request(method, path, params, body, headers).body
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:



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

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

  arguments = arguments.clone

  _policy_id = arguments.delete(:policy_id)

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

  body = nil
  perform_request(method, path, params, body, headers).body
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:



29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/elasticsearch/xpack/api/actions/snapshot_lifecycle_management/get_stats.rb', line 29

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

  arguments = arguments.clone

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

  body = nil
  perform_request(method, path, params, body, headers).body
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:



29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/elasticsearch/xpack/api/actions/snapshot_lifecycle_management/get_status.rb', line 29

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

  arguments = arguments.clone

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

  body = nil
  perform_request(method, path, params, body, headers).body
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:



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

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

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

  arguments = arguments.clone

  _policy_id = arguments.delete(:policy_id)

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

  body = arguments[:body]
  perform_request(method, path, params, body, headers).body
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:



29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/elasticsearch/xpack/api/actions/snapshot_lifecycle_management/start.rb', line 29

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

  arguments = arguments.clone

  method = Elasticsearch::API::HTTP_POST
  path   = "_slm/start"
  params = {}

  body = nil
  perform_request(method, path, params, body, headers).body
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:



29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/elasticsearch/xpack/api/actions/snapshot_lifecycle_management/stop.rb', line 29

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

  arguments = arguments.clone

  method = Elasticsearch::API::HTTP_POST
  path   = "_slm/stop"
  params = {}

  body = nil
  perform_request(method, path, params, body, headers).body
end