{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.GlobalAccelerator.DescribeCustomRoutingListener
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- The description of a listener for a custom routing accelerator.
module Amazonka.GlobalAccelerator.DescribeCustomRoutingListener
  ( -- * Creating a Request
    DescribeCustomRoutingListener (..),
    newDescribeCustomRoutingListener,

    -- * Request Lenses
    describeCustomRoutingListener_listenerArn,

    -- * Destructuring the Response
    DescribeCustomRoutingListenerResponse (..),
    newDescribeCustomRoutingListenerResponse,

    -- * Response Lenses
    describeCustomRoutingListenerResponse_listener,
    describeCustomRoutingListenerResponse_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

-- | /See:/ 'newDescribeCustomRoutingListener' smart constructor.
data DescribeCustomRoutingListener = DescribeCustomRoutingListener'
  { -- | The Amazon Resource Name (ARN) of the listener to describe.
    DescribeCustomRoutingListener -> Text
listenerArn :: Prelude.Text
  }
  deriving (DescribeCustomRoutingListener
-> DescribeCustomRoutingListener -> Bool
(DescribeCustomRoutingListener
 -> DescribeCustomRoutingListener -> Bool)
-> (DescribeCustomRoutingListener
    -> DescribeCustomRoutingListener -> Bool)
-> Eq DescribeCustomRoutingListener
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeCustomRoutingListener
-> DescribeCustomRoutingListener -> Bool
$c/= :: DescribeCustomRoutingListener
-> DescribeCustomRoutingListener -> Bool
== :: DescribeCustomRoutingListener
-> DescribeCustomRoutingListener -> Bool
$c== :: DescribeCustomRoutingListener
-> DescribeCustomRoutingListener -> Bool
Prelude.Eq, ReadPrec [DescribeCustomRoutingListener]
ReadPrec DescribeCustomRoutingListener
Int -> ReadS DescribeCustomRoutingListener
ReadS [DescribeCustomRoutingListener]
(Int -> ReadS DescribeCustomRoutingListener)
-> ReadS [DescribeCustomRoutingListener]
-> ReadPrec DescribeCustomRoutingListener
-> ReadPrec [DescribeCustomRoutingListener]
-> Read DescribeCustomRoutingListener
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeCustomRoutingListener]
$creadListPrec :: ReadPrec [DescribeCustomRoutingListener]
readPrec :: ReadPrec DescribeCustomRoutingListener
$creadPrec :: ReadPrec DescribeCustomRoutingListener
readList :: ReadS [DescribeCustomRoutingListener]
$creadList :: ReadS [DescribeCustomRoutingListener]
readsPrec :: Int -> ReadS DescribeCustomRoutingListener
$creadsPrec :: Int -> ReadS DescribeCustomRoutingListener
Prelude.Read, Int -> DescribeCustomRoutingListener -> ShowS
[DescribeCustomRoutingListener] -> ShowS
DescribeCustomRoutingListener -> String
(Int -> DescribeCustomRoutingListener -> ShowS)
-> (DescribeCustomRoutingListener -> String)
-> ([DescribeCustomRoutingListener] -> ShowS)
-> Show DescribeCustomRoutingListener
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeCustomRoutingListener] -> ShowS
$cshowList :: [DescribeCustomRoutingListener] -> ShowS
show :: DescribeCustomRoutingListener -> String
$cshow :: DescribeCustomRoutingListener -> String
showsPrec :: Int -> DescribeCustomRoutingListener -> ShowS
$cshowsPrec :: Int -> DescribeCustomRoutingListener -> ShowS
Prelude.Show, (forall x.
 DescribeCustomRoutingListener
 -> Rep DescribeCustomRoutingListener x)
-> (forall x.
    Rep DescribeCustomRoutingListener x
    -> DescribeCustomRoutingListener)
-> Generic DescribeCustomRoutingListener
forall x.
Rep DescribeCustomRoutingListener x
-> DescribeCustomRoutingListener
forall x.
DescribeCustomRoutingListener
-> Rep DescribeCustomRoutingListener x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeCustomRoutingListener x
-> DescribeCustomRoutingListener
$cfrom :: forall x.
DescribeCustomRoutingListener
-> Rep DescribeCustomRoutingListener x
Prelude.Generic)

