Class: AWS::SimpleWorkflow::Resource

Inherits:
Core::Resource show all
Defined in:
lib/aws/simple_workflow/resource.rb

Direct Known Subclasses

Domain, Type, WorkflowExecution

Instance Attribute Summary

Attributes included from Core::Model

#config

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Core::Resource

attribute_providers, attribute_providers_for, attributes, #attributes_from_response, define_attribute_type, #eql?, #initialize, #inspect, new_from

Methods included from Core::Cacheable

included, #retrieve_attribute

Methods included from Core::Model

#client, #config_prefix, #initialize, #inspect

Constructor Details

This class inherits a constructor from AWS::Core::Resource

Class Method Details

.attribute(name, options = {}, &block) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/aws/simple_workflow/resource.rb', line 28

def self.attribute name, options = {}, &block

  # the simple workflow attributes are all given as 'lowerCamelCase'
  # this converts the :snake_case name to the correct format
  unless options[:as]
    parts = []
    name.to_s.split(/_/).each_with_index do |part,n|
      parts << (n == 0 ? part : part.capitalize)
    end
    options[:as] = parts.join.to_sym
  end

  if options[:duration]
    super(name, options) do
      translates_output do |v| 
        v.to_s =~ /^\d+$/ ? v.to_i : v.downcase.to_sym
      end
    end
  else
    super(name, options, &block)
  end

end

Instance Method Details

#exists?Boolean

Returns true if the resource exists.

Returns:

  • (Boolean)

    Returns true if the resource exists.



21
22
23
24
25
# File 'lib/aws/simple_workflow/resource.rb', line 21

def exists?
  !!get_resource
rescue Errors::UnknownResourceFault
  false
end