# `Bonny.Server.Watcher`
[🔗](https://github.com/coryodaniel/bonny/blob/v1.5.0/lib/bonny/server/watcher.ex#L1)

Creates the stream for watching resources in kubernetes and prepares its processing.

Watching a resource in kubernetes results in a stream of add/modify/delete events.
This module uses `K8s.Client.stream/3` to create such a stream and maps
events to a controller's event handler. It is then up to the caller to run the
resulting stream.

## Example

    watch_stream = Bonny.Server.Watcher.get_stream(controller)
    Task.async(fn -> Stream.run(watch_stream) end)

# `action`

```elixir
@type action() :: :add | :modify | :delete
```

# `watch_event`

```elixir
@type watch_event() :: {action(), Bonny.Resource.t()}
```

# `get_raw_stream`

```elixir
@spec get_raw_stream(K8s.Conn.t(), K8s.Operation.t()) :: Enumerable.t(watch_event())
```

# `get_stream`

```elixir
@spec get_stream(module(), K8s.Conn.t(), K8s.Operation.t()) ::
  Enumerable.t(Bonny.Resource.t())
```

---

*Consult [api-reference.md](api-reference.md) for complete listing*
