kubernetes-client-0.3.2.0: Client library for Kubernetes
Safe HaskellNone
LanguageHaskell2010

Kubernetes.Client.Watch

Synopsis

Documentation

data WatchEvent a Source #

Instances

Instances details
Eq a => Eq (WatchEvent a) Source # 
Instance details

Defined in Kubernetes.Client.Watch

Methods

(==) :: WatchEvent a -> WatchEvent a -> Bool #

(/=) :: WatchEvent a -> WatchEvent a -> Bool #

Show a => Show (WatchEvent a) Source # 
Instance details

Defined in Kubernetes.Client.Watch

ToJSON a => ToJSON (WatchEvent a) Source # 
Instance details

Defined in Kubernetes.Client.Watch

FromJSON a => FromJSON (WatchEvent a) Source # 
Instance details

Defined in Kubernetes.Client.Watch

eventObject :: WatchEvent a -> a Source #

Object within the WatchEvent.

dispatchWatch :: (HasOptionalParam req Watch, MimeType accept, MimeType contentType) => Manager -> KubernetesClientConfig -> KubernetesRequest req contentType resp accept -> (ByteString IO () -> IO a) -> IO a Source #

Dispatch a request setting watch to true. Takes a consumer function which consumes the ByteString stream. Following is a simple example which just streams to stdout. First some setup - this assumes kubernetes is accessible at http://localhost:8001, e.g. after running kubectl proxy:

import qualified Data.ByteString.Streaming.Char8 as Q

manager <- newManager defaultManagerSettings
defaultConfig <- newConfig
config = defaultConfig { configHost = "http://localhost:8001", configValidateAuthMethods = False }
request = listEndpointsForAllNamespaces (Accept MimeJSON)

Launching dispatchWatch with the above we get a stream of endpoints data:

 > dispatchWatch manager config request Q.stdout
 {"type":"ADDED","object":{"kind":"Endpoints","apiVersion":"v1","metadata":{"name":"heapster" ....