module Elasticsearch::API::Snapshot::Actions

Public Instance Methods

cleanup_repository(arguments = {}) click to toggle source

Removes stale data from repository.

@option arguments [String] :repository A repository name @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node @option arguments [Time] :timeout Explicit operation timeout @option arguments [Hash] :headers Custom HTTP headers

@see www.elastic.co/guide/en/elasticsearch/reference/7.15/clean-up-snapshot-repo-api.html

# File lib/elasticsearch/api/actions/snapshot/cleanup_repository.rb, line 31
def cleanup_repository(arguments = {})
  raise ArgumentError, "Required argument 'repository' missing" unless arguments[:repository]

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

  arguments = arguments.clone

  _repository = arguments.delete(:repository)

  method = Elasticsearch::API::HTTP_POST
  path   = "_snapshot/#{Utils.__listify(_repository)}/_cleanup"
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)

  body = nil
  perform_request(method, path, params, body, headers).body
end
clone(arguments = {}) click to toggle source

Clones indices from one snapshot into another snapshot in the same repository.

@option arguments [String] :repository A repository name @option arguments [String] :snapshot The name of the snapshot to clone from @option arguments [String] :target_snapshot The name of the cloned snapshot to create @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node @option arguments [Hash] :headers Custom HTTP headers @option arguments [Hash] :body The snapshot clone definition (Required)

@see www.elastic.co/guide/en/elasticsearch/reference/7.15/modules-snapshots.html

# File lib/elasticsearch/api/actions/snapshot/clone.rb, line 33
def clone(arguments = {})
  raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
  raise ArgumentError, "Required argument 'repository' missing" unless arguments[:repository]
  raise ArgumentError, "Required argument 'snapshot' missing" unless arguments[:snapshot]
  raise ArgumentError, "Required argument 'target_snapshot' missing" unless arguments[:target_snapshot]

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

  arguments = arguments.clone

  _repository = arguments.delete(:repository)

  _snapshot = arguments.delete(:snapshot)

  _target_snapshot = arguments.delete(:target_snapshot)

  method = Elasticsearch::API::HTTP_PUT
  path   = "_snapshot/#{Utils.__listify(_repository)}/#{Utils.__listify(_snapshot)}/_clone/#{Utils.__listify(_target_snapshot)}"
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)

  body = arguments[:body]
  perform_request(method, path, params, body, headers).body
end
create(arguments = {}) click to toggle source

Creates a snapshot in a repository.

@option arguments [String] :repository A repository name @option arguments [String] :snapshot A snapshot name @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node @option arguments [Boolean] :wait_for_completion Should this request wait until the operation has completed before returning @option arguments [Hash] :headers Custom HTTP headers @option arguments [Hash] :body The snapshot definition

@see www.elastic.co/guide/en/elasticsearch/reference/7.15/modules-snapshots.html

# File lib/elasticsearch/api/actions/snapshot/create.rb, line 33
def create(arguments = {})
  raise ArgumentError, "Required argument 'repository' missing" unless arguments[:repository]
  raise ArgumentError, "Required argument 'snapshot' missing" unless arguments[:snapshot]

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

  arguments = arguments.clone

  _repository = arguments.delete(:repository)

  _snapshot = arguments.delete(:snapshot)

  method = Elasticsearch::API::HTTP_PUT
  path   = "_snapshot/#{Utils.__listify(_repository)}/#{Utils.__listify(_snapshot)}"
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)

  body = arguments[:body]
  perform_request(method, path, params, body, headers).body
end
create_repository(arguments = {}) click to toggle source

Creates a repository.

@option arguments [String] :repository A repository name @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node @option arguments [Time] :timeout Explicit operation timeout @option arguments [Boolean] :verify Whether to verify the repository after creation @option arguments [Hash] :headers Custom HTTP headers @option arguments [Hash] :body The repository definition (Required)

@see www.elastic.co/guide/en/elasticsearch/reference/7.15/modules-snapshots.html

# File lib/elasticsearch/api/actions/snapshot/create_repository.rb, line 33
def create_repository(arguments = {})
  raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
  raise ArgumentError, "Required argument 'repository' missing" unless arguments[:repository]

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

  arguments = arguments.clone

  _repository = arguments.delete(:repository)

  method = Elasticsearch::API::HTTP_PUT
  path   = "_snapshot/#{Utils.__listify(_repository)}"
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)

  body = arguments[:body]
  perform_request(method, path, params, body, headers).body
end
delete(arguments = {}) click to toggle source

Deletes a snapshot.

@option arguments [String] :repository A repository name @option arguments [String] :snapshot A snapshot name @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node @option arguments [Hash] :headers Custom HTTP headers

@see www.elastic.co/guide/en/elasticsearch/reference/7.15/modules-snapshots.html

