Class: Fluentd::Setting::OutForward

Inherits:
Object
  • Object
show all
Includes:
Common
Defined in:
app/models/fluentd/setting/out_forward.rb

Defined Under Namespace

Classes: Secondary, Server

Constant Summary collapse

KEYS =
[
  :match,
  :send_timeout, :recover_wait, :heartbeat_type, :heartbeat_interval,
  :phi_threshold, :hard_timeout,
  :server, :secondary
].freeze

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Common

#boolenan, #child_class, #children_of, #column_type, #conf, #empty_value?, #flag, #input_plugin?, #output_plugin?, #plugin_type_name, #print_if_present, #to_config, #values_of

Class Method Details

.initial_paramsObject



69
70
71
72
73
74
75
76
77
# File 'app/models/fluentd/setting/out_forward.rb', line 69

def self.initial_params
  {
    secondary: {
      "0" => {
        type: "file",
      }
    }
  }
end

Instance Method Details

#advanced_optionsObject



85
86
87
88
89
90
# File 'app/models/fluentd/setting/out_forward.rb', line 85

def advanced_options
  [
    :send_timeout, :recover_wait, :heartbeat_type, :heartbeat_interval,
    :phi_threshold, :hard_timeout,
  ]
end

#common_optionsObject



79
80
81
82
83
# File 'app/models/fluentd/setting/out_forward.rb', line 79

def common_options
  [
    :match, :server, :secondary,
  ]
end

#validate_has_at_least_one_serverObject



48
49
50
51
52
# File 'app/models/fluentd/setting/out_forward.rb', line 48

def validate_has_at_least_one_server
  if children_of(:server).reject{|s| s.empty_value? }.blank?
    errors.add(:base, :out_forward_blank_server)
  end
end

#validate_nested_valuesObject



54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'app/models/fluentd/setting/out_forward.rb', line 54

def validate_nested_values
  self.class.children.inject(true) do |result, (key, _)|
    children_of(key).each do |child|
      if !child.empty_value? && !child.valid?
        child.errors.full_messages.each do |message|
          errors.add(:base, "(#{key})#{message}")
        end
        result = false
      end
      result
    end
    result
  end
end