Esempio n. 1
0
    def _setup_routes(self, mapper, ext_mgr):
        self.resources['versions'] = versions.create_resource()
        mapper.connect("versions", "/",
                       controller=self.resources['versions'],
                       action='index')

        mapper.redirect("", "/")

        self.resources['shares'] = shares.create_resource()
        mapper.resource("share", "shares",
                        controller=self.resources['shares'],
                        collection={'detail': 'GET'},
                        member={'action': 'POST'})

        self.resources['share_instances'] = share_instances.create_resource()
        mapper.resource("share_instance", "share_instances",
                        controller=self.resources['share_instances'],
                        collection={'detail': 'GET'},
                        member={'action': 'POST'})

        mapper.connect("share_instance",
                       "/{project_id}/shares/{share_id}/instances",
                       controller=self.resources['share_instances'],
                       action='get_share_instances',
                       conditions={"method": ['GET']})

        self.resources['snapshots'] = share_snapshots.create_resource()
        mapper.resource("snapshot", "snapshots",
                        controller=self.resources['snapshots'],
                        collection={'detail': 'GET'},
                        member={'action': 'POST'})

        self.resources['share_metadata'] = share_metadata.create_resource()
        share_metadata_controller = self.resources['share_metadata']

        mapper.resource("share_metadata", "metadata",
                        controller=share_metadata_controller,
                        parent_resource=dict(member_name='share',
                                             collection_name='shares'))

        mapper.connect("metadata",
                       "/{project_id}/shares/{share_id}/metadata",
                       controller=share_metadata_controller,
                       action='update_all',
                       conditions={"method": ['PUT']})

        self.resources['limits'] = limits.create_resource()
        mapper.resource("limit", "limits",
                        controller=self.resources['limits'])

        self.resources["security_services"] = \
            security_service.create_resource()
        mapper.resource("security-service", "security-services",
                        controller=self.resources['security_services'],
                        collection={'detail': 'GET'})

        self.resources['share_networks'] = share_networks.create_resource()
        mapper.resource(share_networks.RESOURCE_NAME,
                        'share-networks',
                        controller=self.resources['share_networks'],
                        collection={'detail': 'GET'},
                        member={'action': 'POST'})

        self.resources['share_servers'] = share_servers.create_resource()
        mapper.resource(share_servers.RESOURCE_NAME,
                        'share-servers',
                        controller=self.resources['share_servers'])
        mapper.connect('details',
                       '/{project_id}/share-servers/{id}/details',
                       controller=self.resources['share_servers'],
                       action='details',
                       conditions={"method": ['GET']})

        self.resources['types'] = share_types.create_resource()
        mapper.resource("type", "types",
                        controller=self.resources['types'],
                        collection={'detail': 'GET', 'default': 'GET'},
                        member={'action': 'POST'})

        self.resources['scheduler_stats'] = scheduler_stats.create_resource()
        mapper.connect('pools', '/{project_id}/scheduler-stats/pools',
                       controller=self.resources['scheduler_stats'],
                       action='pools_index',
                       conditions={'method': ['GET']})
        mapper.connect('pools', '/{project_id}/scheduler-stats/pools/detail',
                       controller=self.resources['scheduler_stats'],
                       action='pools_detail',
                       conditions={'method': ['GET']})

        self.resources['consistency-groups'] = (
            consistency_groups.create_resource())
        mapper.resource('consistency-group', 'consistency-groups',
                        controller=self.resources['consistency-groups'],
                        collection={'detail': 'GET'})
        mapper.connect('consistency-groups',
                       '/{project_id}/consistency-groups/{id}/action',
                       controller=self.resources['consistency-groups'],
                       action='action',
                       conditions={"action": ['POST']})

        self.resources['cgsnapshots'] = cgsnapshots.create_resource()
        mapper.resource('cgsnapshot', 'cgsnapshots',
                        controller=self.resources['cgsnapshots'],
                        collection={'detail': 'GET'},
                        member={'members': 'GET', 'action': 'POST'})
