1
# vim: tabstop=4 shiftwidth=4 softtabstop=4
4
# Licensed under the Apache License, Version 2.0 (the "License"); you may
5
# not use this file except in compliance with the License. You may obtain
6
# a copy of the License at
8
# http://www.apache.org/licenses/LICENSE-2.0
10
# Unless required by applicable law or agreed to in writing, software
11
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13
# License for the specific language governing permissions and limitations
16
from heat.common import wsgi
17
from heat.rpc import client as rpc_client
18
from heat.common import identifier
19
from heat.api.aws import exception
20
import heat.openstack.common.rpc.common as rpc_common
23
class SignalController(object):
24
def __init__(self, options):
25
self.options = options
26
self.engine = rpc_client.EngineClient()
28
def update_waitcondition(self, req, body, arn):
30
identity = identifier.ResourceIdentifier.from_arn(arn)
32
md = self.engine.metadata_update(
34
stack_identity=dict(identity.stack()),
35
resource_name=identity.resource_name,
37
except rpc_common.RemoteError as ex:
38
return exception.map_remote_error(ex)
40
return {'resource': identity.resource_name, 'metadata': md}
42
def signal(self, req, body, arn):
44
identity = identifier.ResourceIdentifier.from_arn(arn)
46
md = self.engine.resource_signal(
48
stack_identity=dict(identity.stack()),
49
resource_name=identity.resource_name,
51
except rpc_common.RemoteError as ex:
52
return exception.map_remote_error(ex)
55
def create_resource(options):
57
Signal resource factory method.
59
deserializer = wsgi.JSONRequestDeserializer()
60
return wsgi.Resource(SignalController(options), deserializer)