Class: Bricolage::StreamingLoad::S3ObjectEvent
- Inherits:
-
Event
- Object
- Bricolage::SQSMessage
- Event
- Bricolage::StreamingLoad::S3ObjectEvent
- Defined in:
- lib/bricolage/streamingload/event.rb
Constant Summary
Constants inherited from Bricolage::SQSMessage
Bricolage::SQSMessage::SQS_EVENT_SOURCE
Instance Attribute Summary collapse
-
#bucket ⇒ Object
readonly
Returns the value of attribute bucket.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#region ⇒ Object
readonly
Returns the value of attribute region.
-
#size ⇒ Object
readonly
Returns the value of attribute size.
Attributes inherited from Bricolage::SQSMessage
#delay_seconds, #message_id, #name, #receipt_handle, #source, #time
Class Method Summary collapse
Instance Method Summary collapse
- #created? ⇒ Boolean
-
#data? ⇒ Boolean
override.
- #init_message(region:, bucket:, key:, size:) ⇒ Object
- #loadable_object(url_patterns) ⇒ Object
- #message_type ⇒ Object
- #url ⇒ Object
Methods inherited from Event
Methods inherited from Bricolage::SQSMessage
#body, create, for_sqs_record, for_sqs_result, get_event_time, #initialize
Constructor Details
This class inherits a constructor from Bricolage::SQSMessage
Instance Attribute Details
#bucket ⇒ Object (readonly)
Returns the value of attribute bucket.
134 135 136 |
# File 'lib/bricolage/streamingload/event.rb', line 134 def bucket @bucket end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
135 136 137 |
# File 'lib/bricolage/streamingload/event.rb', line 135 def key @key end |
#region ⇒ Object (readonly)
Returns the value of attribute region.
133 134 135 |
# File 'lib/bricolage/streamingload/event.rb', line 133 def region @region end |
#size ⇒ Object (readonly)
Returns the value of attribute size.
136 137 138 |
# File 'lib/bricolage/streamingload/event.rb', line 136 def size @size end |
Class Method Details
.parse_sqs_record(msg, rec) ⇒ Object
113 114 115 116 117 118 119 120 |
# File 'lib/bricolage/streamingload/event.rb', line 113 def S3ObjectEvent.parse_sqs_record(msg, rec) { region: rec['awsRegion'], bucket: rec['s3']['bucket']['name'], key: rec['s3']['object']['key'], size: rec['s3']['object']['size'] } end |
Instance Method Details
#created? ⇒ Boolean
147 148 149 |
# File 'lib/bricolage/streamingload/event.rb', line 147 def created? !!(/\AObjectCreated:(?!Copy)/ =~ @name) end |
#data? ⇒ Boolean
override
143 144 145 |
# File 'lib/bricolage/streamingload/event.rb', line 143 def data? true end |
#init_message(region:, bucket:, key:, size:) ⇒ Object
126 127 128 129 130 131 |
# File 'lib/bricolage/streamingload/event.rb', line 126 def (region:, bucket:, key:, size:) @region = region @bucket = bucket @key = key @size = size end |
#loadable_object(url_patterns) ⇒ Object
151 152 153 |
# File 'lib/bricolage/streamingload/event.rb', line 151 def loadable_object(url_patterns) LoadableObject.new(self, url_patterns.match(url)) end |
#message_type ⇒ Object
122 123 124 |
# File 'lib/bricolage/streamingload/event.rb', line 122 def 'data' end |
#url ⇒ Object
138 139 140 |
# File 'lib/bricolage/streamingload/event.rb', line 138 def url "s3://#{@bucket}/#{@key}" end |