You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openwhisk.apache.org by Rodric Rabbah <ro...@gmail.com> on 2017/01/12 22:44:32 UTC
Allow actions to be accessible from a web browser
I just opened a pull request to allow actions to be accessible viaa web
browser. Action invokes this way are anonymous in that the caller is not
authenticated. The intended action must be named in the path as a fully
qualified name as in
/experimental/web/some-namespace/some-package/some-action. The package is
optional in that the action may be in the default package. In which case,
the string "default" must be used.
If the action doesn't exist (or the namespace is not valid) a BadRequest is
generated. Optionally, the result form the action may be projected based on
a named property. As in
/experimental/web/some-namespace/some-package/some-action/some-property. If
the property
does not exist in the result then a BadRequest is generated. By convention,
the "html" property will attempt to respond with media type "text/html".
Actions may be exposed to this web proxy by adding an annotation ("export"
-> true).
Demo video https://ibm.box.com/s/5c6ignvejihbai3f59uvqcxee9etf0lf.
Feedback solicited and welcomed.
-r
Re: Allow actions to be accessible from a web browser
Posted by Felix Meschberger <fm...@adobe.com>.
Hi
Sounds like a great idea … and I really like the demo video !
As for the status codes, I would probably prefer 404/Not Found for non-existing actions rather than 400/Bad Request. And 404 as well for the case of the action not being available anonymously.
And concluding from the demo by „projecting based on a named property“ you mean the property really indicates the Content-Type to represent the resource as ? Have you considered using the an extension in the action such as …/my-action.html ? Missing support for the requested content type could be 406/Not Acceptable (or also 404/Not Found).
Regards
Felix
> Am 12.01.2017 um 23:44 schrieb Rodric Rabbah <ro...@gmail.com>:
>
> I just opened a pull request to allow actions to be accessible viaa web
> browser. Action invokes this way are anonymous in that the caller is not
> authenticated. The intended action must be named in the path as a fully
> qualified name as in
> /experimental/web/some-namespace/some-package/some-action. The package is
> optional in that the action may be in the default package. In which case,
> the string "default" must be used.
>
> If the action doesn't exist (or the namespace is not valid) a BadRequest is
> generated. Optionally, the result form the action may be projected based on
> a named property. As in
> /experimental/web/some-namespace/some-package/some-action/some-property. If
> the property
> does not exist in the result then a BadRequest is generated. By convention,
> the "html" property will attempt to respond with media type "text/html".
>
> Actions may be exposed to this web proxy by adding an annotation ("export"
> -> true).
> Demo video https://ibm.box.com/s/5c6ignvejihbai3f59uvqcxee9etf0lf.
>
> Feedback solicited and welcomed.
>
> -r
Re: Allow actions to be accessible from a web browser
Posted by Rodric Rabbah <ro...@gmail.com>.
> Are query parameters forwarded to the action as well?
Yes. They are the invoke time parameters for the action.
-r
Re: Allow actions to be accessible from a web browser
Posted by Felix Meschberger <fm...@adobe.com>.
Hi Rodric
Am 13.01.2017 um 18:07 schrieb Rodric Rabbah <ro...@gmail.com>>:
you mean the property really indicates the Content-Type to represent the
resource as ? Have you considered using the an extension in the action such
as …/my-action.html ?
I had not. Do you mean an extension to describe both the content type and
the field to project? There are two parts to this from the demo (and what I
implemented):
1: projecting a field from the JSON object that is the result of the
action.
2: how to marshal the projected value
So I conflated both: the property name implies also a convention for the
marshaling. So using html reads response.html and turns it into the proper
format.
Yeah, that is problematic and limiting indeed. As the property to represent and the format to represent it in are orthogonal issues and thus cannot possibly be conflated unless you come up with a complex encoding.
Your suggestion I think makes it possible to disentangle the desired
content-type and the property name to project. It could also then make it
possible to do what Nick alluded to: rather than projecting one property,
the resource could be specified as a full path (of nested properties). As
in:
http://openwhisk.host/experimental/web/ns/p/action.html/a/b/c.
One issue with using "." as the separator is that it's also a legal
character for action names. So a different delimiter would be needed
otherwise the path parsing is ambiguous.
I like that. And incidnentally (or not, maybe, probably) this is exactly how we disect URL paths in Apache Sling: See URL Decomposition [1]
This also solves the „action is allowed to contain a dot“ problem.
Regards
Felix
[1] http://sling.apache.org/documentation/the-sling-engine/url-decomposition.html
Re: Allow actions to be accessible from a web browser
Posted by Rodric Rabbah <ro...@gmail.com>.
I amended the pull request adopting all suggestions from Felix and Steve. Thanks for the input.
-r
Re: Allow actions to be accessible from a web browser
Posted by Stephen Fink <fi...@gmail.com>.
Another possibility: we could mandate that for web access, the URI must always end with a file extension type, and so the last dot would be unambiguous.
So you would never access http:/…/myaction
You could only access http:/…./myaction.js , http:/…./myaction.txt, http:/…../myaction.svg, etc. The .js extension would be the default (or .json … I think I prefer .js)
> On Jan 13, 2017, at 2:44 PM, Rodric Rabbah <ro...@gmail.com> wrote:
>
> More on this:
>> One issue with using "." as the separator is that it's also a legal
> character for action names.
>
> We could mandate that if an extension is present it is a content-type and
> not an action name. Hence if the action is called "myaction.html" and to
> turn the response into "text/html" then the resource is
> ".../myaction.html.html/some-field". In the absence of an extension, the
> default is JSON.
>
> Felix I amended the pr with your suggestions to track progress.
>
> -r
Re: Allow actions to be accessible from a web browser
Posted by Rodric Rabbah <ro...@gmail.com>.
More on this:
> One issue with using "." as the separator is that it's also a legal
character for action names.
We could mandate that if an extension is present it is a content-type and
not an action name. Hence if the action is called "myaction.html" and to
turn the response into "text/html" then the resource is
".../myaction.html.html/some-field". In the absence of an extension, the
default is JSON.
Felix I amended the pr with your suggestions to track progress.
-r
Re: Allow actions to be accessible from a web browser
Posted by Rodric Rabbah <ro...@gmail.com>.
> you mean the property really indicates the Content-Type to represent the
resource as ? Have you considered using the an extension in the action such
as …/my-action.html ?
I had not. Do you mean an extension to describe both the content type and
the field to project? There are two parts to this from the demo (and what I
implemented):
1: projecting a field from the JSON object that is the result of the
action.
2: how to marshal the projected value
So I conflated both: the property name implies also a convention for the
marshaling. So using html reads response.html and turns it into the proper
format.
Your suggestion I think makes it possible to disentangle the desired
content-type and the property name to project. It could also then make it
possible to do what Nick alluded to: rather than projecting one property,
the resource could be specified as a full path (of nested properties). As
in:
http://openwhisk.host/experimental/web/ns/p/action.html/a/b/c.
One issue with using "." as the separator is that it's also a legal
character for action names. So a different delimiter would be needed
otherwise the path parsing is ambiguous.
-r
Re: Allow actions to be accessible from a web browser
Posted by Nick Mitchell <mo...@gmail.com>.
>
> where do you get random-ish hashes today? you mean the api gw integration?
yes, as an example. the bluemix api gateway introduces an extra level of
management. if component C1 exports an action, then, to import that
endpoint into component C2 (e.g. my web front end) C1's deployment needs to
store its endpoint routes in some sort of registry, so that C2's deployment
can point to the right place.
with the proposed "web" approach, templatization is straightforward:
https://{APIHOST}/{NAMESPACE}/experimental/web/actions/foo
thus, C2 doesn't need any explicit dependence on C1's deployment step.
rather, as an overall deployment of the application, i know the values of
those two variables (e.g. i'm deploying to the London-Production routes),
which breaks the C1-C2 dependence.
On Fri, Jan 13, 2017 at 2:54 AM, Michael M Behrendt <
Michaelbehrendt@de.ibm.com> wrote:
> > i like that this gives me a stable/predictable route, so that i don't
> have
> to keep around a registry of endpoints in my deployment scripts -- as i
> would if the routes were exposed with a random-ish hash in them.
>
> where do you get random-ish hashes today? you mean the api gw integration?
> If so, I agree that is sub-optimal and should be addressed there as well.
>
>
>
>
> From: Nick Mitchell <mo...@gmail.com>
> To: dev@openwhisk.apache.org
> Date: 01/13/2017 12:21 AM
> Subject: Re: Allow actions to be accessible from a web browser
>
>
>
> i like that this gives me a stable/predictable route, so that i don't have
> to keep around a registry of endpoints in my deployment scripts -- as i
> would if the routes were exposed with a random-ish hash in them.
>
> and i like the idea of a simple way of supporting client applications that
> doesn't require an extra step in deployment scripts. i.e. i just tack a
> `-a
> export true` on to the create/update steps.
>
> i also like the ability to do simple projections, thus avoiding the need
> for `jq` postprocessing. if i project a field, do i also have to type it,
> e.g. /field/x/int? or are the mime types only needed when you want to
> force
> a non-default interpretation?
>
> using mime types to request a particular response header is pretty
> awesome!
> though perhaps its use may be somewhat constrained (until we have
> streaming?) by any payload limitations a whisk installation might have in
> place.
>
> On Thu, Jan 12, 2017 at 5:51 PM, Markus Thömmes <ma...@me.com>
> wrote:
>
> > Haven't looked at the implementation yet but I really dig the idea!
> >
> > Are query parameters forwarded to the action as well?
> >
> > - mt
> >
> > Von meinem iPhone gesendet
> >
> > > Am 12.01.2017 um 23:44 schrieb Rodric Rabbah <ro...@gmail.com>:
> > >
> > > I just opened a pull request to allow actions to be accessible viaa
> web
> > > browser. Action invokes this way are anonymous in that the caller is
> not
> > > authenticated. The intended action must be named in the path as a
> fully
> > > qualified name as in
> > > /experimental/web/some-namespace/some-package/some-action. The package
> > is
> > > optional in that the action may be in the default package. In which
> case,
> > > the string "default" must be used.
> > >
> > > If the action doesn't exist (or the namespace is not valid) a
> BadRequest
> > is
> > > generated. Optionally, the result form the action may be projected
> based
> > on
> > > a named property. As in
> > >
> /experimental/web/some-namespace/some-package/some-action/some-property.
> > If
> > > the property
> > > does not exist in the result then a BadRequest is generated. By
> > convention,
> > > the "html" property will attempt to respond with media type
> "text/html".
> > >
> > > Actions may be exposed to this web proxy by adding an annotation
> > ("export"
> > > -> true).
> > > Demo video https://ibm.box.com/s/5c6ignvejihbai3f59uvqcxee9etf0lf.
> > >
> > > Feedback solicited and welcomed.
> > >
> > > -r
> >
>
>
>
>
>
Re: Allow actions to be accessible from a web browser
Posted by Jeremias Werner <je...@gmail.com>.
sorry, I meant anonymous (not asynchronous)
On Fri, Jan 13, 2017 at 9:38 AM, Jeremias Werner <je...@gmail.com>
wrote:
> Hi,
>
> nice idea. you said, the activations are invoked asynchronous. how does
> throttling work for those?
>
> - jeremias
>
> On Fri, Jan 13, 2017 at 8:54 AM, Michael M Behrendt <
> Michaelbehrendt@de.ibm.com> wrote:
>
>> > i like that this gives me a stable/predictable route, so that i don't
>> have
>> to keep around a registry of endpoints in my deployment scripts -- as i
>> would if the routes were exposed with a random-ish hash in them.
>>
>> where do you get random-ish hashes today? you mean the api gw integration?
>> If so, I agree that is sub-optimal and should be addressed there as well.
>>
>>
>>
>>
>> From: Nick Mitchell <mo...@gmail.com>
>> To: dev@openwhisk.apache.org
>> Date: 01/13/2017 12:21 AM
>> Subject: Re: Allow actions to be accessible from a web browser
>>
>>
>>
>> i like that this gives me a stable/predictable route, so that i don't have
>> to keep around a registry of endpoints in my deployment scripts -- as i
>> would if the routes were exposed with a random-ish hash in them.
>>
>> and i like the idea of a simple way of supporting client applications that
>> doesn't require an extra step in deployment scripts. i.e. i just tack a
>> `-a
>> export true` on to the create/update steps.
>>
>> i also like the ability to do simple projections, thus avoiding the need
>> for `jq` postprocessing. if i project a field, do i also have to type it,
>> e.g. /field/x/int? or are the mime types only needed when you want to
>> force
>> a non-default interpretation?
>>
>> using mime types to request a particular response header is pretty
>> awesome!
>> though perhaps its use may be somewhat constrained (until we have
>> streaming?) by any payload limitations a whisk installation might have in
>> place.
>>
>> On Thu, Jan 12, 2017 at 5:51 PM, Markus Thömmes <ma...@me.com>
>> wrote:
>>
>> > Haven't looked at the implementation yet but I really dig the idea!
>> >
>> > Are query parameters forwarded to the action as well?
>> >
>> > - mt
>> >
>> > Von meinem iPhone gesendet
>> >
>> > > Am 12.01.2017 um 23:44 schrieb Rodric Rabbah <ro...@gmail.com>:
>> > >
>> > > I just opened a pull request to allow actions to be accessible viaa
>> web
>> > > browser. Action invokes this way are anonymous in that the caller is
>> not
>> > > authenticated. The intended action must be named in the path as a
>> fully
>> > > qualified name as in
>> > > /experimental/web/some-namespace/some-package/some-action. The
>> package
>> > is
>> > > optional in that the action may be in the default package. In which
>> case,
>> > > the string "default" must be used.
>> > >
>> > > If the action doesn't exist (or the namespace is not valid) a
>> BadRequest
>> > is
>> > > generated. Optionally, the result form the action may be projected
>> based
>> > on
>> > > a named property. As in
>> > >
>> /experimental/web/some-namespace/some-package/some-action/some-property.
>> > If
>> > > the property
>> > > does not exist in the result then a BadRequest is generated. By
>> > convention,
>> > > the "html" property will attempt to respond with media type
>> "text/html".
>> > >
>> > > Actions may be exposed to this web proxy by adding an annotation
>> > ("export"
>> > > -> true).
>> > > Demo video https://ibm.box.com/s/5c6ignvejihbai3f59uvqcxee9etf0lf.
>> > >
>> > > Feedback solicited and welcomed.
>> > >
>> > > -r
>> >
>>
>>
>>
>>
>>
>
Re: Allow actions to be accessible from a web browser
Posted by Jeremias Werner <je...@gmail.com>.
Hi,
nice idea. you said, the activations are invoked asynchronous. how does
throttling work for those?
- jeremias
On Fri, Jan 13, 2017 at 8:54 AM, Michael M Behrendt <
Michaelbehrendt@de.ibm.com> wrote:
> > i like that this gives me a stable/predictable route, so that i don't
> have
> to keep around a registry of endpoints in my deployment scripts -- as i
> would if the routes were exposed with a random-ish hash in them.
>
> where do you get random-ish hashes today? you mean the api gw integration?
> If so, I agree that is sub-optimal and should be addressed there as well.
>
>
>
>
> From: Nick Mitchell <mo...@gmail.com>
> To: dev@openwhisk.apache.org
> Date: 01/13/2017 12:21 AM
> Subject: Re: Allow actions to be accessible from a web browser
>
>
>
> i like that this gives me a stable/predictable route, so that i don't have
> to keep around a registry of endpoints in my deployment scripts -- as i
> would if the routes were exposed with a random-ish hash in them.
>
> and i like the idea of a simple way of supporting client applications that
> doesn't require an extra step in deployment scripts. i.e. i just tack a
> `-a
> export true` on to the create/update steps.
>
> i also like the ability to do simple projections, thus avoiding the need
> for `jq` postprocessing. if i project a field, do i also have to type it,
> e.g. /field/x/int? or are the mime types only needed when you want to
> force
> a non-default interpretation?
>
> using mime types to request a particular response header is pretty
> awesome!
> though perhaps its use may be somewhat constrained (until we have
> streaming?) by any payload limitations a whisk installation might have in
> place.
>
> On Thu, Jan 12, 2017 at 5:51 PM, Markus Thömmes <ma...@me.com>
> wrote:
>
> > Haven't looked at the implementation yet but I really dig the idea!
> >
> > Are query parameters forwarded to the action as well?
> >
> > - mt
> >
> > Von meinem iPhone gesendet
> >
> > > Am 12.01.2017 um 23:44 schrieb Rodric Rabbah <ro...@gmail.com>:
> > >
> > > I just opened a pull request to allow actions to be accessible viaa
> web
> > > browser. Action invokes this way are anonymous in that the caller is
> not
> > > authenticated. The intended action must be named in the path as a
> fully
> > > qualified name as in
> > > /experimental/web/some-namespace/some-package/some-action. The package
> > is
> > > optional in that the action may be in the default package. In which
> case,
> > > the string "default" must be used.
> > >
> > > If the action doesn't exist (or the namespace is not valid) a
> BadRequest
> > is
> > > generated. Optionally, the result form the action may be projected
> based
> > on
> > > a named property. As in
> > >
> /experimental/web/some-namespace/some-package/some-action/some-property.
> > If
> > > the property
> > > does not exist in the result then a BadRequest is generated. By
> > convention,
> > > the "html" property will attempt to respond with media type
> "text/html".
> > >
> > > Actions may be exposed to this web proxy by adding an annotation
> > ("export"
> > > -> true).
> > > Demo video https://ibm.box.com/s/5c6ignvejihbai3f59uvqcxee9etf0lf.
> > >
> > > Feedback solicited and welcomed.
> > >
> > > -r
> >
>
>
>
>
>
Re: Allow actions to be accessible from a web browser
Posted by Michael M Behrendt <Mi...@de.ibm.com>.
> i like that this gives me a stable/predictable route, so that i don't
have
to keep around a registry of endpoints in my deployment scripts -- as i
would if the routes were exposed with a random-ish hash in them.
where do you get random-ish hashes today? you mean the api gw integration?
If so, I agree that is sub-optimal and should be addressed there as well.
From: Nick Mitchell <mo...@gmail.com>
To: dev@openwhisk.apache.org
Date: 01/13/2017 12:21 AM
Subject: Re: Allow actions to be accessible from a web browser
i like that this gives me a stable/predictable route, so that i don't have
to keep around a registry of endpoints in my deployment scripts -- as i
would if the routes were exposed with a random-ish hash in them.
and i like the idea of a simple way of supporting client applications that
doesn't require an extra step in deployment scripts. i.e. i just tack a
`-a
export true` on to the create/update steps.
i also like the ability to do simple projections, thus avoiding the need
for `jq` postprocessing. if i project a field, do i also have to type it,
e.g. /field/x/int? or are the mime types only needed when you want to
force
a non-default interpretation?
using mime types to request a particular response header is pretty
awesome!
though perhaps its use may be somewhat constrained (until we have
streaming?) by any payload limitations a whisk installation might have in
place.
On Thu, Jan 12, 2017 at 5:51 PM, Markus Thömmes <ma...@me.com>
wrote:
> Haven't looked at the implementation yet but I really dig the idea!
>
> Are query parameters forwarded to the action as well?
>
> - mt
>
> Von meinem iPhone gesendet
>
> > Am 12.01.2017 um 23:44 schrieb Rodric Rabbah <ro...@gmail.com>:
> >
> > I just opened a pull request to allow actions to be accessible viaa
web
> > browser. Action invokes this way are anonymous in that the caller is
not
> > authenticated. The intended action must be named in the path as a
fully
> > qualified name as in
> > /experimental/web/some-namespace/some-package/some-action. The package
> is
> > optional in that the action may be in the default package. In which
case,
> > the string "default" must be used.
> >
> > If the action doesn't exist (or the namespace is not valid) a
BadRequest
> is
> > generated. Optionally, the result form the action may be projected
based
> on
> > a named property. As in
> >
/experimental/web/some-namespace/some-package/some-action/some-property.
> If
> > the property
> > does not exist in the result then a BadRequest is generated. By
> convention,
> > the "html" property will attempt to respond with media type
"text/html".
> >
> > Actions may be exposed to this web proxy by adding an annotation
> ("export"
> > -> true).
> > Demo video https://ibm.box.com/s/5c6ignvejihbai3f59uvqcxee9etf0lf.
> >
> > Feedback solicited and welcomed.
> >
> > -r
>
Re: Allow actions to be accessible from a web browser
Posted by Nick Mitchell <mo...@gmail.com>.
i like that this gives me a stable/predictable route, so that i don't have
to keep around a registry of endpoints in my deployment scripts -- as i
would if the routes were exposed with a random-ish hash in them.
and i like the idea of a simple way of supporting client applications that
doesn't require an extra step in deployment scripts. i.e. i just tack a `-a
export true` on to the create/update steps.
i also like the ability to do simple projections, thus avoiding the need
for `jq` postprocessing. if i project a field, do i also have to type it,
e.g. /field/x/int? or are the mime types only needed when you want to force
a non-default interpretation?
using mime types to request a particular response header is pretty awesome!
though perhaps its use may be somewhat constrained (until we have
streaming?) by any payload limitations a whisk installation might have in
place.
On Thu, Jan 12, 2017 at 5:51 PM, Markus Thömmes <ma...@me.com>
wrote:
> Haven't looked at the implementation yet but I really dig the idea!
>
> Are query parameters forwarded to the action as well?
>
> - mt
>
> Von meinem iPhone gesendet
>
> > Am 12.01.2017 um 23:44 schrieb Rodric Rabbah <ro...@gmail.com>:
> >
> > I just opened a pull request to allow actions to be accessible viaa web
> > browser. Action invokes this way are anonymous in that the caller is not
> > authenticated. The intended action must be named in the path as a fully
> > qualified name as in
> > /experimental/web/some-namespace/some-package/some-action. The package
> is
> > optional in that the action may be in the default package. In which case,
> > the string "default" must be used.
> >
> > If the action doesn't exist (or the namespace is not valid) a BadRequest
> is
> > generated. Optionally, the result form the action may be projected based
> on
> > a named property. As in
> > /experimental/web/some-namespace/some-package/some-action/some-property.
> If
> > the property
> > does not exist in the result then a BadRequest is generated. By
> convention,
> > the "html" property will attempt to respond with media type "text/html".
> >
> > Actions may be exposed to this web proxy by adding an annotation
> ("export"
> > -> true).
> > Demo video https://ibm.box.com/s/5c6ignvejihbai3f59uvqcxee9etf0lf.
> >
> > Feedback solicited and welcomed.
> >
> > -r
>
Re: Allow actions to be accessible from a web browser
Posted by Markus Thömmes <ma...@me.com>.
Haven't looked at the implementation yet but I really dig the idea!
Are query parameters forwarded to the action as well?
- mt
Von meinem iPhone gesendet
> Am 12.01.2017 um 23:44 schrieb Rodric Rabbah <ro...@gmail.com>:
>
> I just opened a pull request to allow actions to be accessible viaa web
> browser. Action invokes this way are anonymous in that the caller is not
> authenticated. The intended action must be named in the path as a fully
> qualified name as in
> /experimental/web/some-namespace/some-package/some-action. The package is
> optional in that the action may be in the default package. In which case,
> the string "default" must be used.
>
> If the action doesn't exist (or the namespace is not valid) a BadRequest is
> generated. Optionally, the result form the action may be projected based on
> a named property. As in
> /experimental/web/some-namespace/some-package/some-action/some-property. If
> the property
> does not exist in the result then a BadRequest is generated. By convention,
> the "html" property will attempt to respond with media type "text/html".
>
> Actions may be exposed to this web proxy by adding an annotation ("export"
> -> true).
> Demo video https://ibm.box.com/s/5c6ignvejihbai3f59uvqcxee9etf0lf.
>
> Feedback solicited and welcomed.
>
> -r