{-# 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.GlobalAccelerator.DescribeListener
(
DescribeListener (..),
newDescribeListener,
describeListener_listenerArn,
DescribeListenerResponse (..),
newDescribeListenerResponse,
describeListenerResponse_listener,
describeListenerResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.GlobalAccelerator.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 DescribeListener = DescribeListener'
{
DescribeListener -> Text
listenerArn :: Prelude.Text
}
deriving (DescribeListener -> DescribeListener -> Bool
(DescribeListener -> DescribeListener -> Bool)
-> (DescribeListener -> DescribeListener -> Bool)
-> Eq DescribeListener
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeListener -> DescribeListener -> Bool
$c/= :: DescribeListener -> DescribeListener -> Bool
== :: DescribeListener -> DescribeListener -> Bool
$c== :: DescribeListener -> DescribeListener -> Bool
Prelude.Eq, ReadPrec [DescribeListener]
ReadPrec DescribeListener
Int -> ReadS DescribeListener
ReadS [DescribeListener]
(Int -> ReadS DescribeListener)
-> ReadS [DescribeListener]
-> ReadPrec DescribeListener
-> ReadPrec [DescribeListener]
-> Read DescribeListener
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeListener]
$creadListPrec :: ReadPrec [DescribeListener]
readPrec :: ReadPrec DescribeListener
$creadPrec :: ReadPrec DescribeListener
readList :: ReadS [DescribeListener]
$creadList :: ReadS [DescribeListener]
readsPrec :: Int -> ReadS DescribeListener
$creadsPrec :: Int -> ReadS DescribeListener
Prelude.Read, Int -> DescribeListener -> ShowS
[DescribeListener] -> ShowS
DescribeListener -> String
(Int -> DescribeListener -> ShowS)
-> (DescribeListener -> String)
-> ([DescribeListener] -> ShowS)
-> Show DescribeListener
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeListener] -> ShowS
$cshowList :: [DescribeListener] -> ShowS
show :: DescribeListener -> String
$cshow :: DescribeListener -> String
showsPrec :: Int -> DescribeListener -> ShowS
$cshowsPrec :: Int -> DescribeListener -> ShowS
Prelude.Show, (forall x. DescribeListener -> Rep DescribeListener x)
-> (forall x. Rep DescribeListener x -> DescribeListener)
-> Generic DescribeListener
forall x. Rep DescribeListener x -> DescribeListener
forall x. DescribeListener -> Rep DescribeListener x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeListener x -> DescribeListener
$cfrom :: forall x. DescribeListener -> Rep DescribeListener x
Prelude.Generic)
newDescribeListener ::
Prelude.Text ->
DescribeListener
newDescribeListener :: Text -> DescribeListener
newDescribeListener Text
pListenerArn_ =
DescribeListener' :: Text -> DescribeListener
DescribeListener' {$sel:listenerArn:DescribeListener' :: Text
listenerArn = Text
pListenerArn_}
describeListener_listenerArn :: Lens.Lens' DescribeListener Prelude.Text
describeListener_listenerArn :: (Text -> f Text) -> DescribeListener -> f DescribeListener
describeListener_listenerArn = (DescribeListener -> Text)
-> (DescribeListener -> Text -> DescribeListener)
-> Lens DescribeListener DescribeListener Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeListener' {Text
listenerArn :: Text
$sel:listenerArn:DescribeListener' :: DescribeListener -> Text
listenerArn} -> Text
listenerArn) (\s :: DescribeListener
s@DescribeListener' {} Text
a -> DescribeListener
s {$sel:listenerArn:DescribeListener' :: Text
listenerArn = Text
a} :: DescribeListener)
instance Core.AWSRequest DescribeListener where
type
AWSResponse DescribeListener =
DescribeListenerResponse
request :: DescribeListener -> Request DescribeListener
request = Service -> DescribeListener -> Request DescribeListener
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DescribeListener
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeListener)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DescribeListener))
-> Logger
-> Service
-> Proxy DescribeListener
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeListener)))
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 Listener -> Int -> DescribeListenerResponse
DescribeListenerResponse'
(Maybe Listener -> Int -> DescribeListenerResponse)
-> Either String (Maybe Listener)
-> Either String (Int -> DescribeListenerResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Listener)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Listener")
Either String (Int -> DescribeListenerResponse)
-> Either String Int -> Either String DescribeListenerResponse
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 DescribeListener
instance Prelude.NFData DescribeListener
instance Core.ToHeaders DescribeListener where
toHeaders :: DescribeListener -> ResponseHeaders
toHeaders =
ResponseHeaders -> DescribeListener -> 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
"GlobalAccelerator_V20180706.DescribeListener" ::
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 DescribeListener where
toJSON :: DescribeListener -> Value
toJSON DescribeListener' {Text
listenerArn :: Text
$sel:listenerArn:DescribeListener' :: DescribeListener -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ListenerArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
listenerArn)]
)
instance Core.ToPath DescribeListener where
toPath :: DescribeListener -> ByteString
toPath = ByteString -> DescribeListener -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DescribeListener where
toQuery :: DescribeListener -> QueryString
toQuery = QueryString -> DescribeListener -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DescribeListenerResponse = DescribeListenerResponse'
{
DescribeListenerResponse -> Maybe Listener
listener :: Prelude.Maybe Listener,
DescribeListenerResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DescribeListenerResponse -> DescribeListenerResponse -> Bool
(DescribeListenerResponse -> DescribeListenerResponse -> Bool)
-> (DescribeListenerResponse -> DescribeListenerResponse -> Bool)
-> Eq DescribeListenerResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeListenerResponse -> DescribeListenerResponse -> Bool
$c/= :: DescribeListenerResponse -> DescribeListenerResponse -> Bool
== :: DescribeListenerResponse -> DescribeListenerResponse -> Bool
$c== :: DescribeListenerResponse -> DescribeListenerResponse -> Bool
Prelude.Eq, ReadPrec [DescribeListenerResponse]
ReadPrec DescribeListenerResponse
Int -> ReadS DescribeListenerResponse
ReadS [DescribeListenerResponse]
(Int -> ReadS DescribeListenerResponse)
-> ReadS [DescribeListenerResponse]
-> ReadPrec DescribeListenerResponse
-> ReadPrec [DescribeListenerResponse]
-> Read DescribeListenerResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeListenerResponse]
$creadListPrec :: ReadPrec [DescribeListenerResponse]
readPrec :: ReadPrec DescribeListenerResponse
$creadPrec :: ReadPrec DescribeListenerResponse
readList :: ReadS [DescribeListenerResponse]
$creadList :: ReadS [DescribeListenerResponse]
readsPrec :: Int -> ReadS DescribeListenerResponse
$creadsPrec :: Int -> ReadS DescribeListenerResponse
Prelude.Read, Int -> DescribeListenerResponse -> ShowS
[DescribeListenerResponse] -> ShowS
DescribeListenerResponse -> String
(Int -> DescribeListenerResponse -> ShowS)
-> (DescribeListenerResponse -> String)
-> ([DescribeListenerResponse] -> ShowS)
-> Show DescribeListenerResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeListenerResponse] -> ShowS
$cshowList :: [DescribeListenerResponse] -> ShowS
show :: DescribeListenerResponse -> String
$cshow :: DescribeListenerResponse -> String
showsPrec :: Int -> DescribeListenerResponse -> ShowS
$cshowsPrec :: Int -> DescribeListenerResponse -> ShowS
Prelude.Show, (forall x.
DescribeListenerResponse -> Rep DescribeListenerResponse x)
-> (forall x.
Rep DescribeListenerResponse x -> DescribeListenerResponse)
-> Generic DescribeListenerResponse
forall x.
Rep DescribeListenerResponse x -> DescribeListenerResponse
forall x.
DescribeListenerResponse -> Rep DescribeListenerResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeListenerResponse x -> DescribeListenerResponse
$cfrom :: forall x.
DescribeListenerResponse -> Rep DescribeListenerResponse x
Prelude.Generic)
newDescribeListenerResponse ::
Prelude.Int ->
DescribeListenerResponse
newDescribeListenerResponse :: Int -> DescribeListenerResponse
newDescribeListenerResponse Int
pHttpStatus_ =
DescribeListenerResponse' :: Maybe Listener -> Int -> DescribeListenerResponse
DescribeListenerResponse'
{ $sel:listener:DescribeListenerResponse' :: Maybe Listener
listener =
Maybe Listener
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DescribeListenerResponse' :: Int
httpStatus = Int
pHttpStatus_
}
describeListenerResponse_listener :: Lens.Lens' DescribeListenerResponse (Prelude.Maybe Listener)
describeListenerResponse_listener :: (Maybe Listener -> f (Maybe Listener))
-> DescribeListenerResponse -> f DescribeListenerResponse
describeListenerResponse_listener = (DescribeListenerResponse -> Maybe Listener)
-> (DescribeListenerResponse
-> Maybe Listener -> DescribeListenerResponse)
-> Lens
DescribeListenerResponse
DescribeListenerResponse
(Maybe Listener)
(Maybe Listener)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeListenerResponse' {Maybe Listener
listener :: Maybe Listener
$sel:listener:DescribeListenerResponse' :: DescribeListenerResponse -> Maybe Listener
listener} -> Maybe Listener
listener) (\s :: DescribeListenerResponse
s@DescribeListenerResponse' {} Maybe Listener
a -> DescribeListenerResponse
s {$sel:listener:DescribeListenerResponse' :: Maybe Listener
listener = Maybe Listener
a} :: DescribeListenerResponse)
describeListenerResponse_httpStatus :: Lens.Lens' DescribeListenerResponse Prelude.Int
describeListenerResponse_httpStatus :: (Int -> f Int)
-> DescribeListenerResponse -> f DescribeListenerResponse
describeListenerResponse_httpStatus = (DescribeListenerResponse -> Int)
-> (DescribeListenerResponse -> Int -> DescribeListenerResponse)
-> Lens DescribeListenerResponse DescribeListenerResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeListenerResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeListenerResponse' :: DescribeListenerResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeListenerResponse
s@DescribeListenerResponse' {} Int
a -> DescribeListenerResponse
s {$sel:httpStatus:DescribeListenerResponse' :: Int
httpStatus = Int
a} :: DescribeListenerResponse)
instance Prelude.NFData DescribeListenerResponse