Class: VagrantPlugins::AwsAlbTargetGroup::Util::AwsUtil
- Inherits:
-
Object
- Object
- VagrantPlugins::AwsAlbTargetGroup::Util::AwsUtil
- Defined in:
- lib/vagrant-aws-alb-target-group/util/aws_util.rb
Instance Attribute Summary collapse
-
#alb ⇒ Object
readonly
Returns the value of attribute alb.
Instance Method Summary collapse
- #add_instance(instance_id, target_group_name) ⇒ Object
-
#initialize(accesskey, secretkey, region) ⇒ AwsUtil
constructor
A new instance of AwsUtil.
- #remove_instance(instance_id, target_group_name) ⇒ Object
Constructor Details
#initialize(accesskey, secretkey, region) ⇒ AwsUtil
Returns a new instance of AwsUtil.
10 11 12 13 14 15 16 |
# File 'lib/vagrant-aws-alb-target-group/util/aws_util.rb', line 10 def initialize(accesskey, secretkey, region) credentials = Aws::Credentials.new(accesskey, secretkey) @alb = Aws::ElasticLoadBalancingV2::Client.new( credentials: credentials, region: region ) end |
Instance Attribute Details
#alb ⇒ Object (readonly)
Returns the value of attribute alb.
8 9 10 |
# File 'lib/vagrant-aws-alb-target-group/util/aws_util.rb', line 8 def alb @alb end |
Instance Method Details
#add_instance(instance_id, target_group_name) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/vagrant-aws-alb-target-group/util/aws_util.rb', line 18 def add_instance(instance_id, target_group_name) @alb.register_targets( { target_group_arn: get_target_group_arn(target_group_name), targets: [ { id: instance_id, }, ], } ) end |
#remove_instance(instance_id, target_group_name) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/vagrant-aws-alb-target-group/util/aws_util.rb', line 31 def remove_instance(instance_id, target_group_name) @alb.deregister_targets( { target_group_arn: get_target_group_arn(target_group_name), targets: [ { id: instance_id, }, ], } ) end |