Class: Nephophobia::Response::Compute

Inherits:
Object
  • Object
show all
Defined in:
lib/nephophobia/response/compute.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes) ⇒ Compute

Returns a new instance of Compute.



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/nephophobia/response/compute.rb', line 11

def initialize attributes
  @attributes = attributes

  @project_id         = attributes['ownerId']
  item                = attributes['instancesSet']['item']
  item                = item.first if item.is_a?(Array)
  @description        = item['displayDescription']
  @name               = item['displayName']
  @key_name           = item['keyName']
  @instance_id        = item['instanceId']
  @ip_address         = item['ipAddress']
  @state              = item['instanceState']['name']
  @public_dns_name    = item['publicDnsName']
  @private_dns_name   = item['privateDnsName']
  @private_ip_address = item['privateIpAddress']
  @image_id           = item['imageId']
  @dns_name           = item['dnsName']
  @launch_time        = DateTime.parse(item['launchTime'])
  @placement          = item['placement']['availabilityZone']
  @instance_type      = item['instanceType']
end

Instance Attribute Details

#attributesObject

Returns the value of attribute attributes.



9
10
11
# File 'lib/nephophobia/response/compute.rb', line 9

def attributes
  @attributes
end

#descriptionObject (readonly)

Returns the value of attribute description.



4
5
6
# File 'lib/nephophobia/response/compute.rb', line 4

def description
  @description
end

#dns_nameObject (readonly)

Returns the value of attribute dns_name.



4
5
6
# File 'lib/nephophobia/response/compute.rb', line 4

def dns_name
  @dns_name
end

#image_idObject (readonly)

Returns the value of attribute image_id.



4
5
6
# File 'lib/nephophobia/response/compute.rb', line 4

def image_id
  @image_id
end

#instance_idObject (readonly)

Returns the value of attribute instance_id.



4
5
6
# File 'lib/nephophobia/response/compute.rb', line 4

def instance_id
  @instance_id
end

#instance_typeObject (readonly)

Returns the value of attribute instance_type.



4
5
6
# File 'lib/nephophobia/response/compute.rb', line 4

def instance_type
  @instance_type
end

#ip_addressObject (readonly)

Returns the value of attribute ip_address.



7
8
9
# File 'lib/nephophobia/response/compute.rb', line 7

def ip_address
  @ip_address
end

#key_nameObject (readonly)

Returns the value of attribute key_name.



5
6
7
# File 'lib/nephophobia/response/compute.rb', line 5

def key_name
  @key_name
end

#launch_timeObject (readonly)

Returns the value of attribute launch_time.



5
6
7
# File 'lib/nephophobia/response/compute.rb', line 5

def launch_time
  @launch_time
end

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'lib/nephophobia/response/compute.rb', line 5

def name
  @name
end

#owner_idObject (readonly)

Returns the value of attribute owner_id.



5
6
7
# File 'lib/nephophobia/response/compute.rb', line 5

def owner_id
  @owner_id
end

#placementObject (readonly)

Returns the value of attribute placement.



5
6
7
# File 'lib/nephophobia/response/compute.rb', line 5

def placement
  @placement
end

#private_dns_nameObject (readonly)

Returns the value of attribute private_dns_name.



6
7
8
# File 'lib/nephophobia/response/compute.rb', line 6

def private_dns_name
  @private_dns_name
end

#private_ip_addressObject (readonly)

Returns the value of attribute private_ip_address.



7
8
9
# File 'lib/nephophobia/response/compute.rb', line 7

def private_ip_address
  @private_ip_address
end

#project_idObject (readonly)

Returns the value of attribute project_id.



6
7
8
# File 'lib/nephophobia/response/compute.rb', line 6

def project_id
  @project_id
end

#public_dns_nameObject (readonly)

Returns the value of attribute public_dns_name.



6
7
8
# File 'lib/nephophobia/response/compute.rb', line 6

def public_dns_name
  @public_dns_name
end

#stateObject (readonly)

Returns the value of attribute state.



6
7
8
# File 'lib/nephophobia/response/compute.rb', line 6

def state
  @state
end