{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.ECS.DiscoverPollEndpoint
(
DiscoverPollEndpoint (..),
newDiscoverPollEndpoint,
discoverPollEndpoint_cluster,
discoverPollEndpoint_containerInstance,
DiscoverPollEndpointResponse (..),
newDiscoverPollEndpointResponse,
discoverPollEndpointResponse_telemetryEndpoint,
discoverPollEndpointResponse_endpoint,
discoverPollEndpointResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.ECS.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data DiscoverPollEndpoint = DiscoverPollEndpoint'
{
DiscoverPollEndpoint -> Maybe Text
cluster :: Prelude.Maybe Prelude.Text,
DiscoverPollEndpoint -> Maybe Text
containerInstance :: Prelude.Maybe Prelude.Text
}
deriving (DiscoverPollEndpoint -> DiscoverPollEndpoint -> Bool
(DiscoverPollEndpoint -> DiscoverPollEndpoint -> Bool)
-> (DiscoverPollEndpoint -> DiscoverPollEndpoint -> Bool)
-> Eq DiscoverPollEndpoint
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DiscoverPollEndpoint -> DiscoverPollEndpoint -> Bool
$c/= :: DiscoverPollEndpoint -> DiscoverPollEndpoint -> Bool
== :: DiscoverPollEndpoint -> DiscoverPollEndpoint -> Bool
$c== :: DiscoverPollEndpoint -> DiscoverPollEndpoint -> Bool
Prelude.Eq, ReadPrec [DiscoverPollEndpoint]
ReadPrec DiscoverPollEndpoint
Int -> ReadS DiscoverPollEndpoint
ReadS [DiscoverPollEndpoint]
(Int -> ReadS DiscoverPollEndpoint)
-> ReadS [DiscoverPollEndpoint]
-> ReadPrec DiscoverPollEndpoint
-> ReadPrec [DiscoverPollEndpoint]
-> Read DiscoverPollEndpoint
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DiscoverPollEndpoint]
$creadListPrec :: ReadPrec [DiscoverPollEndpoint]
readPrec :: ReadPrec DiscoverPollEndpoint
$creadPrec :: ReadPrec DiscoverPollEndpoint
readList :: ReadS [DiscoverPollEndpoint]
$creadList :: ReadS [DiscoverPollEndpoint]
readsPrec :: Int -> ReadS DiscoverPollEndpoint
$creadsPrec :: Int -> ReadS DiscoverPollEndpoint
Prelude.Read, Int -> DiscoverPollEndpoint -> ShowS
[DiscoverPollEndpoint] -> ShowS
DiscoverPollEndpoint -> String
(Int -> DiscoverPollEndpoint -> ShowS)
-> (DiscoverPollEndpoint -> String)
-> ([DiscoverPollEndpoint] -> ShowS)
-> Show DiscoverPollEndpoint
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DiscoverPollEndpoint] -> ShowS
$cshowList :: [DiscoverPollEndpoint] -> ShowS
show :: DiscoverPollEndpoint -> String
$cshow :: DiscoverPollEndpoint -> String
showsPrec :: Int -> DiscoverPollEndpoint -> ShowS
$cshowsPrec :: Int -> DiscoverPollEndpoint -> ShowS
Prelude.Show, (forall x. DiscoverPollEndpoint -> Rep DiscoverPollEndpoint x)
-> (forall x. Rep DiscoverPollEndpoint x -> DiscoverPollEndpoint)
-> Generic DiscoverPollEndpoint
forall x. Rep DiscoverPollEndpoint x -> DiscoverPollEndpoint
forall x. DiscoverPollEndpoint -> Rep DiscoverPollEndpoint x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DiscoverPollEndpoint x -> DiscoverPollEndpoint
$cfrom :: forall x. DiscoverPollEndpoint -> Rep DiscoverPollEndpoint x
Prelude.Generic)
newDiscoverPollEndpoint ::
DiscoverPollEndpoint
newDiscoverPollEndpoint :: DiscoverPollEndpoint
newDiscoverPollEndpoint =
DiscoverPollEndpoint' :: Maybe Text -> Maybe Text -> DiscoverPollEndpoint
DiscoverPollEndpoint'
{ $sel:cluster:DiscoverPollEndpoint' :: Maybe Text
cluster = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:containerInstance:DiscoverPollEndpoint' :: Maybe Text
containerInstance = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
discoverPollEndpoint_cluster :: Lens.Lens' DiscoverPollEndpoint (Prelude.Maybe Prelude.Text)
discoverPollEndpoint_cluster :: (Maybe Text -> f (Maybe Text))
-> DiscoverPollEndpoint -> f DiscoverPollEndpoint
discoverPollEndpoint_cluster = (DiscoverPollEndpoint -> Maybe Text)
-> (DiscoverPollEndpoint -> Maybe Text -> DiscoverPollEndpoint)
-> Lens
DiscoverPollEndpoint DiscoverPollEndpoint (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DiscoverPollEndpoint' {Maybe Text
cluster :: Maybe Text
$sel:cluster:DiscoverPollEndpoint' :: DiscoverPollEndpoint -> Maybe Text
cluster} -> Maybe Text
cluster) (\s :: DiscoverPollEndpoint
s@DiscoverPollEndpoint' {} Maybe Text
a -> DiscoverPollEndpoint
s {$sel:cluster:DiscoverPollEndpoint' :: Maybe Text
cluster = Maybe Text
a} :: DiscoverPollEndpoint)
discoverPollEndpoint_containerInstance :: Lens.Lens' DiscoverPollEndpoint (Prelude.Maybe Prelude.Text)
discoverPollEndpoint_containerInstance :: (Maybe Text -> f (Maybe Text))
-> DiscoverPollEndpoint -> f DiscoverPollEndpoint
discoverPollEndpoint_containerInstance = (DiscoverPollEndpoint -> Maybe Text)
-> (DiscoverPollEndpoint -> Maybe Text -> DiscoverPollEndpoint)
-> Lens
DiscoverPollEndpoint DiscoverPollEndpoint (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DiscoverPollEndpoint' {Maybe Text
containerInstance :: Maybe Text
$sel:containerInstance:DiscoverPollEndpoint' :: DiscoverPollEndpoint -> Maybe Text
containerInstance} -> Maybe Text
containerInstance) (\s :: DiscoverPollEndpoint
s@DiscoverPollEndpoint' {} Maybe Text
a -> DiscoverPollEndpoint
s {$sel:containerInstance:DiscoverPollEndpoint' :: Maybe Text
containerInstance = Maybe Text
a} :: DiscoverPollEndpoint)
instance Core.AWSRequest DiscoverPollEndpoint where
type
AWSResponse DiscoverPollEndpoint =
DiscoverPollEndpointResponse
request :: DiscoverPollEndpoint -> Request DiscoverPollEndpoint
request = Service -> DiscoverPollEndpoint -> Request DiscoverPollEndpoint
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DiscoverPollEndpoint
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DiscoverPollEndpoint)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DiscoverPollEndpoint))
-> Logger
-> Service
-> Proxy DiscoverPollEndpoint
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DiscoverPollEndpoint)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe Text -> Maybe Text -> Int -> DiscoverPollEndpointResponse
DiscoverPollEndpointResponse'
(Maybe Text -> Maybe Text -> Int -> DiscoverPollEndpointResponse)
-> Either String (Maybe Text)
-> Either
String (Maybe Text -> Int -> DiscoverPollEndpointResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"telemetryEndpoint")
Either String (Maybe Text -> Int -> DiscoverPollEndpointResponse)
-> Either String (Maybe Text)
-> Either String (Int -> DiscoverPollEndpointResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"endpoint")
Either String (Int -> DiscoverPollEndpointResponse)
-> Either String Int -> Either String DiscoverPollEndpointResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable DiscoverPollEndpoint
instance Prelude.NFData DiscoverPollEndpoint
instance Core.ToHeaders DiscoverPollEndpoint where
toHeaders :: DiscoverPollEndpoint -> ResponseHeaders
toHeaders =
ResponseHeaders -> DiscoverPollEndpoint -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"AmazonEC2ContainerServiceV20141113.DiscoverPollEndpoint" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON DiscoverPollEndpoint where
toJSON :: DiscoverPollEndpoint -> Value
toJSON DiscoverPollEndpoint' {Maybe Text
containerInstance :: Maybe Text
cluster :: Maybe Text
$sel:containerInstance:DiscoverPollEndpoint' :: DiscoverPollEndpoint -> Maybe Text
$sel:cluster:DiscoverPollEndpoint' :: DiscoverPollEndpoint -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"cluster" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
cluster,
(Text
"containerInstance" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
containerInstance
]
)
instance Core.ToPath DiscoverPollEndpoint where
toPath :: DiscoverPollEndpoint -> ByteString
toPath = ByteString -> DiscoverPollEndpoint -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DiscoverPollEndpoint where
toQuery :: DiscoverPollEndpoint -> QueryString
toQuery = QueryString -> DiscoverPollEndpoint -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DiscoverPollEndpointResponse = DiscoverPollEndpointResponse'
{
DiscoverPollEndpointResponse -> Maybe Text
telemetryEndpoint :: Prelude.Maybe Prelude.Text,
DiscoverPollEndpointResponse -> Maybe Text
endpoint :: Prelude.Maybe Prelude.Text,
DiscoverPollEndpointResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DiscoverPollEndpointResponse
-> DiscoverPollEndpointResponse -> Bool
(DiscoverPollEndpointResponse
-> DiscoverPollEndpointResponse -> Bool)
-> (DiscoverPollEndpointResponse
-> DiscoverPollEndpointResponse -> Bool)
-> Eq DiscoverPollEndpointResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DiscoverPollEndpointResponse
-> DiscoverPollEndpointResponse -> Bool
$c/= :: DiscoverPollEndpointResponse
-> DiscoverPollEndpointResponse -> Bool
== :: DiscoverPollEndpointResponse
-> DiscoverPollEndpointResponse -> Bool
$c== :: DiscoverPollEndpointResponse
-> DiscoverPollEndpointResponse -> Bool
Prelude.Eq, ReadPrec [DiscoverPollEndpointResponse]
ReadPrec DiscoverPollEndpointResponse
Int -> ReadS DiscoverPollEndpointResponse
ReadS [DiscoverPollEndpointResponse]
(Int -> ReadS DiscoverPollEndpointResponse)
-> ReadS [DiscoverPollEndpointResponse]
-> ReadPrec DiscoverPollEndpointResponse
-> ReadPrec [DiscoverPollEndpointResponse]
-> Read DiscoverPollEndpointResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DiscoverPollEndpointResponse]
$creadListPrec :: ReadPrec [DiscoverPollEndpointResponse]
readPrec :: ReadPrec DiscoverPollEndpointResponse
$creadPrec :: ReadPrec DiscoverPollEndpointResponse
readList :: ReadS [DiscoverPollEndpointResponse]
$creadList :: ReadS [DiscoverPollEndpointResponse]
readsPrec :: Int -> ReadS DiscoverPollEndpointResponse
$creadsPrec :: Int -> ReadS DiscoverPollEndpointResponse
Prelude.Read, Int -> DiscoverPollEndpointResponse -> ShowS
[DiscoverPollEndpointResponse] -> ShowS
DiscoverPollEndpointResponse -> String
(Int -> DiscoverPollEndpointResponse -> ShowS)
-> (DiscoverPollEndpointResponse -> String)
-> ([DiscoverPollEndpointResponse] -> ShowS)
-> Show DiscoverPollEndpointResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DiscoverPollEndpointResponse] -> ShowS
$cshowList :: [DiscoverPollEndpointResponse] -> ShowS
show :: DiscoverPollEndpointResponse -> String
$cshow :: DiscoverPollEndpointResponse -> String
showsPrec :: Int -> DiscoverPollEndpointResponse -> ShowS
$cshowsPrec :: Int -> DiscoverPollEndpointResponse -> ShowS
Prelude.Show, (forall x.
DiscoverPollEndpointResponse -> Rep DiscoverPollEndpointResponse x)
-> (forall x.
Rep DiscoverPollEndpointResponse x -> DiscoverPollEndpointResponse)
-> Generic DiscoverPollEndpointResponse
forall x.
Rep DiscoverPollEndpointResponse x -> DiscoverPollEndpointResponse
forall x.
DiscoverPollEndpointResponse -> Rep DiscoverPollEndpointResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DiscoverPollEndpointResponse x -> DiscoverPollEndpointResponse
$cfrom :: forall x.
DiscoverPollEndpointResponse -> Rep DiscoverPollEndpointResponse x
Prelude.Generic)
newDiscoverPollEndpointResponse ::
Prelude.Int ->
DiscoverPollEndpointResponse
newDiscoverPollEndpointResponse :: Int -> DiscoverPollEndpointResponse
newDiscoverPollEndpointResponse Int
pHttpStatus_ =
DiscoverPollEndpointResponse' :: Maybe Text -> Maybe Text -> Int -> DiscoverPollEndpointResponse
DiscoverPollEndpointResponse'
{ $sel:telemetryEndpoint:DiscoverPollEndpointResponse' :: Maybe Text
telemetryEndpoint =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:endpoint:DiscoverPollEndpointResponse' :: Maybe Text
endpoint = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DiscoverPollEndpointResponse' :: Int
httpStatus = Int
pHttpStatus_
}
discoverPollEndpointResponse_telemetryEndpoint :: Lens.Lens' DiscoverPollEndpointResponse (Prelude.Maybe Prelude.Text)
discoverPollEndpointResponse_telemetryEndpoint :: (Maybe Text -> f (Maybe Text))
-> DiscoverPollEndpointResponse -> f DiscoverPollEndpointResponse
discoverPollEndpointResponse_telemetryEndpoint = (DiscoverPollEndpointResponse -> Maybe Text)
-> (DiscoverPollEndpointResponse
-> Maybe Text -> DiscoverPollEndpointResponse)
-> Lens
DiscoverPollEndpointResponse
DiscoverPollEndpointResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DiscoverPollEndpointResponse' {Maybe Text
telemetryEndpoint :: Maybe Text
$sel:telemetryEndpoint:DiscoverPollEndpointResponse' :: DiscoverPollEndpointResponse -> Maybe Text
telemetryEndpoint} -> Maybe Text
telemetryEndpoint) (\s :: DiscoverPollEndpointResponse
s@DiscoverPollEndpointResponse' {} Maybe Text
a -> DiscoverPollEndpointResponse
s {$sel:telemetryEndpoint:DiscoverPollEndpointResponse' :: Maybe Text
telemetryEndpoint = Maybe Text
a} :: DiscoverPollEndpointResponse)
discoverPollEndpointResponse_endpoint :: Lens.Lens' DiscoverPollEndpointResponse (Prelude.Maybe Prelude.Text)
discoverPollEndpointResponse_endpoint :: (Maybe Text -> f (Maybe Text))
-> DiscoverPollEndpointResponse -> f DiscoverPollEndpointResponse
discoverPollEndpointResponse_endpoint = (DiscoverPollEndpointResponse -> Maybe Text)
-> (DiscoverPollEndpointResponse
-> Maybe Text -> DiscoverPollEndpointResponse)
-> Lens
DiscoverPollEndpointResponse
DiscoverPollEndpointResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DiscoverPollEndpointResponse' {Maybe Text
endpoint :: Maybe Text
$sel:endpoint:DiscoverPollEndpointResponse' :: DiscoverPollEndpointResponse -> Maybe Text
endpoint} -> Maybe Text
endpoint) (\s :: DiscoverPollEndpointResponse
s@DiscoverPollEndpointResponse' {} Maybe Text
a -> DiscoverPollEndpointResponse
s {$sel:endpoint:DiscoverPollEndpointResponse' :: Maybe Text
endpoint = Maybe Text
a} :: DiscoverPollEndpointResponse)
discoverPollEndpointResponse_httpStatus :: Lens.Lens' DiscoverPollEndpointResponse Prelude.Int
discoverPollEndpointResponse_httpStatus :: (Int -> f Int)
-> DiscoverPollEndpointResponse -> f DiscoverPollEndpointResponse
discoverPollEndpointResponse_httpStatus = (DiscoverPollEndpointResponse -> Int)
-> (DiscoverPollEndpointResponse
-> Int -> DiscoverPollEndpointResponse)
-> Lens
DiscoverPollEndpointResponse DiscoverPollEndpointResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DiscoverPollEndpointResponse' {Int
httpStatus :: Int
$sel:httpStatus:DiscoverPollEndpointResponse' :: DiscoverPollEndpointResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DiscoverPollEndpointResponse
s@DiscoverPollEndpointResponse' {} Int
a -> DiscoverPollEndpointResponse
s {$sel:httpStatus:DiscoverPollEndpointResponse' :: Int
httpStatus = Int
a} :: DiscoverPollEndpointResponse)
instance Prelude.NFData DiscoverPollEndpointResponse