Class: RoutesAlerts::Configuration
- Inherits:
-
Object
- Object
- RoutesAlerts::Configuration
- Defined in:
- lib/routes_alerts/configuration.rb
Constant Summary collapse
- DEFAULT_ALARM_PERIOD =
300- DEFAULT_NUMBER_OF_DATAPOINTS =
2- DEFAULT_MAX_DURATION =
100.0- DEFAULT_MIN_COUNT =
1- DEFAULT_SUCCESS_RATE =
99.0
Instance Attribute Summary collapse
-
#cloudwatch ⇒ Object
Returns the value of attribute cloudwatch.
-
#cloudwatch_logs ⇒ Object
Returns the value of attribute cloudwatch_logs.
-
#default_actions ⇒ Object
Returns the value of attribute default_actions.
-
#default_alarm_period ⇒ Object
Returns the value of attribute default_alarm_period.
-
#default_log_group_name ⇒ Object
Returns the value of attribute default_log_group_name.
-
#default_max_duration ⇒ Object
Returns the value of attribute default_max_duration.
-
#default_metrics ⇒ Object
Returns the value of attribute default_metrics.
-
#default_min_count ⇒ Object
Returns the value of attribute default_min_count.
-
#default_namespace ⇒ Object
Returns the value of attribute default_namespace.
-
#default_number_of_datapoints ⇒ Object
Returns the value of attribute default_number_of_datapoints.
-
#default_success_rate ⇒ Object
Returns the value of attribute default_success_rate.
-
#prefix ⇒ Object
Returns the value of attribute prefix.
-
#routes ⇒ Object
Returns the value of attribute routes.
Instance Method Summary collapse
- #add_route(path:, method:, max_duration: nil, min_count: nil, success_rate: nil, alarm_period: nil, number_of_datapoints: nil, metrics: nil, namespace: nil, log_group_name: nil, actions: nil) ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/routes_alerts/configuration.rb', line 28 def initialize @cloudwatch_logs = Aws::CloudWatchLogs::Client.new(region: "us-west-2") @cloudwatch = Aws::CloudWatch::Client.new(region: "us-west-2") @default_alarm_period = DEFAULT_ALARM_PERIOD @default_number_of_datapoints = DEFAULT_NUMBER_OF_DATAPOINTS @default_max_duration = DEFAULT_MAX_DURATION @default_min_count = DEFAULT_MIN_COUNT @default_success_rate = DEFAULT_SUCCESS_RATE @default_metrics = RoutesAlerts::Metrics::DEFAULT_METRICS @routes = [] @default_actions = [] @prefix = "" end |
Instance Attribute Details
#cloudwatch ⇒ Object
Returns the value of attribute cloudwatch.
14 15 16 |
# File 'lib/routes_alerts/configuration.rb', line 14 def cloudwatch @cloudwatch end |
#cloudwatch_logs ⇒ Object
Returns the value of attribute cloudwatch_logs.
14 15 16 |
# File 'lib/routes_alerts/configuration.rb', line 14 def cloudwatch_logs @cloudwatch_logs end |
#default_actions ⇒ Object
Returns the value of attribute default_actions.
14 15 16 |
# File 'lib/routes_alerts/configuration.rb', line 14 def default_actions @default_actions end |
#default_alarm_period ⇒ Object
Returns the value of attribute default_alarm_period.
14 15 16 |
# File 'lib/routes_alerts/configuration.rb', line 14 def default_alarm_period @default_alarm_period end |
#default_log_group_name ⇒ Object
Returns the value of attribute default_log_group_name.
14 15 16 |
# File 'lib/routes_alerts/configuration.rb', line 14 def default_log_group_name @default_log_group_name end |
#default_max_duration ⇒ Object
Returns the value of attribute default_max_duration.
14 15 16 |
# File 'lib/routes_alerts/configuration.rb', line 14 def default_max_duration @default_max_duration end |
#default_metrics ⇒ Object
Returns the value of attribute default_metrics.
14 15 16 |
# File 'lib/routes_alerts/configuration.rb', line 14 def default_metrics @default_metrics end |
#default_min_count ⇒ Object
Returns the value of attribute default_min_count.
14 15 16 |
# File 'lib/routes_alerts/configuration.rb', line 14 def default_min_count @default_min_count end |
#default_namespace ⇒ Object
Returns the value of attribute default_namespace.
14 15 16 |
# File 'lib/routes_alerts/configuration.rb', line 14 def default_namespace @default_namespace end |
#default_number_of_datapoints ⇒ Object
Returns the value of attribute default_number_of_datapoints.
14 15 16 |
# File 'lib/routes_alerts/configuration.rb', line 14 def default_number_of_datapoints @default_number_of_datapoints end |
#default_success_rate ⇒ Object
Returns the value of attribute default_success_rate.
14 15 16 |
# File 'lib/routes_alerts/configuration.rb', line 14 def default_success_rate @default_success_rate end |
#prefix ⇒ Object
Returns the value of attribute prefix.
14 15 16 |
# File 'lib/routes_alerts/configuration.rb', line 14 def prefix @prefix end |
#routes ⇒ Object
Returns the value of attribute routes.
14 15 16 |
# File 'lib/routes_alerts/configuration.rb', line 14 def routes @routes end |
Instance Method Details
#add_route(path:, method:, max_duration: nil, min_count: nil, success_rate: nil, alarm_period: nil, number_of_datapoints: nil, metrics: nil, namespace: nil, log_group_name: nil, actions: nil) ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/routes_alerts/configuration.rb', line 42 def add_route(path:, method:, max_duration: nil, min_count: nil, success_rate: nil, alarm_period: nil, number_of_datapoints: nil, metrics: nil, namespace: nil, log_group_name: nil, actions: nil) route_info = RoutesAlerts::RouteInfo.new( path: path.to_s, method: method.to_s.upcase, max_duration: (max_duration || default_max_duration).to_f, min_count: (min_count || default_min_count).to_i, success_rate: (success_rate || default_success_rate).to_f, alarm_period: (alarm_period || default_alarm_period).to_i, number_of_datapoints: (number_of_datapoints || default_number_of_datapoints).to_i, log_group_name: (log_group_name || default_log_group_name), namespace: (namespace || default_namespace), actions: (actions || default_actions), metrics: (metrics || default_metrics), prefix: prefix ) self.routes << route_info end |