Sha256: 407baea9069e24713ac2defe7e8128d793f31b07ba58f3f6e2ccb3862f3d24a5

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 Cluster
      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/cluster/params_registry.rb
elasticsearch-api-6.8.2 lib/elasticsearch/api/actions/cluster/params_registry.rb