Module: Cluster::Discovery

Defined in:
lib/cluster/discovery.rb,
lib/cluster/discovery/consul.rb,
lib/cluster/discovery/errors.rb,
lib/cluster/discovery/ec2/tag.rb,
lib/cluster/discovery/version.rb,
lib/cluster/discovery/ec2/auto_scaling.rb

Defined Under Namespace

Modules: EC2 Classes: Consul, EmptyASGError, EmptyTagsError, MalformedTagsError

Constant Summary collapse

PATH =
File.expand_path('../../../../VERSION', __FILE__)
VERSION =
IO.read(PATH) rescue '0.0.1'

Class Method Summary collapse

Class Method Details

.consul(action, args) ⇒ Object



26
27
28
29
30
31
32
33
34
35
# File 'lib/cluster/discovery.rb', line 26

def consul(action, args)
  args = args.first
  consul_url = args.delete(:consul_url) if args.key?(:consul_url)
  if consul_url
    c = Cluster::Discovery::Consul.new(consul_url: consul_url)
  else
    c = Cluster::Discovery::Consul.new
  end
  c.send(action, args)
end

.discover(discovery_service, *args) ⇒ Object



9
10
11
# File 'lib/cluster/discovery.rb', line 9

def discover(discovery_service, *args)
  Cluster::Discovery.send(discovery_service.to_sym, :discover, args)
end

.ec2_asg(action, *args) ⇒ Object



19
20
21
22
23
24
# File 'lib/cluster/discovery.rb', line 19

def ec2_asg(action, *args)
  args = args.first.first
  c = Cluster::Discovery::EC2::AutoScaling.new(
    aws_region: args[:aws_region])
  c.send(action, aws_asg: args[:aws_asg])
end

.ec2_tag(action, *args) ⇒ Object



13
14
15
16
17
# File 'lib/cluster/discovery.rb', line 13

def ec2_tag(action, *args)
  args = args.first.first
  c = Cluster::Discovery::EC2::Tag.new(aws_region: args[:aws_region])
  c.send(action, aws_tags: args[:aws_tags])
end