def __init__(self, conf, **local_conf): self.conf = conf mapper = routes.Mapper() root_resource = root.create_resource(conf) mapper.connect('/', controller=root_resource, action='index') schemas_resource = schemas.create_resource(conf) mapper.connect('/schemas', controller=schemas_resource, action='index', conditions={'method': ['GET']}) mapper.connect('/schemas/image', controller=schemas_resource, action='image', conditions={'method': ['GET']}) mapper.connect('/schemas/image/access', controller=schemas_resource, action='access', conditions={'method': ['GET']}) images_resource = images.create_resource(conf) mapper.connect('/images', controller=images_resource, action='index', conditions={'method': ['GET']}) mapper.connect('/images', controller=images_resource, action='create', conditions={'method': ['POST']}) mapper.connect('/images/{image_id}', controller=images_resource, action='update', conditions={'method': ['PUT']}) mapper.connect('/images/{image_id}', controller=images_resource, action='show', conditions={'method': ['GET']}) mapper.connect('/images/{image_id}', controller=images_resource, action='delete', conditions={'method': ['DELETE']}) image_data_resource = image_data.create_resource(conf) mapper.connect('/images/{image_id}/file', controller=image_data_resource, action='download', conditions={'method': ['GET']}) mapper.connect('/images/{image_id}/file', controller=image_data_resource, action='upload', conditions={'method': ['PUT']}) image_tags_resource = image_tags.create_resource(conf) mapper.connect('/images/{image_id}/tags', controller=image_tags_resource, action='index', conditions={'method': ['GET']}) mapper.connect('/images/{image_id}/tags/{tag_value}', controller=image_tags_resource, action='update', conditions={'method': ['PUT']}) mapper.connect('/images/{image_id}/tags/{tag_value}', controller=image_tags_resource, action='delete', conditions={'method': ['DELETE']}) image_access_resource = image_access.create_resource(conf) mapper.connect('/images/{image_id}/access', controller=image_access_resource, action='index', conditions={'method': ['GET']}) mapper.connect('/images/{image_id}/access', controller=image_access_resource, action='create', conditions={'method': ['POST']}) mapper.connect('/images/{image_id}/access/{tenant_id}', controller=image_access_resource, action='show', conditions={'method': ['GET']}) mapper.connect('/images/{image_id}/access/{tenant_id}', controller=image_access_resource, action='delete', conditions={'method': ['DELETE']}) super(API, self).__init__(mapper)
def __init__(self, mapper): custom_image_properties = images.load_custom_properties() schemas_resource = schemas.create_resource(custom_image_properties) mapper.connect('/schemas/image', controller=schemas_resource, action='image', conditions={'method': ['GET']}) mapper.connect('/schemas/images', controller=schemas_resource, action='images', conditions={'method': ['GET']}) mapper.connect('/schemas/image/access', controller=schemas_resource, action='access', conditions={'method': ['GET']}) mapper.connect('/schemas/image/accesses', controller=schemas_resource, action='accesses', conditions={'method': ['GET']}) images_resource = images.create_resource(custom_image_properties) mapper.connect('/images', controller=images_resource, action='index', conditions={'method': ['GET']}) mapper.connect('/images', controller=images_resource, action='create', conditions={'method': ['POST']}) mapper.connect('/images/{image_id}', controller=images_resource, action='update', conditions={'method': ['PUT']}) mapper.connect('/images/{image_id}', controller=images_resource, action='show', conditions={'method': ['GET']}) mapper.connect('/images/{image_id}', controller=images_resource, action='delete', conditions={'method': ['DELETE']}) image_data_resource = image_data.create_resource() mapper.connect('/images/{image_id}/file', controller=image_data_resource, action='download', conditions={'method': ['GET']}) mapper.connect('/images/{image_id}/file', controller=image_data_resource, action='upload', conditions={'method': ['PUT']}) image_tags_resource = image_tags.create_resource() mapper.connect('/images/{image_id}/tags/{tag_value}', controller=image_tags_resource, action='update', conditions={'method': ['PUT']}) mapper.connect('/images/{image_id}/tags/{tag_value}', controller=image_tags_resource, action='delete', conditions={'method': ['DELETE']}) image_access_resource = image_access.create_resource() mapper.connect('/images/{image_id}/access', controller=image_access_resource, action='index', conditions={'method': ['GET']}) mapper.connect('/images/{image_id}/access', controller=image_access_resource, action='create', conditions={'method': ['POST']}) mapper.connect('/images/{image_id}/access/{tenant_id}', controller=image_access_resource, action='show', conditions={'method': ['GET']}) mapper.connect('/images/{image_id}/access/{tenant_id}', controller=image_access_resource, action='delete', conditions={'method': ['DELETE']}) super(API, self).__init__(mapper)
def __init__(self, conf, **local_conf): self.conf = conf mapper = routes.Mapper() schema_api = glance.schema.API(self.conf) glance.schema.load_custom_schema_properties(conf, schema_api) root_resource = root.create_resource(conf) mapper.connect('/', controller=root_resource, action='index') schemas_resource = schemas.create_resource(conf, schema_api) mapper.connect('/schemas', controller=schemas_resource, action='index', conditions={'method': ['GET']}) mapper.connect('/schemas/image', controller=schemas_resource, action='image', conditions={'method': ['GET']}) mapper.connect('/schemas/image/access', controller=schemas_resource, action='access', conditions={'method': ['GET']}) images_resource = images.create_resource(conf, schema_api) mapper.connect('/images', controller=images_resource, action='index', conditions={'method': ['GET']}) mapper.connect('/images', controller=images_resource, action='create', conditions={'method': ['POST']}) mapper.connect('/images/{image_id}', controller=images_resource, action='update', conditions={'method': ['PUT']}) mapper.connect('/images/{image_id}', controller=images_resource, action='show', conditions={'method': ['GET']}) mapper.connect('/images/{image_id}', controller=images_resource, action='delete', conditions={'method': ['DELETE']}) image_data_resource = image_data.create_resource(conf) mapper.connect('/images/{image_id}/file', controller=image_data_resource, action='download', conditions={'method': ['GET']}) mapper.connect('/images/{image_id}/file', controller=image_data_resource, action='upload', conditions={'method': ['PUT']}) image_tags_resource = image_tags.create_resource(conf) mapper.connect('/images/{image_id}/tags', controller=image_tags_resource, action='index', conditions={'method': ['GET']}) mapper.connect('/images/{image_id}/tags/{tag_value}', controller=image_tags_resource, action='update', conditions={'method': ['PUT']}) mapper.connect('/images/{image_id}/tags/{tag_value}', controller=image_tags_resource, action='delete', conditions={'method': ['DELETE']}) image_access_resource = image_access.create_resource(conf, schema_api) mapper.connect('/images/{image_id}/access', controller=image_access_resource, action='index', conditions={'method': ['GET']}) mapper.connect('/images/{image_id}/access', controller=image_access_resource, action='create', conditions={'method': ['POST']}) mapper.connect('/images/{image_id}/access/{tenant_id}', controller=image_access_resource, action='show', conditions={'method': ['GET']}) mapper.connect('/images/{image_id}/access/{tenant_id}', controller=image_access_resource, action='delete', conditions={'method': ['DELETE']}) super(API, self).__init__(mapper)