Re: [openstack-dev] [wsme] Undefined attributes in WSME
The question was never whether it could be made to do it (we'd have to change it, but it's just code). The question was whether allowing extra data was a good idea at all. If it's a real requirement, we just need a patch to WSME to support it. Doug On Sat, Jan 18, 2014 at 8:30 PM, Morgan Fainberg wrote: > Yes, this feature is used in real deployments just as Yuriy described. I > really want to avoid a new API version since we're just now getting solidly > into V3 being used more extensively. Is it unreasonable to have wsme allow > "extra values" in some manner? (I think that is the crux, is it something > that can even be expected) > --Morgan > > > On Saturday, January 18, 2014, Yuriy Taraday wrote: > >> >> On Tue, Jan 14, 2014 at 6:09 PM, Doug Hellmann < >> doug.hellm...@dreamhost.com> wrote: >>> >>> On Mon, Jan 13, 2014 at 9:36 PM, Jamie Lennox wrote: >>> On Mon, 2014-01-13 at 10:05 -0500, Doug Hellmann wrote: > What requirement(s) led to keystone supporting this feature? I've got no idea where the requirement came from however it is something that is supported now and so not something we can back out of. >>> >>> If it's truly a requirement, we can look into how to make that work. The >>> data is obviously present in the request, so we would just need to preserve >>> it. >>> >> >> We've seen a use case for arbitrary attributes in Keystone objects. Cloud >> administrator might want to store some metadata along with a user object. >> For example, customer name/id and couple additional fields for contact >> information. The same might be applied to projects and domains. >> >> So this is a very nice feature that should be kept around. It might be >> wrapped in some way (like in explicit unchecked "metadata" attribute) in a >> new API version though. >> > > ___ > OpenStack-dev mailing list > OpenStack-dev@lists.openstack.org > http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev > > ___ OpenStack-dev mailing list OpenStack-dev@lists.openstack.org http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
Re: [openstack-dev] [wsme] Undefined attributes in WSME
> -Original Message- > From: Kurt Griffiths [mailto:kurt.griffi...@rackspace.com] > Sent: Saturday, January 18, 2014 4:47 AM > To: OpenStack Development Mailing List (not for usage questions) > Subject: Re: [openstack-dev] [wsme] Undefined attributes in WSME > > FWIW, I believe Nova is looking at using JSON Schema as well, since they > need to handle API extensions. This came up during a design session at the > HK summit. Right, the validaiton of Nova v3 API is being implemented with JSON Schema on bp/nova-api-validation-fw[1]. For supporing API extensions, we are proposing the patch which extends API schema based on the loaded API extensions[2]. [1]: https://review.openstack.org/#/q/status:open+project:openstack/nova+branch:master+topic:bp/nova-api-validation-fw,n,z [2]: https://review.openstack.org/#/c/67373/ Thanks Ken'ichi Ohmichi --- > On 1/12/14, 5:33 PM, "Jamie Lennox" wrote: > > >I would prefer not to have keystone using yet another framework from the > >rest of openstack > > > ___ > OpenStack-dev mailing list > OpenStack-dev@lists.openstack.org > http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev ___ OpenStack-dev mailing list OpenStack-dev@lists.openstack.org http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
[openstack-dev] [wsme] Undefined attributes in WSME
Yes, this feature is used in real deployments just as Yuriy described. I really want to avoid a new API version since we're just now getting solidly into V3 being used more extensively. Is it unreasonable to have wsme allow "extra values" in some manner? (I think that is the crux, is it something that can even be expected) --Morgan On Saturday, January 18, 2014, Yuriy Taraday > wrote: > > On Tue, Jan 14, 2014 at 6:09 PM, Doug Hellmann < > doug.hellm...@dreamhost.com> wrote: >> >> On Mon, Jan 13, 2014 at 9:36 PM, Jamie Lennox wrote: >> >>> On Mon, 2014-01-13 at 10:05 -0500, Doug Hellmann wrote: >>> > What requirement(s) led to keystone supporting this feature? >>> >>> I've got no idea where the requirement came from however it is something >>> that is >>> supported now and so not something we can back out of. >>> >> >> If it's truly a requirement, we can look into how to make that work. The >> data is obviously present in the request, so we would just need to preserve >> it. >> > > We've seen a use case for arbitrary attributes in Keystone objects. Cloud > administrator might want to store some metadata along with a user object. > For example, customer name/id and couple additional fields for contact > information. The same might be applied to projects and domains. > > So this is a very nice feature that should be kept around. It might be > wrapped in some way (like in explicit unchecked "metadata" attribute) in a > new API version though. > ___ OpenStack-dev mailing list OpenStack-dev@lists.openstack.org http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
Re: [openstack-dev] [wsme] Undefined attributes in WSME
On Tue, Jan 14, 2014 at 6:09 PM, Doug Hellmann wrote: > > On Mon, Jan 13, 2014 at 9:36 PM, Jamie Lennox wrote: > >> On Mon, 2014-01-13 at 10:05 -0500, Doug Hellmann wrote: >> > What requirement(s) led to keystone supporting this feature? >> >> I've got no idea where the requirement came from however it is something >> that is >> supported now and so not something we can back out of. >> > > If it's truly a requirement, we can look into how to make that work. The > data is obviously present in the request, so we would just need to preserve > it. > We've seen a use case for arbitrary attributes in Keystone objects. Cloud administrator might want to store some metadata along with a user object. For example, customer name/id and couple additional fields for contact information. The same might be applied to projects and domains. So this is a very nice feature that should be kept around. It might be wrapped in some way (like in explicit unchecked "metadata" attribute) in a new API version though. ___ OpenStack-dev mailing list OpenStack-dev@lists.openstack.org http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
Re: [openstack-dev] [wsme] Undefined attributes in WSME
FWIW, I believe Nova is looking at using JSON Schema as well, since they need to handle API extensions. This came up during a design session at the HK summit. On 1/12/14, 5:33 PM, "Jamie Lennox" wrote: >I would prefer not to have keystone using yet another framework from the >rest of openstack ___ OpenStack-dev mailing list OpenStack-dev@lists.openstack.org http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
Re: [openstack-dev] [wsme] Undefined attributes in WSME
Hi Doug, > -Original Message- > From: Doug Hellmann [mailto:doug.hellm...@dreamhost.com] > Sent: Tuesday, January 14, 2014 11:10 PM > To: OpenStack Development Mailing List (not for usage questions) > Subject: Re: [openstack-dev] [wsme] Undefined attributes in WSME > > On Mon, Jan 13, 2014 at 9:52 PM, Kenichi Oomichi > wrote: > > > > Hi Doug, > > > > -Original Message- > > From: Doug Hellmann [mailto:doug.hellm...@dreamhost.com] > > Sent: Tuesday, January 14, 2014 12:07 AM > > To: OpenStack Development Mailing List (not for usage questions) > > Subject: Re: [openstack-dev] [wsme] Undefined attributes in WSME > > > > > > > > > > On Mon, Jan 13, 2014 at 3:29 AM, Ken'ichi Ohmichi > wrote: > > > > > > Hi Doug, > > > > 2014/1/11 Doug Hellmann : > > > > > On Thu, Jan 9, 2014 at 12:02 AM, Jamie Lennox > > > > wrote: > > >> > > >> Is there any way to have WSME pass through arbitrary > attributes to the > > >> created object? There is nothing that i can see in the > documentation or code > > >> that would seem to support this. > > >> > > >> In keystone we have the situation where arbitrary data was > able to be > > >> attached to our resources. For example there are a certain > number of > > >> predefined attributes for a user including name, email but > if you want to > > >> include an address you just add an 'address': 'value' to the > resource > > >> creation and it will be saved and returned to you when you > request the > > >> resource. > > >> > > >> Ignoring whether this is a good idea or not (it's done), is > the option > > >> there that i missed - or is there any plans/way to support > something like > > >> this? > > > > > > > > > There's a change in WSME trunk (I don't think we've released > it yet) that > > > allows the schema for a type to be changed after the class is > defined. There > > > isn't any facility for allowing the caller to pass arbitrary > data, though. > > > Part of the point of WSME is to define the inputs and outputs > of the API for > > > validation. > > > > > > Is there a plan to release new WSME which includes new type > classes? > > I'd like to try applying these classes to Ceilometer after the > release because > > Ceilometer is the best for showing these classes' usage. > > > > > > > > If you mean the feature I mentioned above, we will release it but I > don't think it needs to be used in ceilometer. > We > > designed that API so it doesn't change when plugins are installed. > The feature was added for nova's requirements, > since > > the types of the message payloads aren't known until all of the > extensions are loaded. > > > I guess Ceilometer's BoundedInt can be replaced with wsme's IntegerType > if new version > releases. > > https://github.com/openstack/ceilometer/blob/master/ceilometer/api/controllers/v2.py#L85 > https://github.com/stackforge/wsme/blob/master/wsme/types.py#L146 > > I'm sorry if I misunderstand something. > > No, you're right. How about if we wait until after the I2 milestone, to avoid > potential gate issues from a new library > release during a critical period? That is a good idea, I will try it after I2. Thanks Ken'ichi Ohmichi ___ OpenStack-dev mailing list OpenStack-dev@lists.openstack.org http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
Re: [openstack-dev] [wsme] Undefined attributes in WSME
On Mon, Jan 13, 2014 at 9:52 PM, Kenichi Oomichi wrote: > > Hi Doug, > > > -Original Message- > > From: Doug Hellmann [mailto:doug.hellm...@dreamhost.com] > > Sent: Tuesday, January 14, 2014 12:07 AM > > To: OpenStack Development Mailing List (not for usage questions) > > Subject: Re: [openstack-dev] [wsme] Undefined attributes in WSME > > > > > > > > > > On Mon, Jan 13, 2014 at 3:29 AM, Ken'ichi Ohmichi > wrote: > > > > > > Hi Doug, > > > > 2014/1/11 Doug Hellmann : > > > > > On Thu, Jan 9, 2014 at 12:02 AM, Jamie Lennox < > jamielen...@redhat.com> > > > wrote: > > >> > > >> Is there any way to have WSME pass through arbitrary attributes > to the > > >> created object? There is nothing that i can see in the > documentation or code > > >> that would seem to support this. > > >> > > >> In keystone we have the situation where arbitrary data was able > to be > > >> attached to our resources. For example there are a certain > number of > > >> predefined attributes for a user including name, email but if > you want to > > >> include an address you just add an 'address': 'value' to the > resource > > >> creation and it will be saved and returned to you when you > request the > > >> resource. > > >> > > >> Ignoring whether this is a good idea or not (it's done), is the > option > > >> there that i missed - or is there any plans/way to support > something like > > >> this? > > > > > > > > > There's a change in WSME trunk (I don't think we've released it > yet) that > > > allows the schema for a type to be changed after the class is > defined. There > > > isn't any facility for allowing the caller to pass arbitrary > data, though. > > > Part of the point of WSME is to define the inputs and outputs of > the API for > > > validation. > > > > > > Is there a plan to release new WSME which includes new type > classes? > > I'd like to try applying these classes to Ceilometer after the > release because > > Ceilometer is the best for showing these classes' usage. > > > > > > > > If you mean the feature I mentioned above, we will release it but I > don't think it needs to be used in ceilometer. We > > designed that API so it doesn't change when plugins are installed. The > feature was added for nova's requirements, since > > the types of the message payloads aren't known until all of the > extensions are loaded. > > I guess Ceilometer's BoundedInt can be replaced with wsme's IntegerType if > new version > releases. > > https://github.com/openstack/ceilometer/blob/master/ceilometer/api/controllers/v2.py#L85 > https://github.com/stackforge/wsme/blob/master/wsme/types.py#L146 > > I'm sorry if I misunderstand something. > No, you're right. How about if we wait until after the I2 milestone, to avoid potential gate issues from a new library release during a critical period? Doug > > > Thanks > Ken'ichi Ohmichi > > > ___ > OpenStack-dev mailing list > OpenStack-dev@lists.openstack.org > http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev > ___ OpenStack-dev mailing list OpenStack-dev@lists.openstack.org http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
Re: [openstack-dev] [wsme] Undefined attributes in WSME
On Mon, Jan 13, 2014 at 9:36 PM, Jamie Lennox wrote: > On Mon, 2014-01-13 at 10:05 -0500, Doug Hellmann wrote: > > > > > > > > > > On Sun, Jan 12, 2014 at 6:33 PM, Jamie Lennox > > wrote: > > On Fri, 2014-01-10 at 10:23 -0500, Doug Hellmann wrote: > > > > > > > > > > > > > > > On Thu, Jan 9, 2014 at 12:02 AM, Jamie Lennox > > > > > wrote: > > > Is there any way to have WSME pass through arbitrary > > > attributes to the created object? There is nothing > > that i can > > > see in the documentation or code that would seem to > > support > > > this. > > > > > > In keystone we have the situation where arbitrary > > data was > > > able to be attached to our resources. For example > > there are a > > > certain number of predefined attributes for a user > > including > > > name, email but if you want to include an address > > you just add > > > an 'address': 'value' to the resource creation and > > it will be > > > saved and returned to you when you request the > > resource. > > > > > > Ignoring whether this is a good idea or not (it's > > done), is > > > the option there that i missed - or is there any > > plans/way to > > > support something like this? > > > > > > > > > There's a change in WSME trunk (I don't think we've released > > it yet) > > > that allows the schema for a type to be changed after the > > class is > > > defined. There isn't any facility for allowing the caller to > > pass > > > arbitrary data, though. Part of the point of WSME is to > > define the > > > inputs and outputs of the API for validation. > > > > > > > > > How are the arbitrary values being stored in keystone? What > > sorts of > > > things can be done with them? Can an API caller query them, > > for > > > example? > > > > > > > > > Doug > > > > > > So you can't query based on these arbitrary values but they > > are there as > > part of the resource. We have generic middleware that > > interprets the > > incoming json or xml to python dictionaries. Then we extract > > the > > queryable information for storing into database cells. In the > > case of > > User these are: id, name, password, enabled, domain_id, > > default_project_id. Everything else in the dictionary is > > stored in an > > 'extra' column in the database as a JSON dictionary. When we > > reconstruct > > the User object we recreate the extra dictionary and update it > > with the > > known attributes. > > > > So there is no restriction on types or depth of objects, and > > whilst you > > can't query from those attributes they will always be present > > if you get > > or list the user. > > > > Note that User is probably a bad example in this because of > > LDAP and > > other backends but the idea is the same for all keystone > > resources. > > > > > > So I don't think that changing the WSME type after definition > > is useful > > in this case. Is it the sort of thing that would be possible > > or accepted > > to add to WSME? > > > > From the little bit of looking i've done it appears that WSME > > loops over > > the defined attributes of the class and extracts those from > > the message > > rather than looping over keys in the message which makes this > > more > > difficult. Can WSME be made to decode all values in a purely > > python > > primative way (eg don't decode dates, objects etc, just give > > python > > dictionaries like from a json.loads)? > > > > > > WSME asserts that APIs should be well and clearly defined, so that > > callers of the API can understand what they are supposed to (or > > required to) pass in, and what they will receive as a response. > > Accepting arbitrary data goes somewhat against this design goal. > > > > > > I would prefer not to have keystone using yet another > > framework from the > > rest of openstack, but should i just be looking to use > > jsonschema or > > something instead? > > > > > > What requirement(s) led to keystone supporting this feature? > > I completely agree with you/WSME that this is a bad situation. I've got > no idea where the requirement came from however it is something that is > supported now and so not something we can back
Re: [openstack-dev] [wsme] Undefined attributes in WSME
Hi Doug, > -Original Message- > From: Doug Hellmann [mailto:doug.hellm...@dreamhost.com] > Sent: Tuesday, January 14, 2014 12:07 AM > To: OpenStack Development Mailing List (not for usage questions) > Subject: Re: [openstack-dev] [wsme] Undefined attributes in WSME > > > > > On Mon, Jan 13, 2014 at 3:29 AM, Ken'ichi Ohmichi > wrote: > > > Hi Doug, > > 2014/1/11 Doug Hellmann : > > > On Thu, Jan 9, 2014 at 12:02 AM, Jamie Lennox > > wrote: > >> > >> Is there any way to have WSME pass through arbitrary attributes to > the > >> created object? There is nothing that i can see in the documentation > or code > >> that would seem to support this. > >> > >> In keystone we have the situation where arbitrary data was able to be > >> attached to our resources. For example there are a certain number of > >> predefined attributes for a user including name, email but if you > want to > >> include an address you just add an 'address': 'value' to the resource > >> creation and it will be saved and returned to you when you request > the > >> resource. > >> > >> Ignoring whether this is a good idea or not (it's done), is the > option > >> there that i missed - or is there any plans/way to support something > like > >> this? > > > > > > There's a change in WSME trunk (I don't think we've released it yet) > that > > allows the schema for a type to be changed after the class is > defined. There > > isn't any facility for allowing the caller to pass arbitrary data, > though. > > Part of the point of WSME is to define the inputs and outputs of the > API for > > validation. > > > Is there a plan to release new WSME which includes new type classes? > I'd like to try applying these classes to Ceilometer after the release > because > Ceilometer is the best for showing these classes' usage. > > > > If you mean the feature I mentioned above, we will release it but I don't > think it needs to be used in ceilometer. We > designed that API so it doesn't change when plugins are installed. The > feature was added for nova's requirements, since > the types of the message payloads aren't known until all of the extensions > are loaded. I guess Ceilometer's BoundedInt can be replaced with wsme's IntegerType if new version releases. https://github.com/openstack/ceilometer/blob/master/ceilometer/api/controllers/v2.py#L85 https://github.com/stackforge/wsme/blob/master/wsme/types.py#L146 I'm sorry if I misunderstand something. Thanks Ken'ichi Ohmichi ___ OpenStack-dev mailing list OpenStack-dev@lists.openstack.org http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
Re: [openstack-dev] [wsme] Undefined attributes in WSME
On Mon, 2014-01-13 at 10:05 -0500, Doug Hellmann wrote: > > > > > On Sun, Jan 12, 2014 at 6:33 PM, Jamie Lennox > wrote: > On Fri, 2014-01-10 at 10:23 -0500, Doug Hellmann wrote: > > > > > > > > > > On Thu, Jan 9, 2014 at 12:02 AM, Jamie Lennox > > > wrote: > > Is there any way to have WSME pass through arbitrary > > attributes to the created object? There is nothing > that i can > > see in the documentation or code that would seem to > support > > this. > > > > In keystone we have the situation where arbitrary > data was > > able to be attached to our resources. For example > there are a > > certain number of predefined attributes for a user > including > > name, email but if you want to include an address > you just add > > an 'address': 'value' to the resource creation and > it will be > > saved and returned to you when you request the > resource. > > > > Ignoring whether this is a good idea or not (it's > done), is > > the option there that i missed - or is there any > plans/way to > > support something like this? > > > > > > There's a change in WSME trunk (I don't think we've released > it yet) > > that allows the schema for a type to be changed after the > class is > > defined. There isn't any facility for allowing the caller to > pass > > arbitrary data, though. Part of the point of WSME is to > define the > > inputs and outputs of the API for validation. > > > > > > How are the arbitrary values being stored in keystone? What > sorts of > > things can be done with them? Can an API caller query them, > for > > example? > > > > > > Doug > > > So you can't query based on these arbitrary values but they > are there as > part of the resource. We have generic middleware that > interprets the > incoming json or xml to python dictionaries. Then we extract > the > queryable information for storing into database cells. In the > case of > User these are: id, name, password, enabled, domain_id, > default_project_id. Everything else in the dictionary is > stored in an > 'extra' column in the database as a JSON dictionary. When we > reconstruct > the User object we recreate the extra dictionary and update it > with the > known attributes. > > So there is no restriction on types or depth of objects, and > whilst you > can't query from those attributes they will always be present > if you get > or list the user. > > Note that User is probably a bad example in this because of > LDAP and > other backends but the idea is the same for all keystone > resources. > > > So I don't think that changing the WSME type after definition > is useful > in this case. Is it the sort of thing that would be possible > or accepted > to add to WSME? > > From the little bit of looking i've done it appears that WSME > loops over > the defined attributes of the class and extracts those from > the message > rather than looping over keys in the message which makes this > more > difficult. Can WSME be made to decode all values in a purely > python > primative way (eg don't decode dates, objects etc, just give > python > dictionaries like from a json.loads)? > > > WSME asserts that APIs should be well and clearly defined, so that > callers of the API can understand what they are supposed to (or > required to) pass in, and what they will receive as a response. > Accepting arbitrary data goes somewhat against this design goal. > > > I would prefer not to have keystone using yet another > framework from the > rest of openstack, but should i just be looking to use > jsonschema or > something instead? > > > What requirement(s) led to keystone supporting this feature? I completely agree with you/WSME that this is a bad situation. I've got no idea where the requirement came from however it is something that is supported now and so not something we can back out of. I don't think WSME should advocate the situation, though it will already ignore additional attributes i'm wondering what would be involved with just collecting and stashing those additional attributes? > Doug > > > >
Re: [openstack-dev] [wsme] Undefined attributes in WSME
On Mon, Jan 13, 2014 at 3:29 AM, Ken'ichi Ohmichi wrote: > Hi Doug, > > 2014/1/11 Doug Hellmann : > > On Thu, Jan 9, 2014 at 12:02 AM, Jamie Lennox > > wrote: > >> > >> Is there any way to have WSME pass through arbitrary attributes to the > >> created object? There is nothing that i can see in the documentation or > code > >> that would seem to support this. > >> > >> In keystone we have the situation where arbitrary data was able to be > >> attached to our resources. For example there are a certain number of > >> predefined attributes for a user including name, email but if you want > to > >> include an address you just add an 'address': 'value' to the resource > >> creation and it will be saved and returned to you when you request the > >> resource. > >> > >> Ignoring whether this is a good idea or not (it's done), is the option > >> there that i missed - or is there any plans/way to support something > like > >> this? > > > > > > There's a change in WSME trunk (I don't think we've released it yet) that > > allows the schema for a type to be changed after the class is defined. > There > > isn't any facility for allowing the caller to pass arbitrary data, > though. > > Part of the point of WSME is to define the inputs and outputs of the API > for > > validation. > > Is there a plan to release new WSME which includes new type classes? > I'd like to try applying these classes to Ceilometer after the release > because > Ceilometer is the best for showing these classes' usage. > If you mean the feature I mentioned above, we will release it but I don't think it needs to be used in ceilometer. We designed that API so it doesn't change when plugins are installed. The feature was added for nova's requirements, since the types of the message payloads aren't known until all of the extensions are loaded. Doug > > > Thanks > Ken'ichi Ohmichi > > ___ > OpenStack-dev mailing list > OpenStack-dev@lists.openstack.org > http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev > ___ OpenStack-dev mailing list OpenStack-dev@lists.openstack.org http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
Re: [openstack-dev] [wsme] Undefined attributes in WSME
On Sun, Jan 12, 2014 at 6:33 PM, Jamie Lennox wrote: > On Fri, 2014-01-10 at 10:23 -0500, Doug Hellmann wrote: > > > > > > > > > > On Thu, Jan 9, 2014 at 12:02 AM, Jamie Lennox > > wrote: > > Is there any way to have WSME pass through arbitrary > > attributes to the created object? There is nothing that i can > > see in the documentation or code that would seem to support > > this. > > > > In keystone we have the situation where arbitrary data was > > able to be attached to our resources. For example there are a > > certain number of predefined attributes for a user including > > name, email but if you want to include an address you just add > > an 'address': 'value' to the resource creation and it will be > > saved and returned to you when you request the resource. > > > > Ignoring whether this is a good idea or not (it's done), is > > the option there that i missed - or is there any plans/way to > > support something like this? > > > > > > There's a change in WSME trunk (I don't think we've released it yet) > > that allows the schema for a type to be changed after the class is > > defined. There isn't any facility for allowing the caller to pass > > arbitrary data, though. Part of the point of WSME is to define the > > inputs and outputs of the API for validation. > > > > > > How are the arbitrary values being stored in keystone? What sorts of > > things can be done with them? Can an API caller query them, for > > example? > > > > > > Doug > > So you can't query based on these arbitrary values but they are there as > part of the resource. We have generic middleware that interprets the > incoming json or xml to python dictionaries. Then we extract the > queryable information for storing into database cells. In the case of > User these are: id, name, password, enabled, domain_id, > default_project_id. Everything else in the dictionary is stored in an > 'extra' column in the database as a JSON dictionary. When we reconstruct > the User object we recreate the extra dictionary and update it with the > known attributes. > > So there is no restriction on types or depth of objects, and whilst you > can't query from those attributes they will always be present if you get > or list the user. > > Note that User is probably a bad example in this because of LDAP and > other backends but the idea is the same for all keystone resources. > > > So I don't think that changing the WSME type after definition is useful > in this case. Is it the sort of thing that would be possible or accepted > to add to WSME? > > From the little bit of looking i've done it appears that WSME loops over > the defined attributes of the class and extracts those from the message > rather than looping over keys in the message which makes this more > difficult. Can WSME be made to decode all values in a purely python > primative way (eg don't decode dates, objects etc, just give python > dictionaries like from a json.loads)? > WSME asserts that APIs should be well and clearly defined, so that callers of the API can understand what they are supposed to (or required to) pass in, and what they will receive as a response. Accepting arbitrary data goes somewhat against this design goal. I would prefer not to have keystone using yet another framework from the > rest of openstack, but should i just be looking to use jsonschema or > something instead? > What requirement(s) led to keystone supporting this feature? Doug > > Jamie > > > > > > > > > Thanks, > > > > Jamie > > > > ___ > > OpenStack-dev mailing list > > OpenStack-dev@lists.openstack.org > > > http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev > > > > > > ___ > > OpenStack-dev mailing list > > OpenStack-dev@lists.openstack.org > > http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev > > > > > ___ > OpenStack-dev mailing list > OpenStack-dev@lists.openstack.org > http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev > ___ OpenStack-dev mailing list OpenStack-dev@lists.openstack.org http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
Re: [openstack-dev] [wsme] Undefined attributes in WSME
Hi Doug, 2014/1/11 Doug Hellmann : > On Thu, Jan 9, 2014 at 12:02 AM, Jamie Lennox > wrote: >> >> Is there any way to have WSME pass through arbitrary attributes to the >> created object? There is nothing that i can see in the documentation or code >> that would seem to support this. >> >> In keystone we have the situation where arbitrary data was able to be >> attached to our resources. For example there are a certain number of >> predefined attributes for a user including name, email but if you want to >> include an address you just add an 'address': 'value' to the resource >> creation and it will be saved and returned to you when you request the >> resource. >> >> Ignoring whether this is a good idea or not (it's done), is the option >> there that i missed - or is there any plans/way to support something like >> this? > > > There's a change in WSME trunk (I don't think we've released it yet) that > allows the schema for a type to be changed after the class is defined. There > isn't any facility for allowing the caller to pass arbitrary data, though. > Part of the point of WSME is to define the inputs and outputs of the API for > validation. Is there a plan to release new WSME which includes new type classes? I'd like to try applying these classes to Ceilometer after the release because Ceilometer is the best for showing these classes' usage. Thanks Ken'ichi Ohmichi ___ OpenStack-dev mailing list OpenStack-dev@lists.openstack.org http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
Re: [openstack-dev] [wsme] Undefined attributes in WSME
On Fri, 2014-01-10 at 10:23 -0500, Doug Hellmann wrote: > > > > > On Thu, Jan 9, 2014 at 12:02 AM, Jamie Lennox > wrote: > Is there any way to have WSME pass through arbitrary > attributes to the created object? There is nothing that i can > see in the documentation or code that would seem to support > this. > > In keystone we have the situation where arbitrary data was > able to be attached to our resources. For example there are a > certain number of predefined attributes for a user including > name, email but if you want to include an address you just add > an 'address': 'value' to the resource creation and it will be > saved and returned to you when you request the resource. > > Ignoring whether this is a good idea or not (it's done), is > the option there that i missed - or is there any plans/way to > support something like this? > > > There's a change in WSME trunk (I don't think we've released it yet) > that allows the schema for a type to be changed after the class is > defined. There isn't any facility for allowing the caller to pass > arbitrary data, though. Part of the point of WSME is to define the > inputs and outputs of the API for validation. > > > How are the arbitrary values being stored in keystone? What sorts of > things can be done with them? Can an API caller query them, for > example? > > > Doug So you can't query based on these arbitrary values but they are there as part of the resource. We have generic middleware that interprets the incoming json or xml to python dictionaries. Then we extract the queryable information for storing into database cells. In the case of User these are: id, name, password, enabled, domain_id, default_project_id. Everything else in the dictionary is stored in an 'extra' column in the database as a JSON dictionary. When we reconstruct the User object we recreate the extra dictionary and update it with the known attributes. So there is no restriction on types or depth of objects, and whilst you can't query from those attributes they will always be present if you get or list the user. Note that User is probably a bad example in this because of LDAP and other backends but the idea is the same for all keystone resources. So I don't think that changing the WSME type after definition is useful in this case. Is it the sort of thing that would be possible or accepted to add to WSME? >From the little bit of looking i've done it appears that WSME loops over the defined attributes of the class and extracts those from the message rather than looping over keys in the message which makes this more difficult. Can WSME be made to decode all values in a purely python primative way (eg don't decode dates, objects etc, just give python dictionaries like from a json.loads)? I would prefer not to have keystone using yet another framework from the rest of openstack, but should i just be looking to use jsonschema or something instead? Jamie > > > > Thanks, > > Jamie > > ___ > OpenStack-dev mailing list > OpenStack-dev@lists.openstack.org > http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev > > > ___ > OpenStack-dev mailing list > OpenStack-dev@lists.openstack.org > http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev ___ OpenStack-dev mailing list OpenStack-dev@lists.openstack.org http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
Re: [openstack-dev] [wsme] Undefined attributes in WSME
On Thu, Jan 9, 2014 at 12:02 AM, Jamie Lennox wrote: > Is there any way to have WSME pass through arbitrary attributes to the > created object? There is nothing that i can see in the documentation or > code that would seem to support this. > > In keystone we have the situation where arbitrary data was able to be > attached to our resources. For example there are a certain number of > predefined attributes for a user including name, email but if you want to > include an address you just add an 'address': 'value' to the resource > creation and it will be saved and returned to you when you request the > resource. > > Ignoring whether this is a good idea or not (it's done), is the option > there that i missed - or is there any plans/way to support something like > this? > There's a change in WSME trunk (I don't think we've released it yet) that allows the schema for a type to be changed after the class is defined. There isn't any facility for allowing the caller to pass arbitrary data, though. Part of the point of WSME is to define the inputs and outputs of the API for validation. How are the arbitrary values being stored in keystone? What sorts of things can be done with them? Can an API caller query them, for example? Doug > > Thanks, > > Jamie > > ___ > OpenStack-dev mailing list > OpenStack-dev@lists.openstack.org > http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev > ___ OpenStack-dev mailing list OpenStack-dev@lists.openstack.org http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
Re: [openstack-dev] [wsme] Undefined attributes in WSME
On Thu, 2014-01-09 at 11:16 +0100, Julien Danjou wrote: > On Thu, Jan 09 2014, Jamie Lennox wrote: > > > Is there any way to have WSME pass through arbitrary attributes to the > > created object? There is nothing that i can see in the documentation or code > > that would seem to support this. > > > > In keystone we have the situation where arbitrary data was able to be > > attached to our resources. For example there are a certain number of > > predefined attributes for a user including name, email but if you want to > > include an address you just add an 'address': 'value' to the resource > > creation and it will be saved and returned to you when you request the > > resource. > > > > Ignoring whether this is a good idea or not (it's done), is the option there > > that i missed - or is there any plans/way to support something like this? > > You can use something like: > > class Resource(object): > metadata = {wtypes.text: wtypes.text} > > Would that solve your problem? > That would still only give me 1 level and i would then have to manually parse out the arguments i was expecting. Continuing the example there is nothing in the current implementation stopping people from using {'address': {'street': '..', 'country': '..'}} So we can't just have the flat dictionary. (and i think wsme would fail if someone passed an integer value for example). What i'm kind of hoping for is some sort of remainder value in wsme such that i could define my base types: class User(object): id = wtypes.text email = wtypes.text and later have a user: >>> user.id '9da353d02c0546ab9b3b402f58c6ab0d' >>> user.email 'user@provider' >>> user.remainder {'address': {'country': '..', 'street': '..'}} now i'm obviously not expecting exactly that - but hoping for some kind of catch all that i can use. Thanks, Jamie ___ OpenStack-dev mailing list OpenStack-dev@lists.openstack.org http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
Re: [openstack-dev] [wsme] Undefined attributes in WSME
On Thu, Jan 09 2014, Jamie Lennox wrote: > Is there any way to have WSME pass through arbitrary attributes to the > created object? There is nothing that i can see in the documentation or code > that would seem to support this. > > In keystone we have the situation where arbitrary data was able to be > attached to our resources. For example there are a certain number of > predefined attributes for a user including name, email but if you want to > include an address you just add an 'address': 'value' to the resource > creation and it will be saved and returned to you when you request the > resource. > > Ignoring whether this is a good idea or not (it's done), is the option there > that i missed - or is there any plans/way to support something like this? You can use something like: class Resource(object): metadata = {wtypes.text: wtypes.text} Would that solve your problem? -- Julien Danjou ;; Free Software hacker ; independent consultant ;; http://julien.danjou.info signature.asc Description: PGP signature ___ OpenStack-dev mailing list OpenStack-dev@lists.openstack.org http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
[openstack-dev] [wsme] Undefined attributes in WSME
Is there any way to have WSME pass through arbitrary attributes to the created object? There is nothing that i can see in the documentation or code that would seem to support this. In keystone we have the situation where arbitrary data was able to be attached to our resources. For example there are a certain number of predefined attributes for a user including name, email but if you want to include an address you just add an 'address': 'value' to the resource creation and it will be saved and returned to you when you request the resource. Ignoring whether this is a good idea or not (it's done), is the option there that i missed - or is there any plans/way to support something like this? Thanks, Jamie ___ OpenStack-dev mailing list OpenStack-dev@lists.openstack.org http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev