Ejemplo n.º 1
0
    def __init__(self, mapper):
        services_resource = cfapi.create_resource()
        mapper.connect('/v2/catalog',
                       controller=services_resource,
                       action='list',
                       conditions={'method': ['GET']})
        mapper.connect(('/v2/service_instances/{instance_id}'),
                       controller=services_resource,
                       action='provision',
                       conditions={'method': ['PUT']})
        mapper.connect(('/v2/service_instances/{instance_id}'),
                       controller=services_resource,
                       action='deprovision',
                       conditions={'method': ['DELETE']})

        mapper.connect(('/v2/service_instances/{instance_id}/service_bindings/'
                        '{app_id}'),
                       controller=services_resource,
                       action='bind',
                       conditions={'method': ['PUT']})

        mapper.connect(('/v2/service_instances/{instance_id}/service_bindings/'
                        '{app_id}'),
                       controller=services_resource,
                       action='unbind',
                       conditions={'method': ['DELETE']})

        mapper.connect(('/v2/service_instances/{instance_id}/last_operation'),
                       controller=services_resource,
                       action='get_last_operation',
                       conditions={'method': ['GET']})

        super(API, self).__init__(mapper)
Ejemplo n.º 2
0
 def test_resource(self):
     self.assertIsInstance(api.create_resource(), wsgi.Resource)