コード例 #1
0
ファイル: __init__.py プロジェクト: armaan/nova
    def _setup_base_routes(self, mapper, version):
        """Routes common to all versions."""

        server_members = self.server_members
        server_members['action'] = 'POST'
        if FLAGS.allow_admin_api:
            LOG.debug(_("Including admin operations in API."))

            server_members['diagnostics'] = 'GET'
            server_members['actions'] = 'GET'

            mapper.resource("user", "users",
                        controller=users.create_resource(),
                        collection={'detail': 'GET'})

            mapper.resource("account", "accounts",
                            controller=accounts.create_resource(),
                            collection={'detail': 'GET'})

            mapper.resource("zone", "zones",
                        controller=zones.create_resource(version),
                        collection={'detail': 'GET',
                                    'info': 'GET',
                                    'select': 'POST'})

        mapper.connect("versions", "/",
                    controller=versions.create_resource(version),
                    action='show')

        mapper.resource("console", "consoles",
                    controller=consoles.create_resource(),
                    parent_resource=dict(member_name='server',
                    collection_name='servers'))

        mapper.resource("server", "servers",
                        controller=servers.create_resource(version),
                        collection={'detail': 'GET'},
                        member=self.server_members)

        mapper.resource("ip", "ips", controller=ips.create_resource(version),
                        parent_resource=dict(member_name='server',
                                             collection_name='servers'))

        mapper.resource("image", "images",
                        controller=images.create_resource(version),
                        collection={'detail': 'GET'})

        mapper.resource("limit", "limits",
                        controller=limits.create_resource(version))

        mapper.resource("flavor", "flavors",
                        controller=flavors.create_resource(version),
                        collection={'detail': 'GET'})

        super(APIRouter, self).__init__(mapper)
コード例 #2
0
ファイル: __init__.py プロジェクト: tomchill/reddwarf
    def _setup_base_routes(self, mapper, version):
        """Routes common to all versions."""

        server_members = self.server_members
        server_members['action'] = 'POST'
        if FLAGS.allow_admin_api:
            LOG.debug(_("Including admin operations in API."))

            server_members['pause'] = 'POST'
            server_members['unpause'] = 'POST'
            server_members['diagnostics'] = 'GET'
            server_members['actions'] = 'GET'
            server_members['suspend'] = 'POST'
            server_members['resume'] = 'POST'
            server_members['rescue'] = 'POST'
            server_members['migrate'] = 'POST'
            server_members['unrescue'] = 'POST'
            server_members['reset_network'] = 'POST'
            server_members['inject_network_info'] = 'POST'

            mapper.resource("user",
                            "users",
                            controller=users.create_resource(),
                            collection={'detail': 'GET'})

            mapper.resource("account",
                            "accounts",
                            controller=accounts.create_resource(),
                            collection={'detail': 'GET'})

            mapper.resource("zone",
                            "zones",
                            controller=zones.create_resource(version),
                            collection={
                                'detail': 'GET',
                                'info': 'GET',
                                'select': 'POST',
                                'boot': 'POST'
                            })

        mapper.connect("versions",
                       "/",
                       controller=versions.create_resource(version),
                       action='show')

        mapper.resource("console",
                        "consoles",
                        controller=consoles.create_resource(),
                        parent_resource=dict(member_name='server',
                                             collection_name='servers'))

        mapper.resource("server",
                        "servers",
                        controller=servers.create_resource(version),
                        collection={'detail': 'GET'},
                        member=self.server_members)

        mapper.resource("ip",
                        "ips",
                        controller=ips.create_resource(version),
                        parent_resource=dict(member_name='server',
                                             collection_name='servers'))

        mapper.resource("image",
                        "images",
                        controller=images.create_resource(version),
                        collection={'detail': 'GET'})

        mapper.resource("limit",
                        "limits",
                        controller=limits.create_resource(version))

        mapper.resource("flavor",
                        "flavors",
                        controller=flavors.create_resource(version),
                        collection={'detail': 'GET'})

        super(APIRouter, self).__init__(mapper)
コード例 #3
0
ファイル: __init__.py プロジェクト: bingmu/nova
    def _setup_routes(self, mapper):
        server_members = self.server_members
        server_members['action'] = 'POST'
        if FLAGS.allow_admin_api:
            LOG.debug(_("Including admin operations in API."))

            server_members['diagnostics'] = 'GET'
            server_members['actions'] = 'GET'

            mapper.resource("user", "users",
                        controller=users.create_resource(),
                        collection={'detail': 'GET'})

            mapper.resource("account", "accounts",
                            controller=accounts.create_resource(),
                            collection={'detail': 'GET'})

            mapper.resource("zone", "zones",
                        controller=zones.create_resource(),
                        collection={'detail': 'GET',
                                    'info': 'GET',
                                    'select': 'POST'})

        mapper.connect("versions", "/",
                    controller=versions.create_resource(),
                    action='show')

        mapper.redirect("", "/")

        mapper.resource("console", "consoles",
                    controller=consoles.create_resource(),
                    parent_resource=dict(member_name='server',
                    collection_name='servers'))

        mapper.resource("server", "servers",
                        controller=servers.create_resource(),
                        collection={'detail': 'GET'},
                        member=self.server_members)

        mapper.resource("ip", "ips", controller=ips.create_resource(),
                        parent_resource=dict(member_name='server',
                                             collection_name='servers'))

        mapper.resource("image", "images",
                        controller=images.create_resource(),
                        collection={'detail': 'GET'})

        mapper.resource("limit", "limits",
                        controller=limits.create_resource())

        mapper.resource("flavor", "flavors",
                        controller=flavors.create_resource(),
                        collection={'detail': 'GET'})

        image_metadata_controller = image_metadata.create_resource()

        mapper.resource("image_meta", "metadata",
                        controller=image_metadata_controller,
                        parent_resource=dict(member_name='image',
                        collection_name='images'))

        mapper.connect("metadata", "/{project_id}/images/{image_id}/metadata",
                       controller=image_metadata_controller,
                       action='update_all',
                       conditions={"method": ['PUT']})

        server_metadata_controller = server_metadata.create_resource()

        mapper.resource("server_meta", "metadata",
                        controller=server_metadata_controller,
                        parent_resource=dict(member_name='server',
                        collection_name='servers'))

        mapper.connect("metadata",
                       "/{project_id}/servers/{server_id}/metadata",
                       controller=server_metadata_controller,
                       action='update_all',
                       conditions={"method": ['PUT']})