Class: AwsRo::EC2::Repository::Relation
- Inherits:
-
Object
- Object
- AwsRo::EC2::Repository::Relation
- Extended by:
- Forwardable
- Includes:
- Enumerable
- Defined in:
- lib/aws_ro/ec2/repository.rb
Instance Method Summary collapse
- #filters(filters) ⇒ Object
-
#initialize(klass) ⇒ Relation
constructor
A new instance of Relation.
- #instance_ids(ids) ⇒ Object
- #not_terminated ⇒ Object
- #running ⇒ Object
- #tags(filter_hash = {}) ⇒ Object
- #to_a ⇒ Object (also: #force, #inspect, #all)
Constructor Details
#initialize(klass) ⇒ Relation
Returns a new instance of Relation.
60 61 62 63 64 |
# File 'lib/aws_ro/ec2/repository.rb', line 60 def initialize(klass) @klass = klass @filters = [] @instance_ids = [] end |
Instance Method Details
#filters(filters) ⇒ Object
76 77 78 79 |
# File 'lib/aws_ro/ec2/repository.rb', line 76 def filters(filters) @filters += filters self end |
#instance_ids(ids) ⇒ Object
66 67 68 69 |
# File 'lib/aws_ro/ec2/repository.rb', line 66 def instance_ids(ids) @instance_ids += ids self end |
#not_terminated ⇒ Object
86 87 88 89 90 |
# File 'lib/aws_ro/ec2/repository.rb', line 86 def not_terminated @filters << { name: 'instance-state-name', values: ['pending', 'running', 'shutting-down', 'stopping', 'stopped'] } self end |
#running ⇒ Object
81 82 83 84 |
# File 'lib/aws_ro/ec2/repository.rb', line 81 def running @filters << { name: 'instance-state-name', values: ['running'] } self end |
#tags(filter_hash = {}) ⇒ Object
71 72 73 74 |
# File 'lib/aws_ro/ec2/repository.rb', line 71 def (filter_hash = {}) @filters += (filter_hash) self end |
#to_a ⇒ Object Also known as: force, inspect, all
92 93 94 |
# File 'lib/aws_ro/ec2/repository.rb', line 92 def to_a fetch end |