Class: DaggerRuby::Service
Instance Attribute Summary
Attributes inherited from DaggerObject
#client, #query_builder
Class Method Summary
collapse
Instance Method Summary
collapse
#chain_operation, #id, #initialize
Class Method Details
.from_id(id, client) ⇒ Object
7
8
9
10
11
|
# File 'lib/dagger_ruby/service.rb', line 7
def self.from_id(id, client)
query = QueryBuilder.new("service")
query.load_from_id(id)
new(query, client)
end
|
.root_field_name ⇒ Object
13
14
15
|
# File 'lib/dagger_ruby/service.rb', line 13
def self.root_field_name
"service"
end
|
Instance Method Details
#endpoint(opts = {}) ⇒ Object
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/dagger_ruby/service.rb', line 17
def endpoint(opts = {})
args = {}
args["port"] = opts[:port] if opts[:port]
args["scheme"] = opts[:scheme] if opts[:scheme]
if args.empty?
get_scalar("endpoint")
else
query = @query_builder.build_query_with_selection("endpoint(#{format_arguments(args)})")
result = @client.execute(query)
(result, "endpoint")
end
end
|
#hostname ⇒ Object
31
32
33
|
# File 'lib/dagger_ruby/service.rb', line 31
def hostname
get_scalar("hostname")
end
|
#ports ⇒ Object
35
36
37
|
# File 'lib/dagger_ruby/service.rb', line 35
def ports
get_scalar("ports")
end
|
#start ⇒ Object
39
40
41
42
43
|
# File 'lib/dagger_ruby/service.rb', line 39
def start
query = @query_builder.build_query_with_selection("start")
result = @client.execute(query)
(result, "start")
end
|
#stop(opts = {}) ⇒ Object
45
46
47
48
49
50
51
52
53
54
55
56
57
|
# File 'lib/dagger_ruby/service.rb', line 45
def stop(opts = {})
args = {}
args["kill"] = opts[:kill] if opts.key?(:kill)
query = if args.empty?
@query_builder.build_query_with_selection("stop")
else
@query_builder.build_query_with_selection("stop(#{format_arguments(args)})")
end
result = @client.execute(query)
(result, "stop")
end
|
#sync ⇒ Object
78
79
80
81
|
# File 'lib/dagger_ruby/service.rb', line 78
def sync
get_scalar("id")
self
end
|
#up(opts = {}) ⇒ Object
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
# File 'lib/dagger_ruby/service.rb', line 59
def up(opts = {})
args = {}
args["ports"] = opts[:ports] if opts[:ports]
args["random"] = opts[:random] if opts.key?(:random)
query = if args.empty?
@query_builder.build_query_with_selection("up")
else
@query_builder.build_query_with_selection("up(#{format_arguments(args)})")
end
result = @client.execute(query)
(result, "up")
end
|
#with_hostname(hostname) ⇒ Object
74
75
76
|
# File 'lib/dagger_ruby/service.rb', line 74
def with_hostname(hostname)
chain_operation("withHostname", { "hostname" => hostname })
end
|