Class: Weavr::Service
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Resource
child_resources, #connection, extract_class_params, load_definitions!, predefine_class, receive, #receive!, #refresh!, #resource_action
Class Method Details
.label ⇒ Object
3
|
# File 'lib/weavr/resource/service.rb', line 3
def self.label() 'ServiceInfo' ; end
|
Instance Method Details
#create ⇒ Object
11
12
13
|
# File 'lib/weavr/resource/service.rb', line 11
def create
resource_action(:post, self.class.label => { service_name: service_name })
end
|
#install ⇒ Object
20
21
22
|
# File 'lib/weavr/resource/service.rb', line 20
def install
to_state'INSTALLED'
end
|
#start ⇒ Object
28
29
30
|
# File 'lib/weavr/resource/service.rb', line 28
def start
to_state 'STARTED'
end
|
#stop ⇒ Object
24
25
26
|
# File 'lib/weavr/resource/service.rb', line 24
def stop
to_state 'INSTALLED'
end
|
#to_state(state) ⇒ Object
15
16
17
18
|
# File 'lib/weavr/resource/service.rb', line 15
def to_state state
res = resource_action(:put, RequestInfo: { context: "Transition to #{state}" }, Body: { ServiceInfo: { state: state } })
Request.receive(res || { })
end
|