Module: Elasticsearch::API::Snapshot::Actions
- Included in:
- SnapshotClient
- Defined in:
- lib/elasticsearch/api/namespace/snapshot.rb,
lib/elasticsearch/api/actions/snapshot/get.rb,
lib/elasticsearch/api/actions/snapshot/create.rb,
lib/elasticsearch/api/actions/snapshot/delete.rb,
lib/elasticsearch/api/actions/snapshot/status.rb,
lib/elasticsearch/api/actions/snapshot/restore.rb,
lib/elasticsearch/api/actions/snapshot/get_repository.rb,
lib/elasticsearch/api/actions/snapshot/create_repository.rb,
lib/elasticsearch/api/actions/snapshot/delete_repository.rb,
lib/elasticsearch/api/actions/snapshot/verify_repository.rb
Instance Method Summary collapse
-
#create(arguments = {}) ⇒ Object
Create a new snapshot in the repository.
-
#create_repository(arguments = {}) ⇒ Object
Create a repository for storing snapshots.
-
#delete(arguments = {}) ⇒ Object
Delete a snapshot from the repository.
-
#delete_repository(arguments = {}) ⇒ Object
Delete a specific repository or repositories.
-
#get(arguments = {}) ⇒ Object
Return information about specific (or all) snapshots.
-
#get_repository(arguments = {}) ⇒ Object
Get information about snapshot repositories or a specific repository.
-
#restore(arguments = {}) ⇒ Object
Restore the state from a snapshot.
-
#status(arguments = {}) ⇒ Object
Return information about a running snapshot.
-
#verify_repository(arguments = {}) ⇒ Object
Explicitly perform the verification of a repository.
Instance Method Details
#create(arguments = {}) ⇒ Object
Create a new snapshot in the repository
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/elasticsearch/api/actions/snapshot/create.rb', line 27 def create(arguments={}) raise ArgumentError, "Required argument 'repository' missing" unless arguments[:repository] raise ArgumentError, "Required argument 'snapshot' missing" unless arguments[:snapshot] valid_params = [ :master_timeout, :wait_for_completion ] repository = arguments.delete(:repository) snapshot = arguments.delete(:snapshot) method = HTTP_PUT path = Utils.__pathify( '_snapshot', Utils.__escape(repository), Utils.__escape(snapshot) ) params = Utils.__validate_and_extract_params arguments, valid_params body = arguments[:body] perform_request(method, path, params, body).body end |
#create_repository(arguments = {}) ⇒ Object
Create a repository for storing snapshots
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/elasticsearch/api/actions/snapshot/create_repository.rb', line 23 def create_repository(arguments={}) raise ArgumentError, "Required argument 'repository' missing" unless arguments[:repository] raise ArgumentError, "Required argument 'body' missing" unless arguments[:body] valid_params = [ :repository, :master_timeout, :timeout ] repository = arguments.delete(:repository) method = HTTP_PUT path = Utils.__pathify( '_snapshot', Utils.__escape(repository) ) params = Utils.__validate_and_extract_params arguments, valid_params body = arguments[:body] perform_request(method, path, params, body).body end |
#delete(arguments = {}) ⇒ Object
Will also abort a currently running snapshot.
Delete a snapshot from the repository
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/elasticsearch/api/actions/snapshot/delete.rb', line 21 def delete(arguments={}) raise ArgumentError, "Required argument 'repository' missing" unless arguments[:repository] raise ArgumentError, "Required argument 'snapshot' missing" unless arguments[:snapshot] valid_params = [ :master_timeout ] repository = arguments.delete(:repository) snapshot = arguments.delete(:snapshot) method = HTTP_DELETE path = Utils.__pathify( '_snapshot', Utils.__escape(repository), Utils.__listify(snapshot) ) params = Utils.__validate_and_extract_params arguments, valid_params body = nil if Array(arguments[:ignore]).include?(404) Utils.__rescue_from_not_found { perform_request(method, path, params, body).body } else perform_request(method, path, params, body).body end end |
#delete_repository(arguments = {}) ⇒ Object
Delete a specific repository or repositories
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/elasticsearch/api/actions/snapshot/delete_repository.rb', line 19 def delete_repository(arguments={}) raise ArgumentError, "Required argument 'repository' missing" unless arguments[:repository] valid_params = [ :master_timeout, :timeout ] repository = arguments.delete(:repository) method = HTTP_DELETE path = Utils.__pathify( '_snapshot', Utils.__listify(repository) ) params = Utils.__validate_and_extract_params arguments, valid_params body = nil if Array(arguments[:ignore]).include?(404) Utils.__rescue_from_not_found { perform_request(method, path, params, body).body } else perform_request(method, path, params, body).body end end |
#get(arguments = {}) ⇒ Object
Return information about specific (or all) snapshots
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/elasticsearch/api/actions/snapshot/get.rb', line 28 def get(arguments={}) raise ArgumentError, "Required argument 'repository' missing" unless arguments[:repository] raise ArgumentError, "Required argument 'snapshot' missing" unless arguments[:snapshot] valid_params = [ :ignore_unavailable, :master_timeout ] repository = arguments.delete(:repository) snapshot = arguments.delete(:snapshot) method = HTTP_GET path = Utils.__pathify( '_snapshot', Utils.__escape(repository), Utils.__listify(snapshot) ) params = Utils.__validate_and_extract_params arguments, valid_params body = nil if Array(arguments[:ignore]).include?(404) Utils.__rescue_from_not_found { perform_request(method, path, params, body).body } else perform_request(method, path, params, body).body end end |
#get_repository(arguments = {}) ⇒ Object
Get information about snapshot repositories or a specific repository
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/elasticsearch/api/actions/snapshot/get_repository.rb', line 25 def get_repository(arguments={}) valid_params = [ :master_timeout, :local ] repository = arguments.delete(:repository) method = HTTP_GET path = Utils.__pathify( '_snapshot', Utils.__escape(repository) ) params = Utils.__validate_and_extract_params arguments, valid_params body = nil if Array(arguments[:ignore]).include?(404) Utils.__rescue_from_not_found { perform_request(method, path, params, body).body } else perform_request(method, path, params, body).body end end |
#restore(arguments = {}) ⇒ Object
You cannot restore into an open index, you have to Indices::Actions#close it first
Restore the state from a snapshot
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/elasticsearch/api/actions/snapshot/restore.rb', line 31 def restore(arguments={}) raise ArgumentError, "Required argument 'repository' missing" unless arguments[:repository] raise ArgumentError, "Required argument 'snapshot' missing" unless arguments[:snapshot] valid_params = [ :master_timeout, :wait_for_completion ] repository = arguments.delete(:repository) snapshot = arguments.delete(:snapshot) method = HTTP_POST path = Utils.__pathify( '_snapshot', Utils.__escape(repository), Utils.__escape(snapshot), '_restore' ) params = Utils.__validate_and_extract_params arguments, valid_params body = arguments[:body] perform_request(method, path, params, body).body end |
#status(arguments = {}) ⇒ Object
Return information about a running snapshot
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/elasticsearch/api/actions/snapshot/status.rb', line 24 def status(arguments={}) valid_params = [ :ignore_unavailable, :master_timeout ] repository = arguments.delete(:repository) snapshot = arguments.delete(:snapshot) method = HTTP_GET path = Utils.__pathify( '_snapshot', Utils.__escape(repository), Utils.__escape(snapshot), '_status') params = Utils.__validate_and_extract_params arguments, valid_params body = nil if Array(arguments[:ignore]).include?(404) Utils.__rescue_from_not_found { perform_request(method, path, params, body).body } else perform_request(method, path, params, body).body end end |
#verify_repository(arguments = {}) ⇒ Object
Explicitly perform the verification of a repository
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/elasticsearch/api/actions/snapshot/verify_repository.rb', line 14 def verify_repository(arguments={}) raise ArgumentError, "Required argument 'repository' missing" unless arguments[:repository] valid_params = [ :repository, :master_timeout, :timeout ] repository = arguments.delete(:repository) method = HTTP_POST path = Utils.__pathify( '_snapshot', Utils.__escape(repository), '_verify' ) params = Utils.__validate_and_extract_params arguments, valid_params body = nil perform_request(method, path, params, body).body end |