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
-
#delete_lifecycle(arguments = {}) ⇒ Object
Delete a policy.
-
#execute_lifecycle(arguments = {}) ⇒ Object
Run a policy.
-
#execute_retention(arguments = {}) ⇒ Object
Run a retention policy.
-
#get_lifecycle(arguments = {}) ⇒ Object
Get policy information.
-
#get_stats(arguments = {}) ⇒ Object
Get snapshot lifecycle management statistics.
-
#get_status(arguments = {}) ⇒ Object
Get the snapshot lifecycle management status.
-
#put_lifecycle(arguments = {}) ⇒ Object
Create or update a policy.
-
#start(arguments = {}) ⇒ Object
Start snapshot lifecycle management.
-
#stop(arguments = {}) ⇒ Object
Stop snapshot lifecycle management.
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.
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/elasticsearch/api/actions/snapshot_lifecycle_management/delete_lifecycle.rb', line 49 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.
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/elasticsearch/api/actions/snapshot_lifecycle_management/execute_lifecycle.rb', line 49 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.
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/elasticsearch/api/actions/snapshot_lifecycle_management/execute_retention.rb', line 48 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.
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/elasticsearch/api/actions/snapshot_lifecycle_management/get_lifecycle.rb', line 48 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.
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/elasticsearch/api/actions/snapshot_lifecycle_management/get_stats.rb', line 45 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.
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_status.rb', line 48 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.
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/elasticsearch/api/actions/snapshot_lifecycle_management/put_lifecycle.rb', line 53 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.
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/elasticsearch/api/actions/snapshot_lifecycle_management/start.rb', line 50 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.
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/elasticsearch/api/actions/snapshot_lifecycle_management/stop.rb', line 54 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 |