Class: Awspec::Type::Elb
Instance Attribute Summary
Attributes inherited from Base
Attributes included from Helper::Finder
Instance Method Summary collapse
- #has_ec2?(id) ⇒ Boolean
- #has_listener?(protocol:, port:, instance_protocol:, instance_port:) ⇒ Boolean
- #has_security_group?(sg_id) ⇒ Boolean
- #has_subnet?(subnet_id) ⇒ Boolean
-
#initialize(id) ⇒ Elb
constructor
A new instance of Elb.
Methods inherited from Base
#exists?, #inspect, #method_missing, #to_s
Methods included from Helper::Finder::Cloudwatch
Methods included from Helper::Finder::Elasticache
#find_cache_cluster, #find_cache_subnet_group
Methods included from Helper::Finder::Iam
#select_all_attached_policies, #select_attached_entities, #select_attached_groups, #select_attached_roles, #select_attached_users, #select_iam_group_by_user_name, #select_iam_policy_by_group_name, #select_iam_policy_by_role_name, #select_iam_policy_by_user_name, #select_policy_evaluation_results
Methods included from Helper::Finder::Lambda
#find_lambda, #select_event_source_by_function_arn
Methods included from Helper::Finder::Elb
#find_elb, #select_elb_by_vpc_id
Methods included from Helper::Finder::Ebs
#find_ebs, #select_ebs_by_instance_id
Methods included from Helper::Finder::AutoScaling
Methods included from Helper::Finder::S3
Methods included from Helper::Finder::Route53
Methods included from Helper::Finder::Rds
#find_rds, #select_rds_by_vpc_id
Methods included from Helper::Finder::SecurityGroup
#find_security_group, #select_security_group_by_vpc_id
Methods included from Helper::Finder::Ec2
#find_ec2, #find_ec2_attribute, #find_internet_gateway, #find_security_group, #find_subnet, #select_ec2_by_vpc_id, #select_eip_by_instance_id
Methods included from Helper::Finder::Vpc
#find_network_acl, #find_route_table, #find_vpc, #select_network_acl_by_vpc_id, #select_route_table_by_vpc_id
Constructor Details
#initialize(id) ⇒ Elb
Returns a new instance of Elb.
3 4 5 6 7 |
# File 'lib/awspec/type/elb.rb', line 3 def initialize(id) super @resource = find_elb(id) @id = @resource[:load_balancer_name] if @resource end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Awspec::Type::Base
Instance Method Details
#has_ec2?(id) ⇒ Boolean
20 21 22 23 24 25 |
# File 'lib/awspec/type/elb.rb', line 20 def has_ec2?(id) ec2 = find_ec2(id) @resource.instances.find do |instance| instance.instance_id = ec2.instance_id end if ec2 end |
#has_listener?(protocol:, port:, instance_protocol:, instance_port:) ⇒ Boolean
52 53 54 55 56 57 58 |
# File 'lib/awspec/type/elb.rb', line 52 def has_listener?(protocol:, port:, instance_protocol:, instance_port:) @resource[:listener_descriptions].find do |desc| listener = desc.listener listener.protocol == protocol && listener.load_balancer_port == port && \ listener.instance_protocol == instance_protocol && listener.instance_port == instance_port end end |
#has_security_group?(sg_id) ⇒ Boolean
27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/awspec/type/elb.rb', line 27 def has_security_group?(sg_id) sgs = @resource[:security_groups] ret = sgs.find do |sg| sg == sg_id end return true if ret sg2 = find_security_group(sg_id) return false unless sg2.tag_name == sg_id || sg2[:group_name] == sg_id sgs.find do |sg| sg == sg2[:group_name] end end |
#has_subnet?(subnet_id) ⇒ Boolean
40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/awspec/type/elb.rb', line 40 def has_subnet?(subnet_id) subnets = @resource[:subnets] ret = subnets.find do |s| s == subnet_id end return true if ret res = find_subnet(subnet_id) ret = subnets.find do |s| s == res[:subnet_id] end end |