Class: ZAWS::External::AWSCLI::Generators::Result::EC2::Instances
- Inherits:
-
Object
- Object
- ZAWS::External::AWSCLI::Generators::Result::EC2::Instances
- Defined in:
- lib/zaws/external/awscli/generators/result/ec2/instances.rb
Instance Method Summary collapse
- #get_instances_array ⇒ Object
- #get_json ⇒ Object
-
#initialize ⇒ Instances
constructor
A new instance of Instances.
- #instance_id(instance_number, id) ⇒ Object
- #network_interfaces(instance_number, interfaces) ⇒ Object
- #resize_instances_array(index) ⇒ Object
- #security_groups(instance_number, groups) ⇒ Object
- #tags(instance_number, tags) ⇒ Object
Constructor Details
#initialize ⇒ Instances
Returns a new instance of Instances.
8 9 10 11 12 13 |
# File 'lib/zaws/external/awscli/generators/result/ec2/instances.rb', line 8 def initialize @res= {} @res["Reservations"]= [] @res["Reservations"] << { "Instances" => [] } self end |
Instance Method Details
#get_instances_array ⇒ Object
46 47 48 |
# File 'lib/zaws/external/awscli/generators/result/ec2/instances.rb', line 46 def get_instances_array @res["Reservations"][0]["Instances"] end |
#get_json ⇒ Object
42 43 44 |
# File 'lib/zaws/external/awscli/generators/result/ec2/instances.rb', line 42 def get_json @res.to_json end |
#instance_id(instance_number, id) ⇒ Object
15 16 17 18 19 |
# File 'lib/zaws/external/awscli/generators/result/ec2/instances.rb', line 15 def instance_id(instance_number, id) resize_instances_array(instance_number) @res["Reservations"][0]["Instances"][instance_number]["InstanceId"]=id self end |
#network_interfaces(instance_number, interfaces) ⇒ Object
26 27 28 29 |
# File 'lib/zaws/external/awscli/generators/result/ec2/instances.rb', line 26 def network_interfaces(instance_number,interfaces) @res["Reservations"][0]["Instances"][instance_number]["NetworkInterfaces"]=interfaces.get_network_interfaces_array self end |
#resize_instances_array(index) ⇒ Object
36 37 38 39 40 |
# File 'lib/zaws/external/awscli/generators/result/ec2/instances.rb', line 36 def resize_instances_array(index) while index > @res["Reservations"][0]["Instances"].length-1 @res["Reservations"][0]["Instances"].push({}) end end |
#security_groups(instance_number, groups) ⇒ Object
21 22 23 24 |
# File 'lib/zaws/external/awscli/generators/result/ec2/instances.rb', line 21 def security_groups(instance_number,groups) @res["Reservations"][0]["Instances"][instance_number]["SecurityGroups"]=groups.get_security_groups_array self end |
#tags(instance_number, tags) ⇒ Object
31 32 33 34 |
# File 'lib/zaws/external/awscli/generators/result/ec2/instances.rb', line 31 def (instance_number,) @res["Reservations"][0]["Instances"][instance_number]["Tags"]=. self end |