Azure / buffalo-azure

A gobuffalo plugin for working with Azure.
https://gobuffalo.io/en/docs/plugins
MIT License
29 stars 8 forks source link

Implement `eventgrid` command #6

Closed marstr closed 6 years ago

marstr commented 6 years ago

The eventgrid command extends BuffaloCommand:"generate".

When it is executed it should:

  1. Update the app.go file to include an action for receiving Event Grid events.
  2. Add a file which will contain methods to be implemented by the Buffalo user. a. Without specifying event type information, there should be a single handler registered to "all" which receives an eventgrid.Event. Signature: func WellChosenName(c buffalo.Context, e eventgrid.Event) error b. When type information is specified, a handler for each event type should be generated. A type should also be generated which encompasses the schema of the Event given to it. Example:
    
    type IntEvent struct {
    eventgrid.Event `json:""`
    Data int `json:"data"`
    }

func AnotherWellChosenName(c buffalo.Context, e IntEvent) error { // ... }


3. [stretch, may be incorporated as a separate issue] If an Azure deployment template exists and a Topic ID is provided, update the template to subscribe this Buffalo App to the Topic.

[Buffalo Directory Structure for Reference](https://gobuffalo.io/en/docs/directory-structure)

edit: The strategy of generating a bunch of types was both harder for me, and not really helpful for users. Instead, `eventgrid.Event` has a `json.RawMessage` to allow partial unmarshaling by the event, and further unmarshaling by users.
marstr commented 6 years ago

Here are some examples of the composition scheme above being processed by the JSON encoder:

edit: the examples work, but are no longer what we are considering.

marstr commented 6 years ago

Before this issue is closed, #17 and #18 should be completed.

marstr commented 6 years ago

Done 😃