Sha256: 7bc61f720eba0af10c576b41c47ba5406011beda23f2d8e8a80624f5f9c6732b

Contents?: true

Size: 1.71 KB

Versions: 4

Compression:

Stored size: 1.71 KB

Contents

module Elasticsearch
  module API
    module Snapshot
      module Actions

        # Create a repository for storing snapshots
        #
        # @example Create a repository at `/tmp/backup`
        #
        #     client.snapshot.create_repository repository: 'my-backups',
        #                                       body: {
        #                                         type: 'fs',
        #                                         settings: { location: '/tmp/backup', compress: true  }
        #                                       }
        #
        # @option arguments [String] :repository A repository name (*Required*)
        # @option arguments [Hash] :body The repository definition (*Required*)
        # @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node
        # @option arguments [Time] :timeout Explicit operation timeout
        #
        # @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/modules-snapshots.html
        #
        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 = '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
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
elasticsearch-api-1.0.1 lib/elasticsearch/api/actions/snapshot/create_repository.rb
elasticsearch-api-1.0.0 lib/elasticsearch/api/actions/snapshot/create_repository.rb
elasticsearch-api-1.0.0.rc2 lib/elasticsearch/api/actions/snapshot/create_repository.rb
elasticsearch-api-1.0.0.rc1 lib/elasticsearch/api/actions/snapshot/create_repository.rb