-- |
-- Create a value of 'DescribeCustomRoutingListener' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'listenerArn', 'describeCustomRoutingListener_listenerArn' - The Amazon Resource Name (ARN) of the listener to describe.
newDescribeCustomRoutingListener ::
  -- | 'listenerArn'
  Prelude.Text ->
  DescribeCustomRoutingListener
newDescribeCustomRoutingListener :: Text -> DescribeCustomRoutingListener
newDescribeCustomRoutingListener Text
pListenerArn_ =
  DescribeCustomRoutingListener' :: Text -> DescribeCustomRoutingListener
DescribeCustomRoutingListener'
    { $sel:listenerArn:DescribeCustomRoutingListener' :: Text
listenerArn =
        Text
pListenerArn_
    }

-- | The Amazon Resource Name (ARN) of the listener to describe.
describeCustomRoutingListener_listenerArn :: Lens.Lens' DescribeCustomRoutingListener Prelude.Text
describeCustomRoutingListener_listenerArn :: (Text -> f Text)
-> DescribeCustomRoutingListener -> f DescribeCustomRoutingListener
describeCustomRoutingListener_listenerArn = (DescribeCustomRoutingListener -> Text)
-> (DescribeCustomRoutingListener
    -> Text -> DescribeCustomRoutingListener)
-> Lens
     DescribeCustomRoutingListener
     DescribeCustomRoutingListener
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeCustomRoutingListener' {Text
listenerArn :: Text
$sel:listenerArn:DescribeCustomRoutingListener' :: DescribeCustomRoutingListener -> Text
listenerArn} -> Text
listenerArn) (\s :: DescribeCustomRoutingListener
s@DescribeCustomRoutingListener' {} Text
a -> DescribeCustomRoutingListener
s {$sel:listenerArn:DescribeCustomRoutingListener' :: Text
listenerArn = Text
a} :: DescribeCustomRoutingListener)

instance
  Core.AWSRequest
    DescribeCustomRoutingListener
  where
  type
    AWSResponse DescribeCustomRoutingListener =
      DescribeCustomRoutingListenerResponse
  request :: DescribeCustomRoutingListener
-> Request DescribeCustomRoutingListener
request = Service
-> DescribeCustomRoutingListener
-> Request DescribeCustomRoutingListener
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeCustomRoutingListener
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeCustomRoutingListener)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DescribeCustomRoutingListener))
-> Logger
-> Service
-> Proxy DescribeCustomRoutingListener
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeCustomRoutingListener)))
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 CustomRoutingListener
-> Int -> DescribeCustomRoutingListenerResponse
DescribeCustomRoutingListenerResponse'
            (Maybe CustomRoutingListener
 -> Int -> DescribeCustomRoutingListenerResponse)
-> Either String (Maybe CustomRoutingListener)
-> Either String (Int -> DescribeCustomRoutingListenerResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe CustomRoutingListener)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Listener")
            Either String (Int -> DescribeCustomRoutingListenerResponse)
-> Either String Int
-> Either String DescribeCustomRoutingListenerResponse
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
    DescribeCustomRoutingListener

instance Prelude.NFData DescribeCustomRoutingListener

instance Core.ToHeaders DescribeCustomRoutingListener where
  toHeaders :: DescribeCustomRoutingListener -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DescribeCustomRoutingListener -> 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.DescribeCustomRoutingListener" ::
                          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 DescribeCustomRoutingListener where
  toJSON :: DescribeCustomRoutingListener -> Value
toJSON DescribeCustomRoutingListener' {Text
listenerArn :: Text
$sel:listenerArn:DescribeCustomRoutingListener' :: DescribeCustomRoutingListener -> 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 DescribeCustomRoutingListener where
  toPath :: DescribeCustomRoutingListener -> ByteString
toPath = ByteString -> DescribeCustomRoutingListener -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery DescribeCustomRoutingListener where
  toQuery :: DescribeCustomRoutingListener -> QueryString
