Class: CfnGuardian::Models::HttpEvent
- Defined in:
- lib/cfnguardian/models/event.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#body_regex ⇒ Object
Returns the value of attribute body_regex.
-
#endpoint ⇒ Object
Returns the value of attribute endpoint.
-
#headers ⇒ Object
Returns the value of attribute headers.
-
#method ⇒ Object
Returns the value of attribute method.
-
#payload ⇒ Object
Returns the value of attribute payload.
-
#status_code ⇒ Object
Returns the value of attribute status_code.
-
#timeout ⇒ Object
Returns the value of attribute timeout.
Attributes inherited from BaseEvent
#cron, #enabled, #environment, #group, #hash, #name, #resource, #target, #type
Instance Method Summary collapse
- #http_headers ⇒ Object
-
#initialize(resource) ⇒ HttpEvent
constructor
A new instance of HttpEvent.
- #ssm_parameters ⇒ Object
Constructor Details
#initialize(resource) ⇒ HttpEvent
Returns a new instance of HttpEvent.
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/cfnguardian/models/event.rb', line 45 def initialize(resource) super(resource) @group = 'Http' @name = 'HttpEvent' @target = 'HttpCheckFunction' @endpoint = resource['Id'] @method = resource.fetch('Method','GET') @timeout = resource.fetch('Timeout',50) @status_code = resource.fetch('StatusCode',200) @body_regex = resource.fetch('BodyRegex',nil) @headers = resource.fetch('Headers',nil) @user_agent = resource.fetch('UserAgent',nil) @payload = resource.fetch('Payload',nil) @compressed = resource.fetch('Compressed',false) @hmac_secret_ssm = resource.fetch('HmacSecretSsm',nil) @hmac_key_id = resource.fetch('HmacKeyId','default') @hmac_header_prefix = resource.fetch('HmacHeaderPrefix','X-Health') @health_config_overrides = resource.fetch('HealthConfigOverrides',nil) @report_response_body = resource.fetch('ReportResponseBody',false) end |
Instance Attribute Details
#body_regex ⇒ Object
Returns the value of attribute body_regex.
37 38 39 |
# File 'lib/cfnguardian/models/event.rb', line 37 def body_regex @body_regex end |
#endpoint ⇒ Object
Returns the value of attribute endpoint.
37 38 39 |
# File 'lib/cfnguardian/models/event.rb', line 37 def endpoint @endpoint end |
#headers ⇒ Object
Returns the value of attribute headers.
37 38 39 |
# File 'lib/cfnguardian/models/event.rb', line 37 def headers @headers end |
#method ⇒ Object
Returns the value of attribute method.
37 38 39 |
# File 'lib/cfnguardian/models/event.rb', line 37 def method @method end |
#payload ⇒ Object
Returns the value of attribute payload.
37 38 39 |
# File 'lib/cfnguardian/models/event.rb', line 37 def payload @payload end |
#status_code ⇒ Object
Returns the value of attribute status_code.
37 38 39 |
# File 'lib/cfnguardian/models/event.rb', line 37 def status_code @status_code end |
#timeout ⇒ Object
Returns the value of attribute timeout.
37 38 39 |
# File 'lib/cfnguardian/models/event.rb', line 37 def timeout @timeout end |
Instance Method Details
#http_headers ⇒ Object
66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/cfnguardian/models/event.rb', line 66 def http_headers parts = [] parts << @headers unless @headers.nil? || @headers.empty? unless @health_config_overrides.nil? override_value = @health_config_overrides.is_a?(String) ? @health_config_overrides : JSON.generate(@health_config_overrides) parts << "X-Health-Config-Overrides=#{override_value.gsub(' ', '%20')}" end parts.empty? ? nil : parts.join(' ') end |
#ssm_parameters ⇒ Object
100 101 102 |
# File 'lib/cfnguardian/models/event.rb', line 100 def ssm_parameters @hmac_secret_ssm.nil? ? [] : [@hmac_secret_ssm] end |