Exemple #1
0
    def _setup_routes(self, mapper):
        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={'action': 'POST'})

        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']})
Exemple #2
0
    def _setup_routes(self, mapper):
        if FLAGS.allow_admin_api:
            LOG.debug(_("Including admin operations in API."))

            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={'action': 'POST'})

        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']})
Exemple #3
0
    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['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']})
Exemple #4
0
    def _setup_routes(self, mapper):
        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={'action': 'POST'})

        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']})