EC2::EC2Driver
override EC2 implementation; Eucalyptus implements the older definition of EC2 security group; docs.amazonwebservices.com/AWSEC2/2009-07-15/APIReference/index.html?ApiReference-query-AuthorizeSecurityGroupIngress.html if the rule specifies a source group, port&protocol will be ignored. And source group and cidr range can't be mixed in a request
# File lib/deltacloud/drivers/eucalyptus/eucalyptus_driver.rb, line 128 def create_firewall_rule(credentials, opts={}) # only either source groups or cidr IP range can be given, not both; if !(opts['groups'].nil?) && opts['groups'].length>0 ec2 = new_client(credentials) opts['groups'].each do |group,owner| safely do ec2.authorize_security_group_named_ingress(opts['id'], owner, group) end end elsif !(opts['addresses'].nil?) && opts['addresses'].length>0 ec2 = new_client(credentials) opts['addresses'].each do |ip| ec2.authorize_security_group_IP_ingress(opts['id'], opts['port_from'], opts['port_to'], opts['protocol'], ip) end end end
# File lib/deltacloud/drivers/eucalyptus/eucalyptus_driver.rb, line 105 def create_load_balancer(credentials, opts={}) raise Deltacloud::BackendError.new(500, "Loadbalancer", "Loadbalancer not supported in Eucalyptus", "") end
# File lib/deltacloud/drivers/eucalyptus/eucalyptus_driver.rb, line 77 def default_image_owner nil # list all images end
# File lib/deltacloud/drivers/eucalyptus/eucalyptus_driver.rb, line 81 def default_image_type nil end
# File lib/deltacloud/drivers/eucalyptus/eucalyptus_driver.rb, line 145 def delete_firewall_rule(credentials, opts={}) ec2 = new_client(credentials) firewall = opts[:firewall] protocol, from_port, to_port, addresses, groups = firewall_rule_params(opts[:rule_id]) unless groups.nil? groups.each_index do |i| ec2.revoke_security_group_named_ingress(firewall, groups[i]['owner'], groups[i]['group_name']) end end unless addresses.nil? addresses.each do |ip| ec2.revoke_security_group_IP_ingress(firewall, from_port, to_port, protocol, ip ) end end end
# File lib/deltacloud/drivers/eucalyptus/eucalyptus_driver.rb, line 110 def destroy_load_balancer(credentials, id) raise Deltacloud::BackendError.new(500, "Loadbalancer", "Loadbalancer not supported in Eucalyptus", "") end
# File lib/deltacloud/drivers/eucalyptus/eucalyptus_driver.rb, line 180 def endpoint_for_service(service) service = service.to_s endpoint = api_provider if endpoint && endpoint.include?(service) # example endpoint: 'ec2=192.168.1.1; s3=192.168.1.2' addr = Hash[endpoint.split(";").map { |svc| svc.strip.split("=") }][service] host = addr.split(':')[0] port = addr.split(':')[1] || DEFAULT_PORT stub = SERVICE_STUBS[service] { :endpoint_url => "http://#{host}:#{port}#{stub}", :connection_mode => :per_thread } else #EC2_URL/S3_URL env variable will be used by AWS { :connection_mode => :per_thread } end end
# File lib/deltacloud/drivers/eucalyptus/eucalyptus_driver.rb, line 73 def instance_state_machine self.class.instance_state_machine end
# File lib/deltacloud/drivers/eucalyptus/eucalyptus_driver.rb, line 115 def lb_register_instance(credentials, opts={}) raise Deltacloud::BackendError.new(500, "Loadbalancer", "Loadbalancer not supported in Eucalyptus", "") end
# File lib/deltacloud/drivers/eucalyptus/eucalyptus_driver.rb, line 120 def lb_unregister_instance(credentials, opts={}) raise Deltacloud::BackendError.new(500, "Loadbalancer", "Loadbalancer not supported in Eucalyptus", "") end
because load balancer is not on the supported_collections, the following methods shouldn't be called.
# File lib/deltacloud/drivers/eucalyptus/eucalyptus_driver.rb, line 95 def load_balancer(credentials, opts={}) raise Deltacloud::BackendError.new(500, "Loadbalancer", "Loadbalancer not supported in Eucalyptus", "") end
# File lib/deltacloud/drivers/eucalyptus/eucalyptus_driver.rb, line 100 def load_balancers(credentials, opts=nil) raise Deltacloud::BackendError.new(500, "Loadbalancer", "Loadbalancer not supported in Eucalyptus", "") end
# File lib/deltacloud/drivers/eucalyptus/eucalyptus_driver.rb, line 161 def new_client(credentials, type = :ec2) klass = case type when :ec2 then Aws::Ec2 when :s3 then Aws::S3 when :elb then raise Deltacloud::BackendError.new(500, "Loadbalancer", "Loadbalancer not supported in Eucalyptus", "") end klass.new(credentials.user, credentials.password, endpoint_for_service(type)) end
# File lib/deltacloud/drivers/eucalyptus/eucalyptus_driver.rb, line 24 def supported_collections DEFAULT_COLLECTIONS + [ :keys, :buckets, :addresses, :firewalls ] end
Generated with the Darkfish Rdoc Generator 2.