Module: Aerosol::AWSModel
- Included in:
- AutoScaling, Instance, LaunchConfiguration, LaunchTemplate
- Defined in:
- lib/aerosol/aws_model.rb
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
- #create ⇒ Object
- #default_identifier ⇒ Object
- #destroy ⇒ Object
- #exists? ⇒ Boolean
- #initialize(hash = {}, &block) ⇒ Object
- #namespaced_name ⇒ Object
Class Method Details
.included(base) ⇒ Object
2 3 4 5 6 7 8 9 |
# File 'lib/aerosol/aws_model.rb', line 2 def self.included(base) base.instance_eval do include Dockly::Util::DSL extend ClassMethods attr_accessor :from_aws end end |
Instance Method Details
#create ⇒ Object
24 25 26 27 |
# File 'lib/aerosol/aws_model.rb', line 24 def create raise '#create! must be defined to use #create' unless respond_to?(:create!) create! unless exists? end |
#default_identifier ⇒ Object
20 21 22 |
# File 'lib/aerosol/aws_model.rb', line 20 def default_identifier "#{namespaced_name}-#{Aerosol::Util.git_sha}" end |
#destroy ⇒ Object
29 30 31 32 |
# File 'lib/aerosol/aws_model.rb', line 29 def destroy raise '#destroy! must be defined to use #destroy' unless respond_to?(:destroy!) destroy! if exists? end |
#exists? ⇒ Boolean
34 35 36 37 |
# File 'lib/aerosol/aws_model.rb', line 34 def exists? primary_value = send(self.class.primary_key) self.class.exists?(primary_value) end |
#initialize(hash = {}, &block) ⇒ Object
11 12 13 14 |
# File 'lib/aerosol/aws_model.rb', line 11 def initialize(hash={}, &block) self.from_aws = false super end |