Class: DaggerRuby::Service

Inherits:
DaggerObject show all
Defined in:
lib/dagger_ruby/service.rb

Instance Attribute Summary

Attributes inherited from DaggerObject

#client, #query_builder

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from DaggerObject

#chain_operation, from_id, #id, #initialize

Constructor Details

This class inherits a constructor from DaggerRuby::DaggerObject

Class Method Details

.root_field_nameObject



7
8
9
# File 'lib/dagger_ruby/service.rb', line 7

def self.root_field_name
  "service"
end

Instance Method Details

#endpoint(opts = {}) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/dagger_ruby/service.rb', line 11

def endpoint(opts = {})
  args = {}
  args["port"] = opts[:port] if opts[:port]
  args["scheme"] = opts[:scheme] if opts[:scheme]

  get_scalar("endpoint", args)
end

#hostnameObject



19
20
21
# File 'lib/dagger_ruby/service.rb', line 19

def hostname
  get_scalar("hostname")
end

#portsObject



23
24
25
# File 'lib/dagger_ruby/service.rb', line 23

def ports
  get_selection("ports", "port protocol description experimentalSkipHealthcheck")
end

#startObject



27
28
29
# File 'lib/dagger_ruby/service.rb', line 27

def start
  get_scalar("start")
end

#stop(opts = {}) ⇒ Object



31
32
33
34
35
36
# File 'lib/dagger_ruby/service.rb', line 31

def stop(opts = {})
  args = {}
  args["kill"] = opts[:kill] if opts.key?(:kill)

  get_scalar("stop", args)
end

#syncObject



50
51
52
53
# File 'lib/dagger_ruby/service.rb', line 50

def sync
  get_scalar("id")
  self
end

#up(opts = {}) ⇒ Object



38
39
40
41
42
43
44
# File 'lib/dagger_ruby/service.rb', line 38

def up(opts = {})
  args = {}
  args["ports"] = opts[:ports].map { |port| normalize_port_forward(port) } if opts[:ports]
  args["random"] = opts[:random] if opts.key?(:random)

  get_scalar("up", args)
end

#with_hostname(hostname) ⇒ Object



46
47
48
# File 'lib/dagger_ruby/service.rb', line 46

def with_hostname(hostname)
  chain_operation("withHostname", { "hostname" => hostname })
end