Class: DNApi::Instance
- Includes:
- ComponentPossessor
- Defined in:
- lib/dnapi/instance.rb
Instance Attribute Summary collapse
-
#awsm_token ⇒ Object
Returns the value of attribute awsm_token.
-
#enabled ⇒ Object
(also: #enabled?)
Returns the value of attribute enabled.
-
#environment ⇒ Object
chef-ey selectors.
-
#id ⇒ Object
Returns the value of attribute id.
-
#instance_api_config ⇒ Object
Returns the value of attribute instance_api_config.
-
#name ⇒ Object
Returns the value of attribute name.
-
#private_hostname ⇒ Object
Returns the value of attribute private_hostname.
-
#public_hostname ⇒ Object
Returns the value of attribute public_hostname.
-
#reporting_url ⇒ Object
Returns the value of attribute reporting_url.
-
#role ⇒ Object
Returns the value of attribute role.
-
#stonith_config ⇒ Object
Returns the value of attribute stonith_config.
Attributes inherited from Struct
Instance Method Summary collapse
- #engineyard_hash ⇒ Object
-
#initialize(attributes) ⇒ Instance
constructor
A new instance of Instance.
- #legacy_hash ⇒ Object
- #newrelic_seed ⇒ Object
- #newrelic_token ⇒ Object
- #to_dna ⇒ Object
- #to_legacy_hash ⇒ Object
- #to_s ⇒ Object
Methods included from ComponentPossessor
#add_component, #component, #component_group, #has_component?, included
Methods inherited from Struct
#==, #_many, _many, #_many_values, #_ones, _ones, #_ones_values, _umembers, belongs_to, from, #inspect, many, map, one, #to_hash, #umember_inspect, unserialized_member
Methods included from Test::Ext
#default_fauxture_name, #fixture, #generate, #generate_attributes, #pick
Constructor Details
#initialize(attributes) ⇒ Instance
Returns a new instance of Instance.
20 21 22 23 24 25 26 27 28 |
# File 'lib/dnapi/instance.rb', line 20 def initialize(attributes) #legacy - (awsm,cookbooks?) passed in 'provisioned' (<2010?) - paranoid of breaking our existing "api" if provisioned = attributes.delete(:provisioned) attributes[:id] = provisioned.id attributes[:public_hostname] = provisioned.public_hostname attributes[:private_hostname] = provisioned.private_hostname end super(attributes) end |
Instance Attribute Details
#awsm_token ⇒ Object
Returns the value of attribute awsm_token
2 3 4 |
# File 'lib/dnapi/instance.rb', line 2 def awsm_token @awsm_token end |
#enabled ⇒ Object Also known as: enabled?
Returns the value of attribute enabled
2 3 4 |
# File 'lib/dnapi/instance.rb', line 2 def enabled @enabled end |
#environment ⇒ Object
chef-ey selectors
67 68 69 |
# File 'lib/dnapi/instance.rb', line 67 def environment @environment end |
#id ⇒ Object
Returns the value of attribute id
2 3 4 |
# File 'lib/dnapi/instance.rb', line 2 def id @id end |
#instance_api_config ⇒ Object
Returns the value of attribute instance_api_config
2 3 4 |
# File 'lib/dnapi/instance.rb', line 2 def instance_api_config @instance_api_config end |
#name ⇒ Object
Returns the value of attribute name
2 3 4 |
# File 'lib/dnapi/instance.rb', line 2 def name @name end |
#private_hostname ⇒ Object
Returns the value of attribute private_hostname
2 3 4 |
# File 'lib/dnapi/instance.rb', line 2 def private_hostname @private_hostname end |
#public_hostname ⇒ Object
Returns the value of attribute public_hostname
2 3 4 |
# File 'lib/dnapi/instance.rb', line 2 def public_hostname @public_hostname end |
#reporting_url ⇒ Object
Returns the value of attribute reporting_url
2 3 4 |
# File 'lib/dnapi/instance.rb', line 2 def reporting_url @reporting_url end |
#role ⇒ Object
Returns the value of attribute role
2 3 4 |
# File 'lib/dnapi/instance.rb', line 2 def role @role end |
#stonith_config ⇒ Object
Returns the value of attribute stonith_config
2 3 4 |
# File 'lib/dnapi/instance.rb', line 2 def stonith_config @stonith_config end |
Instance Method Details
#engineyard_hash ⇒ Object
46 47 48 49 |
# File 'lib/dnapi/instance.rb', line 46 def engineyard_hash { :environment => environment.to_hash, :this => id } end |
#legacy_hash ⇒ Object
51 52 53 54 55 56 |
# File 'lib/dnapi/instance.rb', line 51 def legacy_hash { :engineyard => engineyard_hash, :instance_role => role, :reporting_url => reporting_url, :name => name }.reject {|k,v| v.nil? } end |
#newrelic_seed ⇒ Object
32 33 34 35 |
# File 'lib/dnapi/instance.rb', line 32 def newrelic_seed c = component(:newrelic) c && c.seed end |
#newrelic_token ⇒ Object
37 38 39 40 |
# File 'lib/dnapi/instance.rb', line 37 def newrelic_token c = component(:newrelic) c && c.token end |
#to_dna ⇒ Object
58 59 60 |
# File 'lib/dnapi/instance.rb', line 58 def to_dna to_legacy_hash end |
#to_legacy_hash ⇒ Object
42 43 44 |
# File 'lib/dnapi/instance.rb', line 42 def to_legacy_hash environment.to_legacy_hash.merge(legacy_hash) end |
#to_s ⇒ Object
62 63 64 |
# File 'lib/dnapi/instance.rb', line 62 def to_s "Instance #{id} @ #{public_hostname} as #{role}" end |