Class: Ec2Provider
- Inherits:
-
Object
- Object
- Ec2Provider
- Defined in:
- lib/provider/ec2.rb
Instance Method Summary collapse
-
#initialize(options) ⇒ Ec2Provider
constructor
A new instance of Ec2Provider.
- #security_groups ⇒ Object
Constructor Details
#initialize(options) ⇒ Ec2Provider
Returns a new instance of Ec2Provider.
5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/provider/ec2.rb', line 5 def initialize() @options = conn_opts = { region: [:region], access_key_id: [:access_key], secret_access_key: [:secret_key], session_token: [:session_token] }.delete_if {|k,v| v.nil?} @client = Aws::EC2::Client.new(conn_opts) end |
Instance Method Details
#security_groups ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/provider/ec2.rb', line 17 def security_groups @client.describe_security_groups.security_groups.reject { |sg| @options[:vpc_id] && sg.vpc_id != @options[:vpc_id] }.collect { |sg| Ec2::SecurityGroup.new(sg) } end |