toQuery = QueryString -> DescribeCustomRoutingListener -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newDescribeCustomRoutingListenerResponse' smart constructor.
data DescribeCustomRoutingListenerResponse = DescribeCustomRoutingListenerResponse'
  { -- | The description of a listener for a custom routing accelerator.
    DescribeCustomRoutingListenerResponse
-> Maybe CustomRoutingListener
listener :: Prelude.Maybe CustomRoutingListener,
    -- | The response's http status code.
    DescribeCustomRoutingListenerResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeCustomRoutingListenerResponse
-> DescribeCustomRoutingListenerResponse -> Bool
(DescribeCustomRoutingListenerResponse
 -> DescribeCustomRoutingListenerResponse -> Bool)
-> (DescribeCustomRoutingListenerResponse
    -> DescribeCustomRoutingListenerResponse -> Bool)
-> Eq DescribeCustomRoutingListenerResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeCustomRoutingListenerResponse
-> DescribeCustomRoutingListenerResponse -> Bool
$c/= :: DescribeCustomRoutingListenerResponse
-> DescribeCustomRoutingListenerResponse -> Bool
== :: DescribeCustomRoutingListenerResponse
-> DescribeCustomRoutingListenerResponse -> Bool
$c== :: DescribeCustomRoutingListenerResponse
-> DescribeCustomRoutingListenerResponse -> Bool
Prelude.Eq, ReadPrec [DescribeCustomRoutingListenerResponse]
ReadPrec DescribeCustomRoutingListenerResponse
Int -> ReadS DescribeCustomRoutingListenerResponse
ReadS [DescribeCustomRoutingListenerResponse]
(Int -> ReadS DescribeCustomRoutingListenerResponse)
-> ReadS [DescribeCustomRoutingListenerResponse]
-> ReadPrec DescribeCustomRoutingListenerResponse
-> ReadPrec [DescribeCustomRoutingListenerResponse]
-> Read DescribeCustomRoutingListenerResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeCustomRoutingListenerResponse]
$creadListPrec :: ReadPrec [DescribeCustomRoutingListenerResponse]
readPrec :: ReadPrec DescribeCustomRoutingListenerResponse
$creadPrec :: ReadPrec DescribeCustomRoutingListenerResponse
readList :: ReadS [DescribeCustomRoutingListenerResponse]
$creadList :: ReadS [DescribeCustomRoutingListenerResponse]
readsPrec :: Int -> ReadS DescribeCustomRoutingListenerResponse
$creadsPrec :: Int -> ReadS DescribeCustomRoutingListenerResponse
Prelude.Read, Int -> DescribeCustomRoutingListenerResponse -> ShowS
[DescribeCustomRoutingListenerResponse] -> ShowS
DescribeCustomRoutingListenerResponse -> String
(Int -> DescribeCustomRoutingListenerResponse -> ShowS)
-> (DescribeCustomRoutingListenerResponse -> String)
-> ([DescribeCustomRoutingListenerResponse] -> ShowS)
-> Show DescribeCustomRoutingListenerResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeCustomRoutingListenerResponse] -> ShowS
$cshowList :: [DescribeCustomRoutingListenerResponse] -> ShowS
show :: DescribeCustomRoutingListenerResponse -> String
$cshow :: DescribeCustomRoutingListenerResponse -> String
showsPrec :: Int -> DescribeCustomRoutingListenerResponse -> ShowS
$cshowsPrec :: Int -> DescribeCustomRoutingListenerResponse -> ShowS
Prelude.Show, (forall x.
 DescribeCustomRoutingListenerResponse
 -> Rep DescribeCustomRoutingListenerResponse x)
-> (forall x.
    Rep DescribeCustomRoutingListenerResponse x
    -> DescribeCustomRoutingListenerResponse)
