Class: K8y::REST::ConfigValidator

Inherits:
Object
  • Object
show all
Defined in:
lib/k8y/rest/config_validator.rb

Defined Under Namespace

Classes: ValidationError

Constant Summary collapse

VALIDATIONS =
[
  :validate_auth_info,
  :validate_context,
  :validate_cluster,
  :validate_usable,
].freeze

Instance Method Summary collapse

Constructor Details

#initialize(kubeconfig, context:) ⇒ ConfigValidator

Returns a new instance of ConfigValidator.



20
21
22
23
# File 'lib/k8y/rest/config_validator.rb', line 20

def initialize(kubeconfig, context:)
  @kubeconfig = kubeconfig
  @context = context
end

Instance Method Details

#validate!Object

Raises:



25
26
27
28
# File 'lib/k8y/rest/config_validator.rb', line 25

def validate!
  errors = VALIDATIONS.map { |validation| send(validation) }.compact
  raise ValidationError, errors if errors.present?
end