def __init__(self, conf, **local_conf): self.conf = conf mapper = routes.Mapper() stacks_resource = stacks.create_resource(conf) mapper.resource("stack", "stacks", controller=stacks_resource, collection={'detail': 'GET'}) mapper.connect("/CreateStack", controller=stacks_resource, action="create", conditions=dict(method=["POST"])) mapper.connect("/", controller=stacks_resource, action="list", conditions=dict(method=["GET"])) mapper.connect("/ListStacks", controller=stacks_resource, action="list", conditions=dict(method=["GET"])) mapper.connect("/DescribeStacks", controller=stacks_resource, action="describe", conditions=dict(method=["GET"])) mapper.connect("/DeleteStack", controller=stacks_resource, action="delete", conditions=dict(method=["DELETE"])) mapper.connect("/UpdateStack", controller=stacks_resource, action="update", conditions=dict(method=["PUT"])) mapper.connect("/DescribeStackEvents", controller=stacks_resource, action="events_list", conditions=dict(method=["GET"])) mapper.connect("/ValidateTemplate", controller=stacks_resource, action="validate_template", conditions=dict(method=["GET"])) super(API, self).__init__(mapper)
def __init__(self, conf, **local_conf): self.conf = conf mapper = routes.Mapper() stacks_resource = stacks.create_resource(conf) mapper.resource("stack", "stacks", controller=stacks_resource, collection={'detail': 'GET'}) def conditions(action): api_action = self._actions[action] def action_match(environ, result): req = Request(environ) env_action = req.params.get("Action") return env_action == api_action return {'function': action_match} for action in self._actions: mapper.connect("/", controller=stacks_resource, action=action, conditions=conditions(action)) mapper.connect("/", controller=stacks_resource, action="index") super(API, self).__init__(mapper)
def __init__(self, conf, **local_conf): self.conf = conf mapper = routes.Mapper() stacks_resource = stacks.create_resource(conf) mapper.resource("stack", "stacks", controller=stacks_resource, collection={'detail': 'GET'}) mapper.connect("/CreateStack", controller=stacks_resource, action="create", conditions=dict(method=["POST"])) mapper.connect("/", controller=stacks_resource, action="index") mapper.connect("/ListStacks", controller=stacks_resource, action="list", conditions=dict(method=["GET"])) mapper.connect("/DescribeStacks", controller=stacks_resource, action="describe", conditions=dict(method=["GET"])) super(API, self).__init__(mapper)