Class: BuildCloud::SQSQueue
- Inherits:
-
Object
- Object
- BuildCloud::SQSQueue
- Includes:
- Component
- Defined in:
- lib/build-cloud/sqsqueue.rb
Constant Summary collapse
- @@objects =
[]
Instance Method Summary collapse
- #create ⇒ Object
- #delete ⇒ Object
-
#initialize(fog_interfaces, log, options = {}) ⇒ SQSQueue
constructor
A new instance of SQSQueue.
- #read ⇒ Object (also: #fog_object)
Methods included from Component
Constructor Details
#initialize(fog_interfaces, log, options = {}) ⇒ SQSQueue
Returns a new instance of SQSQueue.
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/build-cloud/sqsqueue.rb', line 7 def initialize ( fog_interfaces, log, = {} ) @sqs = fog_interfaces[:sqs] @log = log @options = @log.debug( .inspect ) (:name) end |
Instance Method Details
#create ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/build-cloud/sqsqueue.rb', line 19 def create return if exists? name = @options[:name] @log.info( "Creating SQS queue #{@options[:name]}" ) @options.delete(:name) @log.debug( "Options are: #{@options}" ) @sqs.create_queue(name, @options ) @log.debug("#{@sqs.list_queues.body}") end |
#delete ⇒ Object
38 39 40 41 42 43 44 |
# File 'lib/build-cloud/sqsqueue.rb', line 38 def delete return unless exists? @log.info( "Deleting SQS queue #{@options[:name]}" ) fog_object.destroy end |
#read ⇒ Object Also known as: fog_object
32 33 34 |
# File 'lib/build-cloud/sqsqueue.rb', line 32 def read @sqs.list_queues({'QueueNamePrefix' => "#{@options[:name]}"}).body.first.last[0] end |