| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Kubernetes.Client.Watch
Synopsis
- data WatchEvent a
- eventType :: WatchEvent a -> Text
- eventObject :: WatchEvent a -> a
- dispatchWatch :: (HasOptionalParam req Watch, MimeType accept, MimeType contentType) => Manager -> KubernetesClientConfig -> KubernetesRequest req contentType resp accept -> (ByteString IO () -> IO a) -> IO a
Documentation
data WatchEvent a Source #
Instances
| Eq a => Eq (WatchEvent a) Source # | |
Defined in Kubernetes.Client.Watch | |
| Show a => Show (WatchEvent a) Source # | |
Defined in Kubernetes.Client.Watch Methods showsPrec :: Int -> WatchEvent a -> ShowS # show :: WatchEvent a -> String # showList :: [WatchEvent a] -> ShowS # | |
| ToJSON a => ToJSON (WatchEvent a) Source # | |
Defined in Kubernetes.Client.Watch Methods toJSON :: WatchEvent a -> Value # toEncoding :: WatchEvent a -> Encoding # toJSONList :: [WatchEvent a] -> Value # toEncodingList :: [WatchEvent a] -> Encoding # | |
| FromJSON a => FromJSON (WatchEvent a) Source # | |
Defined in Kubernetes.Client.Watch Methods parseJSON :: Value -> Parser (WatchEvent a) # parseJSONList :: Value -> Parser [WatchEvent a] # | |
eventType :: WatchEvent a -> Text Source #
Type of the WatchEvent.
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" ....