Openwhisk: Consolidate action annotation constants

Created on 6 Mar 2018  路  11Comments  路  Source: apache/openwhisk

Currently, the defined action annotation names are not centrally defined. Consolidate them as constants into a single location and change the existing code to use those constants.

Example annotations

  • web-export
  • final
  • raw-http
  • web-custom-options
  • require-whisk-auth
enhancement good first issue help wanted starter

Most helpful comment

Awesome @kiran002 - welcome to the community.

All 11 comments

@mdeuser I would be interested in taking this up.

My task would be to move the actions in here, to another object class and reference them in the core and in tests. Is this correct?

Awesome @kiran002 - welcome to the community.

@kiran002 - thanks for picking this up :heart: i defer to @rabbah, but in addition to what you have suggested, you may want to consider providing the list of these annotations via the openwhisk endpoint. just like what is done with the set of system limits and runtime..

@mdeuser can you please point me to where the system limits and runtime endpoints are defined?

@kiran002 - i'm not sure exactly where that code is. it's the output from the curl https://openwhiskhost this might be a good starting place https://github.com/apache/incubator-openwhisk/blob/d22ef30fe613d60d84a5310a6b89cdbe2c495995/core/controller/src/main/scala/org/apache/openwhisk/core/controller/Controller.scala#L190

cool thanks will look into it! :)

@rabbah, @mdeuser

Before i go all out and implement these changes, I wanted to get some feedback from you guys, So my idea is to have an annotations object

object Annotations {
  val FinalParamsAnnotationName = "final"
  val WebActionAnnotationName = "web-export"
  val WebCustomOptionsAnnotationName = "web-custom-options"
  val RawHttpAnnotationName = "raw-http"
  val RequireWhiskAuthAnnotation = "require-whisk-auth"
  val ProvideApiKeyAnnotationName = "provide-api-key"

  def toJSON(): JsValue = ??? 
}

and i intend to change all instances of

 annotations = Map(WhiskAction.provideApiKeyAnnotationName -> JsBoolean(true)))

to

 annotations = Map(Annotations.ProvideApiKeyAnnotationName -> JsBoolean(true)))

Am i heading in the right direction here?

馃憤 sounds like a good plan to me.

Don鈥檛 think you need to toJson method - not sure what your intent is there.

toJson method was for providing the list of these annotations via the openwhisk endpoint, do you think its necessary?

Interesting thought. That hadn't occurred to me. Do you know how clients might use this?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jthomas picture jthomas  路  3Comments

csantanapr picture csantanapr  路  5Comments

Daniel15 picture Daniel15  路  4Comments

markusthoemmes picture markusthoemmes  路  3Comments

csantanapr picture csantanapr  路  3Comments