Sha256: 88901696ff0997109e5ff99a3bd271b027e4bd2ae26911a5f0f985f6da8d0b4f

Contents?: true

Size: 1.38 KB

Versions: 2

Compression:

Stored size: 1.38 KB

Contents

# Licensed to Elasticsearch B.V under one or more agreements.
# Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
# See the LICENSE file in the project root for more information

module Elasticsearch
  module API
    module Snapshot
      module Actions
        module ParamsRegistry

          extend self

          # A Mapping of all the actions to their list of valid params.
          #
          # @since 6.2.0
          PARAMS = {}

          # Register an action with its list of valid params.
          #
          # @example Register the action.
          #   ParamsRegistry.register(:benchmark, [ :verbose ])
          #
          # @param [ Symbol ] action The action to register.
          # @param [ Array[Symbol] ] valid_params The list of valid params.
          #
          # @since 6.2.0
          def register(action, valid_params)
            PARAMS[action.to_sym] = valid_params
          end

          # Get the list of valid params for a given action.
          #
          # @example Get the list of valid params.
          #   ParamsRegistry.get(:benchmark)
          #
          # @param [ Symbol ] action The action.
          #
          # @return [ Array<Symbol> ] The list of valid params for the action.
          #
          # @since 6.2.0
          def get(action)
            PARAMS.fetch(action, [])
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
elasticsearch-api-6.8.3 lib/elasticsearch/api/actions/snapshot/params_registry.rb
elasticsearch-api-6.8.2 lib/elasticsearch/api/actions/snapshot/params_registry.rb