Class: Instance

Inherits:
BaseModel show all
Defined in:
lib/deltacloud/models/instance.rb,
lib/deltacloud/drivers/ec2/ec2_driver.rb,
lib/deltacloud/drivers/gogrid/gogrid_driver.rb

Overview

Copyright © 2009, 2010 Red Hat, Inc.

Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

attr_accessor, attributes, #attributes, #id, #to_hash, #to_json

Constructor Details

#initialize(init = nil) ⇒ Instance

Returns a new instance of Instance.



34
35
36
37
38
39
# File 'lib/deltacloud/models/instance.rb', line 34

def initialize(init=nil)
  super(init)
  self.actions = [] if self.actions.nil?
  self.public_addresses = [] if self.public_addresses.nil?
  self.private_addresses = [] if self.private_addresses.nil?
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args) ⇒ Object



41
42
43
44
45
46
47
# File 'lib/deltacloud/models/instance.rb', line 41

def method_missing(name, *args)
  if name =~ /is_(\w+)\?/
    return true if self.state.downcase.eql?($1)
  else
    raise NoMethodError
  end
end

Instance Attribute Details

#actionsObject

Returns the value of attribute actions.



26
27
28
# File 'lib/deltacloud/models/instance.rb', line 26

def actions
  @actions
end

#authn_errorObject

Returns the value of attribute authn_error.



32
33
34
# File 'lib/deltacloud/models/instance.rb', line 32

def authn_error
  @authn_error
end

#image_idObject

Returns the value of attribute image_id.



22
23
24
# File 'lib/deltacloud/models/instance.rb', line 22

def image_id
  @image_id
end

#instance_profileObject

Returns the value of attribute instance_profile.



29
30
31
# File 'lib/deltacloud/models/instance.rb', line 29

def instance_profile
  @instance_profile
end

#keynameObject

Returns the value of attribute keyname.



31
32
33
# File 'lib/deltacloud/models/instance.rb', line 31

def keyname
  @keyname
end

#launch_timeObject

Returns the value of attribute launch_time.



30
31
32
# File 'lib/deltacloud/models/instance.rb', line 30

def launch_time
  @launch_time
end

#nameObject

Returns the value of attribute name.



23
24
25
# File 'lib/deltacloud/models/instance.rb', line 23

def name
  @name
end

#owner_idObject

Returns the value of attribute owner_id.



21
22
23
# File 'lib/deltacloud/models/instance.rb', line 21

def owner_id
  @owner_id
end

#passwordObject

Returns the value of attribute password.



24
25
26
# File 'lib/deltacloud/drivers/gogrid/gogrid_driver.rb', line 24

def password
  @password
end

#private_addressesObject

Returns the value of attribute private_addresses.



28
29
30
# File 'lib/deltacloud/models/instance.rb', line 28

def private_addresses
  @private_addresses
end

#public_addressesObject

Returns the value of attribute public_addresses.



27
28
29
# File 'lib/deltacloud/models/instance.rb', line 27

def public_addresses
  @public_addresses
end

#realm_idObject

Returns the value of attribute realm_id.



24
25
26
# File 'lib/deltacloud/models/instance.rb', line 24

def realm_id
  @realm_id
end

#stateObject

Returns the value of attribute state.



25
26
27
# File 'lib/deltacloud/models/instance.rb', line 25

def state
  @state
end

#usernameObject

Returns the value of attribute username.



23
24
25
# File 'lib/deltacloud/drivers/gogrid/gogrid_driver.rb', line 23

def username
  @username
end

Instance Method Details

#authn_feature_failed?Boolean

Returns:

  • (Boolean)


49
50
51
# File 'lib/deltacloud/models/instance.rb', line 49

def authn_feature_failed?
  return true unless authn_error.nil?
end