-> Generic DescribeCustomRoutingListenerResponse
forall x.
Rep DescribeCustomRoutingListenerResponse x
-> DescribeCustomRoutingListenerResponse
forall x.
DescribeCustomRoutingListenerResponse
-> Rep DescribeCustomRoutingListenerResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeCustomRoutingListenerResponse x
-> DescribeCustomRoutingListenerResponse
$cfrom :: forall x.
DescribeCustomRoutingListenerResponse
-> Rep DescribeCustomRoutingListenerResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeCustomRoutingListenerResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'listener', 'describeCustomRoutingListenerResponse_listener' - The description of a listener for a custom routing accelerator.
--
-- 'httpStatus', 'describeCustomRoutingListenerResponse_httpStatus' - The response's http status code.
newDescribeCustomRoutingListenerResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeCustomRoutingListenerResponse
newDescribeCustomRoutingListenerResponse :: Int -> DescribeCustomRoutingListenerResponse
newDescribeCustomRoutingListenerResponse Int
pHttpStatus_ =
  DescribeCustomRoutingListenerResponse' :: Maybe CustomRoutingListener
-> Int -> DescribeCustomRoutingListenerResponse
DescribeCustomRoutingListenerResponse'
    { $sel:listener:DescribeCustomRoutingListenerResponse' :: Maybe CustomRoutingListener
listener =
        Maybe CustomRoutingListener
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeCustomRoutingListenerResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The description of a listener for a custom routing accelerator.
describeCustomRoutingListenerResponse_listener :: Lens.Lens' DescribeCustomRoutingListenerResponse (Prelude.Maybe CustomRoutingListener)
describeCustomRoutingListenerResponse_listener :: (Maybe CustomRoutingListener -> f (Maybe CustomRoutingListener))
-> DescribeCustomRoutingListenerResponse
-> f DescribeCustomRoutingListenerResponse
describeCustomRoutingListenerResponse_listener = (DescribeCustomRoutingListenerResponse
 -> Maybe CustomRoutingListener)
-> (DescribeCustomRoutingListenerResponse
    -> Maybe CustomRoutingListener
    -> DescribeCustomRoutingListenerResponse)
-> Lens
     DescribeCustomRoutingListenerResponse
     DescribeCustomRoutingListenerResponse
     (Maybe CustomRoutingListener)
     (Maybe CustomRoutingListener)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeCustomRoutingListenerResponse' {Maybe CustomRoutingListener
listener :: Maybe CustomRoutingListener
$sel:listener:DescribeCustomRoutingListenerResponse' :: DescribeCustomRoutingListenerResponse
-> Maybe CustomRoutingListener
listener} -> Maybe CustomRoutingListener
listener) (\s :: DescribeCustomRoutingListenerResponse
s@DescribeCustomRoutingListenerResponse' {} Maybe CustomRoutingListener
a -> DescribeCustomRoutingListenerResponse
s {$sel:listener:DescribeCustomRoutingListenerResponse' :: Maybe CustomRoutingListener
listener = Maybe CustomRoutingListener
a} :: DescribeCustomRoutingListenerResponse)

-- | The response's http status code.
describeCustomRoutingListenerResponse_httpStatus :: Lens.Lens' DescribeCustomRoutingListenerResponse Prelude.Int
describeCustomRoutingListenerResponse_httpStatus :: (Int -> f Int)
-> DescribeCustomRoutingListenerResponse
-> f DescribeCustomRoutingListenerResponse
describeCustomRoutingListenerResponse_httpStatus = (DescribeCustomRoutingListenerResponse -> Int)
-> (DescribeCustomRoutingListenerResponse
    -> Int -> DescribeCustomRoutingListenerResponse)
-> Lens
     DescribeCustomRoutingListenerResponse
     DescribeCustomRoutingListenerResponse
     Int
     Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeCustomRoutingListenerResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeCustomRoutingListenerResponse' :: DescribeCustomRoutingListenerResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeCustomRoutingListenerResponse
s@DescribeCustomRoutingListenerResponse' {} Int
a -> DescribeCustomRoutingListenerResponse
s {$sel:httpStatus:DescribeCustomRoutingListenerResponse' :: Int
httpStatus = Int
a} :: DescribeCustomRoutingListenerResponse)

instance
  Prelude.NFData
    DescribeCustomRoutingListenerResponse