Esempio n. 2
0
    def _setup_routes(self, mapper, ext_mgr):
        self.resources['versions'] = versions.create_resource()
        mapper.connect("versions", "/",
                       controller=self.resources['versions'],
                       action='index')

        mapper.redirect("", "/")

        self.resources["availability_zones"] = (
            availability_zones.create_resource())
        mapper.resource("availability-zone",
                        # TODO(vponomaryov): rename 'os-availability-zone' to
                        # 'availability-zones' when API urls rename happens.
                        "os-availability-zone",
                        controller=self.resources["availability_zones"])

        self.resources["services"] = services.create_resource()
        mapper.resource("service",
                        # TODO(vponomaryov): rename 'os-services' to
                        # 'services' when API urls rename happens.
                        "os-services",
                        controller=self.resources["services"])

        self.resources["quota_sets"] = quota_sets.create_resource()
        mapper.resource("quota-set",
                        # TODO(vponomaryov): rename 'os-quota-sets' to
                        # 'quota-sets' when API urls rename happens.
                        "os-quota-sets",
                        controller=self.resources["quota_sets"],
                        member={'defaults': 'GET'})

        self.resources["quota_class_sets"] = quota_class_sets.create_resource()
        mapper.resource("quota-class-set",
                        # TODO(vponomaryov): rename 'os-quota-class-sets' to
                        # 'quota-class-sets' when API urls rename happens.
                        "os-quota-class-sets",
                        controller=self.resources["quota_class_sets"])

        self.resources["share_manage"] = share_manage.create_resource()
        mapper.resource("share_manage",
                        # TODO(vponomaryov): remove it when it is ported
                        # to shares controller.
                        "os-share-manage",
                        controller=self.resources["share_manage"])

        self.resources["share_unmanage"] = share_unmanage.create_resource()
        mapper.resource("share_unmanage",
                        # TODO(vponomaryov): remove it when it is ported
                        # to shares controller.
                        "os-share-unmanage",
                        controller=self.resources["share_unmanage"],
                        member={'unmanage': 'POST'})

        self.resources['shares'] = shares.create_resource()
        mapper.resource("share", "shares",
                        controller=self.resources['shares'],
                        collection={'detail': 'GET'},
                        member={'action': 'POST'})

        self.resources['share_instances'] = share_instances.create_resource()
        mapper.resource("share_instance", "share_instances",
                        controller=self.resources['share_instances'],
                        collection={'detail': 'GET'},
                        member={'action': 'POST'})

        mapper.connect("share_instance",
                       "/{project_id}/shares/{share_id}/instances",
                       controller=self.resources['share_instances'],
                       action='get_share_instances',
                       conditions={"method": ['GET']})

        self.resources['snapshots'] = share_snapshots.create_resource()
        mapper.resource("snapshot", "snapshots",
                        controller=self.resources['snapshots'],
                        collection={'detail': 'GET'},
                        member={'action': 'POST'})

        self.resources['share_metadata'] = share_metadata.create_resource()
        share_metadata_controller = self.resources['share_metadata']

        mapper.resource("share_metadata", "metadata",
                        controller=share_metadata_controller,
                        parent_resource=dict(member_name='share',
                                             collection_name='shares'))

        mapper.connect("metadata",
                       "/{project_id}/shares/{share_id}/metadata",
                       controller=share_metadata_controller,
                       action='update_all',
                       conditions={"method": ['PUT']})

        self.resources['limits'] = limits.create_resource()
        mapper.resource("limit", "limits",
                        controller=self.resources['limits'])

        self.resources["security_services"] = \
            security_service.create_resource()
        mapper.resource("security-service", "security-services",
                        controller=self.resources['security_services'],
                        collection={'detail': 'GET'})

        self.resources['share_networks'] = share_networks.create_resource()
        mapper.resource(share_networks.RESOURCE_NAME,
                        'share-networks',
                        controller=self.resources['share_networks'],
                        collection={'detail': 'GET'},
                        member={'action': 'POST'})

        self.resources['share_servers'] = share_servers.create_resource()
        mapper.resource(share_servers.RESOURCE_NAME,
                        'share-servers',
                        controller=self.resources['share_servers'])
        mapper.connect('details',
                       '/{project_id}/share-servers/{id}/details',
                       controller=self.resources['share_servers'],
                       action='details',
                       conditions={"method": ['GET']})

        self.resources['types'] = share_types.create_resource()
        mapper.resource("type", "types",
                        controller=self.resources['types'],
                        collection={'detail': 'GET', 'default': 'GET'},
                        member={'action': 'POST'})

        self.resources['scheduler_stats'] = scheduler_stats.create_resource()
        mapper.connect('pools', '/{project_id}/scheduler-stats/pools',
                       controller=self.resources['scheduler_stats'],
                       action='pools_index',
                       conditions={'method': ['GET']})
        mapper.connect('pools', '/{project_id}/scheduler-stats/pools/detail',
                       controller=self.resources['scheduler_stats'],
                       action='pools_detail',
                       conditions={'method': ['GET']})

        self.resources['consistency-groups'] = (
            consistency_groups.create_resource())
        mapper.resource('consistency-group', 'consistency-groups',
                        controller=self.resources['consistency-groups'],
                        collection={'detail': 'GET'})
        mapper.connect('consistency-groups',
                       '/{project_id}/consistency-groups/{id}/action',
                       controller=self.resources['consistency-groups'],
                       action='action',
                       conditions={"action": ['POST']})

        self.resources['cgsnapshots'] = cgsnapshots.create_resource()
        mapper.resource('cgsnapshot', 'cgsnapshots',
                        controller=self.resources['cgsnapshots'],
                        collection={'detail': 'GET'},
                        member={'members': 'GET', 'action': 'POST'})