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/params_registry.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,
lib/elasticsearch/api/actions/snapshot/cleanup_repository.rb

Defined Under Namespace

Modules: ParamsRegistry

Instance Method Summary collapse

Instance Method Details

#cleanup_repository(arguments = {}) ⇒ Object

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :body (Hash)

    TODO: Description

Raises:

  • (ArgumentError)

See Also:



19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/elasticsearch/api/actions/snapshot/cleanup_repository.rb', line 19

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

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

#create(arguments = {}) ⇒ Object

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :body (Hash)

    The snapshot definition

Raises:

  • (ArgumentError)

See Also:



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/elasticsearch/api/actions/snapshot/create.rb', line 20

def create(arguments = {})
  raise ArgumentError, "Required argument 'repository' missing" unless arguments[:repository]
  raise ArgumentError, "Required argument 'snapshot' missing" unless arguments[:snapshot]

  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).body
end

#create_repository(arguments = {}) ⇒ Object

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :body (Hash)

    The repository definition (Required)

Raises:

  • (ArgumentError)

See Also:



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/elasticsearch/api/actions/snapshot/create_repository.rb', line 20

def create_repository(arguments = {})
  raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
  raise ArgumentError, "Required argument 'repository' missing" unless arguments[:repository]

  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).body
end

#delete(arguments = {}) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/elasticsearch/api/actions/snapshot/delete.rb', line 18

def delete(arguments = {})
  raise ArgumentError, "Required argument 'repository' missing" unless arguments[:repository]
  raise ArgumentError, "Required argument 'snapshot' missing" unless arguments[:snapshot]

  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).body }
  else
    perform_request(method, path, params, body).body
  end
end

#delete_repository(arguments = {}) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/elasticsearch/api/actions/snapshot/delete_repository.rb', line 18

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

  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).body }
  else
    perform_request(method, path, params, body).body
  end
end

#get(arguments = {}) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/elasticsearch/api/actions/snapshot/get.rb', line 20

def get(arguments = {})
  raise ArgumentError, "Required argument 'repository' missing" unless arguments[:repository]
  raise ArgumentError, "Required argument 'snapshot' missing" unless arguments[:snapshot]

  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).body }
  else
    perform_request(method, path, params, body).body
  end
end

#get_repository(arguments = {}) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/elasticsearch/api/actions/snapshot/get_repository.rb', line 18

def get_repository(arguments = {})
  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).body }
  else
    perform_request(method, path, params, body).body
  end
end

#restore(arguments = {}) ⇒ Object

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :body (Hash)

    Details of what to restore

Raises:

  • (ArgumentError)

See Also:



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/elasticsearch/api/actions/snapshot/restore.rb', line 20

def restore(arguments = {})
  raise ArgumentError, "Required argument 'repository' missing" unless arguments[:repository]
  raise ArgumentError, "Required argument 'snapshot' missing" unless arguments[:snapshot]

  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).body
end

#status(arguments = {}) ⇒ Object



19
20
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/status.rb', line 19

def status(arguments = {})
  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).body }
  else
    perform_request(method, path, params, body).body
  end
end

#verify_repository(arguments = {}) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/elasticsearch/api/actions/snapshot/verify_repository.rb', line 18

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

  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).body
end