# File lib/elasticsearch/api/actions/snapshot/delete.rb, line 31
def delete(arguments = {})
  raise ArgumentError, "Required argument 'repository' missing" unless arguments[:repository]
  raise ArgumentError, "Required argument 'snapshot' missing" unless arguments[:snapshot]

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

  arguments = arguments.clone

  _repository = arguments.delete(:repository)

  _snapshot = arguments.delete(:snapshot)

  method = Elasticsearch::API::HTTP_DELETE
  path   = "_snapshot/#{Utils.__listify(_repository)}/#{Utils.__listify(_snapshot)}"
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)

  body = nil
  if Array(arguments[:ignore]).include?(404)
    Utils.__rescue_from_not_found { perform_request(method, path, params, body, headers).body }
  else
    perform_request(method, path, params, body, headers).body
  end
end
delete_repository(arguments = {}) click to toggle source

Deletes a repository.

@option arguments [List] :repository Name of the snapshot repository to unregister. Wildcard (`*`) patterns are supported. @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node @option arguments [Time] :timeout Explicit operation timeout @option arguments [Hash] :headers Custom HTTP headers

@see www.elastic.co/guide/en/elasticsearch/reference/7.15/modules-snapshots.html

# File lib/elasticsearch/api/actions/snapshot/delete_repository.rb, line 31
def delete_repository(arguments = {})
  raise ArgumentError, "Required argument 'repository' missing" unless arguments[:repository]

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

  arguments = arguments.clone

  _repository = arguments.delete(:repository)

  method = Elasticsearch::API::HTTP_DELETE
  path   = "_snapshot/#{Utils.__listify(_repository)}"
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)

  body = nil
  if Array(arguments[:ignore]).include?(404)
    Utils.__rescue_from_not_found { perform_request(method, path, params, body, headers).body }
  else
    perform_request(method, path, params, body, headers).body
  end
end
get(arguments = {}) click to toggle source

Returns information about a snapshot.

@option arguments [String] :repository A repository name @option arguments [List] :snapshot A comma-separated list of snapshot names @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node @option arguments [Boolean] :ignore_unavailable Whether to ignore unavailable snapshots, defaults to false which means a SnapshotMissingException is thrown @option arguments [Boolean] :index_details Whether to include details of each index in the snapshot, if those details are available. Defaults to false. @option arguments [Boolean] :include_repository Whether to include the repository name in the snapshot info. Defaults to true. @option arguments [Boolean] :verbose Whether to show verbose snapshot info or only show the basic info found in the repository index blob @option arguments [Hash] :headers Custom HTTP headers

@see www.elastic.co/guide/en/elasticsearch/reference/7.15/modules-snapshots.html

# File lib/elasticsearch/api/actions/snapshot/get.rb, line 35
def get(arguments = {})
  raise ArgumentError, "Required argument 'repository' missing" unless arguments[:repository]
  raise ArgumentError, "Required argument 'snapshot' missing" unless arguments[:snapshot]

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

  arguments = arguments.clone

  _repository = arguments.delete(:repository)

  _snapshot = arguments.delete(:snapshot)

  method = Elasticsearch::API::HTTP_GET
  path   = "_snapshot/#{Utils.__listify(_repository)}/#{Utils.__listify(_snapshot)}"
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)

  body = nil
  if Array(arguments[:ignore]).include?(404)
    Utils.__rescue_from_not_found { perform_request(method, path, params, body, headers).body }
  else
    perform_request(method, path, params, body, headers).body
  end
end
get_features(arguments = {}) click to toggle source

Returns a list of features which can be snapshotted in this cluster.

@option arguments [Time] :master_timeout Explicit operation timeout for connection to master node @option arguments [Hash] :headers Custom HTTP headers

@see www.elastic.co/guide/en/elasticsearch/reference/7.x/modules-snapshots.html

# File lib/elasticsearch/api/actions/snapshot/get_features.rb, line 29
def get_features(arguments = {})
  headers = arguments.delete(:headers) || {}

  arguments = arguments.clone

  method = Elasticsearch::API::HTTP_GET
  path   = "_snapshottable_features"
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)

  body = nil
  perform_request(method, path, params, body, headers).body
end
get_repository(arguments = {}) click to toggle source

Returns information about a repository.

@option arguments [List] :repository A comma-separated list of repository names @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node @option arguments [Boolean] :local Return local information, do not retrieve the state from master node (default: false) @option arguments [Hash] :headers Custom HTTP headers

@see www.elastic.co/guide/en/elasticsearch/reference/7.15/modules-snapshots.html

# File lib/elasticsearch/api/actions/snapshot/get_repository.rb, line 31
def get_repository(arguments = {})
  headers = arguments.delete(:headers) || {}

  arguments = arguments.clone

  _repository = arguments.delete(:repository)

  method = Elasticsearch::API::HTTP_GET
  path   = if _repository
             "_snapshot/#{Utils.__listify(_repository)}"
           else
             "_snapshot"
           end
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)

  body = nil
  if Array(arguments[:ignore]).include?(404)
    Utils.__rescue_from_not_found { perform_request(method, path, params, body, headers).body }
  else
    perform_request(method, path, params, body, headers).body
  end
end
repository_analyze(arguments = {}) click to toggle source

Analyzes a repository for correctness and performance

