module LogStash::Outputs::Qingstor::QingstorValidator

Public Class Methods

bucket_valid?(bucket) click to toggle source
# File lib/logstash/outputs/qingstor/qingstor_validator.rb, line 10
def self.bucket_valid?(bucket)
  res = bucket.head
  case res[:status_code]
  when 401
    raise LogStash::ConfigurationError, 'Incorrect key id/access key.'
  when 404
    raise LogStash::ConfigurationError, 'Incorrect bucket/region name.'
  end
  true
end
prefix_valid?(prefix) click to toggle source
# File lib/logstash/outputs/qingstor/qingstor_validator.rb, line 21
def self.prefix_valid?(prefix)
  if prefix.start_with?('/') || prefix.length >= 1024
    raise LogStash::ConfigurationError, 'Prefix must not start with'\
      + " '/' and with length less than 1024 "
  end
  true
end