class Kontena::Cli::Apps::YAML::Validations::CustomValidators::SecretsValidator

Public Class Methods

new() click to toggle source
Calls superclass method
# File lib/kontena/cli/apps/yaml/custom_validators/secrets_validator.rb, line 3
def initialize
  super('valid_secrets')
end

Public Instance Methods

validate(key, value, validations, errors) click to toggle source
# File lib/kontena/cli/apps/yaml/custom_validators/secrets_validator.rb, line 7
def validate(key, value, validations, errors)
  unless value.is_a?(Array)
    errors[key] = 'secrets must be array'
    return
  end
  secret_item_validation = {
    'secret' => 'string',
    'name' => 'string',
    'type' => 'string'
  }
  value.each do |secret|
    HashValidator.validator_for(secret_item_validation).validate(key, secret, secret_item_validation, errors)
  end
end