@option arguments [String] :repository A repository name @option arguments [Number] :blob_count Number of blobs to create during the test. Defaults to 100. @option arguments [Number] :concurrency Number of operations to run concurrently during the test. Defaults to 10. @option arguments [Number] :read_node_count Number of nodes on which to read a blob after writing. Defaults to 10. @option arguments [Number] :early_read_node_count Number of nodes on which to perform an early read on a blob, i.e. before writing has completed. Early reads are rare actions so the 'rare_action_probability' parameter is also relevant. Defaults to 2. @option arguments [Number] :seed Seed for the random number generator used to create the test workload. Defaults to a random value. @option arguments [Number] :rare_action_probability Probability of taking a rare action such as an early read or an overwrite. Defaults to 0.02. @option arguments [String] :max_blob_size Maximum size of a blob to create during the test, e.g '1gb' or '100mb'. Defaults to '10mb'. @option arguments [String] :max_total_data_size Maximum total size of all blobs to create during the test, e.g '1tb' or '100gb'. Defaults to '1gb'. @option arguments [Time] :timeout Explicit operation timeout. Defaults to '30s'. @option arguments [Boolean] :detailed Whether to return detailed results or a summary. Defaults to 'false' so that only the summary is returned. @option arguments [Boolean] :rarely_abort_writes Whether to rarely abort writes before they complete. Defaults to 'true'. @option arguments [Hash] :headers Custom HTTP headers

@see www.elastic.co/guide/en/elasticsearch/reference/7.15/modules-snapshots.html

# File lib/elasticsearch/api/actions/snapshot/repository_analyze.rb, line 40
def repository_analyze(arguments = {})
  raise ArgumentError, "Required argument 'repository' missing" unless arguments[:repository]

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

  arguments = arguments.clone

  _repository = arguments.delete(:repository)

  method = Elasticsearch::API::HTTP_POST
  path   = "_snapshot/#{Utils.__listify(_repository)}/_analyze"
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)

  body = nil
  perform_request(method, path, params, body, headers).body
end
restore(arguments = {}) click to toggle source

Restores a snapshot.

@option arguments [String] :repository A repository name @option arguments [String] :snapshot A snapshot name @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node @option arguments [Boolean] :wait_for_completion Should this request wait until the operation has completed before returning @option arguments [Hash] :headers Custom HTTP headers @option arguments [Hash] :body Details of what to restore

@see www.elastic.co/guide/en/elasticsearch/reference/7.15/modules-snapshots.html

# File lib/elasticsearch/api/actions/snapshot/restore.rb, line 33
def restore(arguments = {})
  raise ArgumentError, "Required argument 'repository' missing" unless arguments[:repository]
  raise ArgumentError, "Required argument 'snapshot' missing" unless arguments[:snapshot]

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

  arguments = arguments.clone

  _repository = arguments.delete(:repository)

  _snapshot = arguments.delete(:snapshot)

  method = Elasticsearch::API::HTTP_POST
  path   = "_snapshot/#{Utils.__listify(_repository)}/#{Utils.__listify(_snapshot)}/_restore"
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)

  body = arguments[:body]
  perform_request(method, path, params, body, headers).body
end
status(arguments = {}) click to toggle source

Returns information about the status of a snapshot.

@option arguments [String] :repository A repository name @option arguments [List] :snapshot A comma-separated list of snapshot names @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node @option arguments [Boolean] :ignore_unavailable Whether to ignore unavailable snapshots, defaults to false which means a SnapshotMissingException is thrown @option arguments [Hash] :headers Custom HTTP headers

@see www.elastic.co/guide/en/elasticsearch/reference/7.15/modules-snapshots.html

# File lib/elasticsearch/api/actions/snapshot/status.rb, line 32
def status(arguments = {})
  headers = arguments.delete(:headers) || {}

  arguments = arguments.clone

  _repository = arguments.delete(:repository)

  _snapshot = arguments.delete(:snapshot)

  method = Elasticsearch::API::HTTP_GET
  path   = if _repository && _snapshot
             "_snapshot/#{Utils.__listify(_repository)}/#{Utils.__listify(_snapshot)}/_status"
           elsif _repository
             "_snapshot/#{Utils.__listify(_repository)}/_status"
           else
             "_snapshot/_status"
           end
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)

  body = nil
  if Array(arguments[:ignore]).include?(404)
    Utils.__rescue_from_not_found { perform_request(method, path, params, body, headers).body }
  else
    perform_request(method, path, params, body, headers).body
  end
end
verify_repository(arguments = {}) click to toggle source

Verifies a repository.

@option arguments [String] :repository A repository name @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node @option arguments [Time] :timeout Explicit operation timeout @option arguments [Hash] :headers Custom HTTP headers

@see www.elastic.co/guide/en/elasticsearch/reference/7.15/modules-snapshots.html

# File lib/elasticsearch/api/actions/snapshot/verify_repository.rb, line 31
def verify_repository(arguments = {})
  raise ArgumentError, "Required argument 'repository' missing" unless arguments[:repository]

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

  arguments = arguments.clone

  _repository = arguments.delete(:repository)

  method = Elasticsearch::API::HTTP_POST
  path   = "_snapshot/#{Utils.__listify(_repository)}/_verify"
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)

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