Ask Your Question
0

Where is the mapping for the call 'POST /groups'?

asked 2013-08-23 11:23:47 -0500

marcos-fermin-lobo gravatar image

Hi,

For this API call:

curl -i -H "X-Auth-Token: admin1token" -H "Content-Type: application/json" -d '{"group": {"name": "Group2"}}' http://localhost:35357/v3/groups

Where is the file that mapping this call?. I was thinking that (maybe) it was at /keytsone/identity/routers.py, in the "append_v3_routers" method... but it's not.

Thank you.

Best regards, Marcos.

edit retag flag offensive close merge delete

4 answers

Sort by ยป oldest newest most voted
0

answered 2013-08-23 16:33:51 -0500

haneef gravatar image

Check common.routers.py - It is common for all resources. append_v3_routers calls this with the params ( users,domains,groups etc)

edit flag offensive delete link more
0

answered 2013-08-26 06:26:11 -0500

marcos-fermin-lobo gravatar image

Hi Haneef Ali,

I think there is not in this file. This is the content of common/router.py and it does not contain append_v3_routers (such as identity/router.py)

from keystone.common import wsgi

class Router(wsgi.ComposableRouter): def __init__(self, controller, collection_key, key): self.controller = controller self.key = key self.collection_key = collection_key

def add_routes(self, mapper):
    collection_path = '/%(collection_key)s' % {
        'collection_key': self.collection_key}
    entity_path = '/%(collection_key)s/{%(key)s_id}' % {
        'collection_key': self.collection_key,
        'key': self.key}

    mapper.connect(
        collection_path,
        controller=self.controller,
        action='create_%s' % self.key,
        conditions=dict(method=['POST']))
    mapper.connect(
        collection_path,
        controller=self.controller,
        action='list_%s' % self.collection_key,
        conditions=dict(method=['GET']))
    mapper.connect(
        entity_path,
        controller=self.controller,
        action='get_%s' % self.key,
        conditions=dict(method=['GET']))
    mapper.connect(
        entity_path,
        controller=self.controller,
        action='update_%s' % self.key,
        conditions=dict(method=['PATCH']))
    mapper.connect(
        entity_path,
        controller=self.controller,
        action='delete_%s' % self.key,
        conditions=dict(method=['DELETE']))

Thank you.

edit flag offensive delete link more
0

answered 2013-08-28 16:34:10 -0500

haneef gravatar image

This class is instantiated with collection name as "domains", groups, users etc. All of them follow the same pattern. So if you instantiate with collection name as "group" then, you get routes for "list_groups", "create_groups", "delete_groups" etc

If you look at append_v3_routers in identity/routers.py, you can see

project_controller = controllers.ProjectV3() routers.append( router.Router(project_controller, 'projects', 'project'))

group_controller = controllers.GroupV3() routers.append( router.Router(group_controller, 'groups', 'group'))

etc which does adds those routes

edit flag offensive delete link more
0

answered 2013-08-29 06:13:06 -0500

marcos-fermin-lobo gravatar image

Thanks Haneef Ali, that solved my question.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2013-08-23 11:23:47 -0500

Seen: 55 times

Last updated: Aug 29 '13