Class: Stoplight::Wiring::ConfigurationDsl
- Inherits:
-
Object
- Object
- Stoplight::Wiring::ConfigurationDsl
- Defined in:
- lib/stoplight/wiring/configuration_dsl.rb,
sig/_private/stoplight/wiring/configuration_dsl.rbs
Instance Attribute Summary collapse
-
#cool_off_time ⇒ optional[duration]
readonly
Returns the value of attribute cool_off_time.
-
#data_store ⇒ optional[data_store]
readonly
Returns the value of attribute data_store.
-
#error_notifier ⇒ optional[error_notifier]
readonly
Returns the value of attribute error_notifier.
-
#name ⇒ optional[String]
readonly
Returns the value of attribute name.
-
#notifiers ⇒ optional[Array[state_transition_notifier]]
readonly
Returns the value of attribute notifiers.
-
#recovery_threshold ⇒ optional[Integer]
readonly
Returns the value of attribute recovery_threshold.
-
#threshold ⇒ optional[percentage | Integer]
readonly
Returns the value of attribute threshold.
-
#window_size ⇒ optional[duration?]
readonly
Returns the value of attribute window_size.
Instance Method Summary collapse
- #configure!(default_config) ⇒ Domain::Config
-
#initialize(name: T.undefined, cool_off_time: T.undefined, threshold: T.undefined, recovery_threshold: T.undefined, window_size: T.undefined, tracked_errors: T.undefined, skipped_errors: T.undefined, data_store: T.undefined, error_notifier: T.undefined, notifiers: T.undefined, traffic_control: T.undefined, traffic_recovery: T.undefined) ⇒ ConfigurationDsl
constructor
A new instance of ConfigurationDsl.
- #skipped_errors ⇒ optional[Array[_ExceptionMatcher]]
- #tracked_errors ⇒ optional[Array[_ExceptionMatcher]]
- #traffic_control ⇒ optional[Domain::_TrafficControl]
- #traffic_recovery ⇒ optional[Domain::_TrafficRecovery]
Constructor Details
#initialize(name: T.undefined, cool_off_time: T.undefined, threshold: T.undefined, recovery_threshold: T.undefined, window_size: T.undefined, tracked_errors: T.undefined, skipped_errors: T.undefined, data_store: T.undefined, error_notifier: T.undefined, notifiers: T.undefined, traffic_control: T.undefined, traffic_recovery: T.undefined) ⇒ ConfigurationDsl
Returns a new instance of ConfigurationDsl.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/stoplight/wiring/configuration_dsl.rb', line 6 def initialize( name: T.undefined, cool_off_time: T.undefined, threshold: T.undefined, recovery_threshold: T.undefined, window_size: T.undefined, tracked_errors: T.undefined, skipped_errors: T.undefined, data_store: T.undefined, error_notifier: T.undefined, notifiers: T.undefined, traffic_control: T.undefined, traffic_recovery: T.undefined ) @name = name @cool_off_time = cool_off_time @threshold = threshold @recovery_threshold = recovery_threshold @window_size = window_size @tracked_errors = tracked_errors @skipped_errors = skipped_errors @traffic_control = traffic_control @traffic_recovery = traffic_recovery @error_notifier = error_notifier @data_store = data_store @notifiers = notifiers end |
Instance Attribute Details
#cool_off_time ⇒ optional[duration] (readonly)
Returns the value of attribute cool_off_time.
56 57 58 |
# File 'lib/stoplight/wiring/configuration_dsl.rb', line 56 def cool_off_time @cool_off_time end |
#data_store ⇒ optional[data_store] (readonly)
Returns the value of attribute data_store.
61 62 63 |
# File 'lib/stoplight/wiring/configuration_dsl.rb', line 61 def data_store @data_store end |
#error_notifier ⇒ optional[error_notifier] (readonly)
Returns the value of attribute error_notifier.
60 61 62 |
# File 'lib/stoplight/wiring/configuration_dsl.rb', line 60 def error_notifier @error_notifier end |
#name ⇒ optional[String] (readonly)
Returns the value of attribute name.
55 56 57 |
# File 'lib/stoplight/wiring/configuration_dsl.rb', line 55 def name @name end |
#notifiers ⇒ optional[Array[state_transition_notifier]] (readonly)
Returns the value of attribute notifiers.
62 63 64 |
# File 'lib/stoplight/wiring/configuration_dsl.rb', line 62 def notifiers @notifiers end |
#recovery_threshold ⇒ optional[Integer] (readonly)
Returns the value of attribute recovery_threshold.
58 59 60 |
# File 'lib/stoplight/wiring/configuration_dsl.rb', line 58 def recovery_threshold @recovery_threshold end |
#threshold ⇒ optional[percentage | Integer] (readonly)
Returns the value of attribute threshold.
57 58 59 |
# File 'lib/stoplight/wiring/configuration_dsl.rb', line 57 def threshold @threshold end |
#window_size ⇒ optional[duration?] (readonly)
Returns the value of attribute window_size.
59 60 61 |
# File 'lib/stoplight/wiring/configuration_dsl.rb', line 59 def window_size @window_size end |
Instance Method Details
#configure!(default_config) ⇒ Domain::Config
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/stoplight/wiring/configuration_dsl.rb', line 34 def configure!(default_config) ConfigCompatibilityValidator.call( config: default_config.with( name:, cool_off_time:, threshold:, recovery_threshold:, window_size:, tracked_errors:, skipped_errors:, traffic_control:, traffic_recovery:, error_notifier:, data_store:, notifiers: ) ) end |
#skipped_errors ⇒ optional[Array[_ExceptionMatcher]]
73 74 75 76 77 78 79 80 |
# File 'lib/stoplight/wiring/configuration_dsl.rb', line 73 def skipped_errors value = @skipped_errors if value.is_a?(Undefined) value else Array(value) end end |
#tracked_errors ⇒ optional[Array[_ExceptionMatcher]]
64 65 66 67 68 69 70 71 |
# File 'lib/stoplight/wiring/configuration_dsl.rb', line 64 def tracked_errors value = @tracked_errors if value.is_a?(Undefined) value else Array(value) end end |
#traffic_control ⇒ optional[Domain::_TrafficControl]
82 83 84 85 86 87 88 89 |
# File 'lib/stoplight/wiring/configuration_dsl.rb', line 82 def traffic_control value = @traffic_control if value.is_a?(Undefined) value else LightFactory::TrafficControlDsl.call(value) end end |
#traffic_recovery ⇒ optional[Domain::_TrafficRecovery]
91 92 93 94 95 96 97 98 |
# File 'lib/stoplight/wiring/configuration_dsl.rb', line 91 def traffic_recovery value = @traffic_recovery if value.is_a?(Undefined) value else LightFactory::TrafficRecoveryDsl.call(value) end end |