BonnyPlug.WebhookPlug (bonny_plug v1.0.0) View Source

Plug that processes incoming admission webhook requests. Valid requests are forwarded to BonnyPlug.WebhookHandler.handle_webhook/2.

You have to specify the :webhook_type you want to forward to this plug. The :webhook_type has to be be either :validating_webhook or :mutating_webhook.

Examples

In a Phoenix router you would forward post requests to this plug:

post "/admission-review/validate", BonnyPlug.WebhookPlug,

webhook_type: :validating_webhook,
handlers: [MyApp.WebhookHandlers.FooResourceWebhookHandler]

post "/admission-review/mutate", BonnyPlug.WebhookPlug,

webhook_type: :mutating_webhook,
handlers: [MyApp.WebhookHandlers.FooResourceWebhookHandler]

Link to this section Summary

Link to this section Types

Specs

webhook_type() :: :validating_webhook | :mutating_webhook

Link to this section Functions

Link to this function

process(arg1, webhook_type, handlers)

View Source

Specs

process(map(), atom(), Enum.t()) ::
  {:ok, binary()} | {:error, integer(), binary()}