{-# 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.DescribeCustomRoutingAccelerator
-- 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)
--
-- Describe a custom routing accelerator.
module Amazonka.GlobalAccelerator.DescribeCustomRoutingAccelerator
  ( -- * Creating a Request
    DescribeCustomRoutingAccelerator (..),
    newDescribeCustomRoutingAccelerator,

    -- * Request Lenses
    describeCustomRoutingAccelerator_acceleratorArn,

    -- * Destructuring the Response
    DescribeCustomRoutingAcceleratorResponse (..),
    newDescribeCustomRoutingAcceleratorResponse,

    -- * Response Lenses
    describeCustomRoutingAcceleratorResponse_accelerator,
    describeCustomRoutingAcceleratorResponse_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:/ 'newDescribeCustomRoutingAccelerator' smart constructor.
data DescribeCustomRoutingAccelerator = DescribeCustomRoutingAccelerator'
  { -- | The Amazon Resource Name (ARN) of the accelerator to describe.
    DescribeCustomRoutingAccelerator -> Text
acceleratorArn :: Prelude.Text
  }
  deriving (DescribeCustomRoutingAccelerator
-> DescribeCustomRoutingAccelerator -> Bool
(DescribeCustomRoutingAccelerator
 -> DescribeCustomRoutingAccelerator -> Bool)
-> (DescribeCustomRoutingAccelerator
    -> DescribeCustomRoutingAccelerator -> Bool)
-> Eq DescribeCustomRoutingAccelerator
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeCustomRoutingAccelerator
-> DescribeCustomRoutingAccelerator -> Bool
$c/= :: DescribeCustomRoutingAccelerator
-> DescribeCustomRoutingAccelerator -> Bool
== :: DescribeCustomRoutingAccelerator
-> DescribeCustomRoutingAccelerator -> Bool
$c== :: DescribeCustomRoutingAccelerator
-> DescribeCustomRoutingAccelerator -> Bool
Prelude.Eq, ReadPrec [DescribeCustomRoutingAccelerator]
ReadPrec DescribeCustomRoutingAccelerator
Int -> ReadS DescribeCustomRoutingAccelerator
ReadS [DescribeCustomRoutingAccelerator]
(Int -> ReadS DescribeCustomRoutingAccelerator)
-> ReadS [DescribeCustomRoutingAccelerator]
-> ReadPrec DescribeCustomRoutingAccelerator
-> ReadPrec [DescribeCustomRoutingAccelerator]
-> Read DescribeCustomRoutingAccelerator
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeCustomRoutingAccelerator]
$creadListPrec :: ReadPrec [DescribeCustomRoutingAccelerator]
readPrec :: ReadPrec DescribeCustomRoutingAccelerator
$creadPrec :: ReadPrec DescribeCustomRoutingAccelerator
readList :: ReadS [DescribeCustomRoutingAccelerator]
$creadList :: ReadS [DescribeCustomRoutingAccelerator]
readsPrec :: Int -> ReadS DescribeCustomRoutingAccelerator
$creadsPrec :: Int -> ReadS DescribeCustomRoutingAccelerator
Prelude.Read, Int -> DescribeCustomRoutingAccelerator -> ShowS
[DescribeCustomRoutingAccelerator] -> ShowS
DescribeCustomRoutingAccelerator -> String
(Int -> DescribeCustomRoutingAccelerator -> ShowS)
-> (DescribeCustomRoutingAccelerator -> String)
-> ([DescribeCustomRoutingAccelerator] -> ShowS)
-> Show DescribeCustomRoutingAccelerator
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeCustomRoutingAccelerator] -> ShowS
$cshowList :: [DescribeCustomRoutingAccelerator] -> ShowS
show :: DescribeCustomRoutingAccelerator -> String
$cshow :: DescribeCustomRoutingAccelerator -> String
showsPrec :: Int -> DescribeCustomRoutingAccelerator -> ShowS
$cshowsPrec :: Int -> DescribeCustomRoutingAccelerator -> ShowS
Prelude.Show, (forall x.
 DescribeCustomRoutingAccelerator
 -> Rep DescribeCustomRoutingAccelerator x)
-> (forall x.
    Rep DescribeCustomRoutingAccelerator x
    -> DescribeCustomRoutingAccelerator)
-> Generic DescribeCustomRoutingAccelerator
forall x.
Rep DescribeCustomRoutingAccelerator x
-> DescribeCustomRoutingAccelerator
forall x.
DescribeCustomRoutingAccelerator
-> Rep DescribeCustomRoutingAccelerator x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeCustomRoutingAccelerator x
-> DescribeCustomRoutingAccelerator
$cfrom :: forall x.
DescribeCustomRoutingAccelerator
-> Rep DescribeCustomRoutingAccelerator x
Prelude.Generic)

-- |
-- Create a value of 'DescribeCustomRoutingAccelerator' 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:
--
-- 'acceleratorArn', 'describeCustomRoutingAccelerator_acceleratorArn' - The Amazon Resource Name (ARN) of the accelerator to describe.
newDescribeCustomRoutingAccelerator ::
  -- | 'acceleratorArn'
  Prelude.Text ->
  DescribeCustomRoutingAccelerator
newDescribeCustomRoutingAccelerator :: Text -> DescribeCustomRoutingAccelerator
newDescribeCustomRoutingAccelerator Text
pAcceleratorArn_ =
  DescribeCustomRoutingAccelerator' :: Text -> DescribeCustomRoutingAccelerator
DescribeCustomRoutingAccelerator'
    { $sel:acceleratorArn:DescribeCustomRoutingAccelerator' :: Text
acceleratorArn =
        Text
pAcceleratorArn_
    }

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

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

instance
  Prelude.NFData
    DescribeCustomRoutingAccelerator

instance
  Core.ToHeaders
    DescribeCustomRoutingAccelerator
  where
  toHeaders :: DescribeCustomRoutingAccelerator -> ResponseHeaders
toHeaders =
    ResponseHeaders
-> DescribeCustomRoutingAccelerator -> 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.DescribeCustomRoutingAccelerator" ::
                          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 DescribeCustomRoutingAccelerator where
  toJSON :: DescribeCustomRoutingAccelerator -> Value
toJSON DescribeCustomRoutingAccelerator' {Text
acceleratorArn :: Text
$sel:acceleratorArn:DescribeCustomRoutingAccelerator' :: DescribeCustomRoutingAccelerator -> 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
"AcceleratorArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
acceleratorArn)
          ]
      )

instance Core.ToPath DescribeCustomRoutingAccelerator where
  toPath :: DescribeCustomRoutingAccelerator -> ByteString
toPath = ByteString -> DescribeCustomRoutingAccelerator -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

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

-- |
-- Create a value of 'DescribeCustomRoutingAcceleratorResponse' 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:
--
-- 'accelerator', 'describeCustomRoutingAcceleratorResponse_accelerator' - The description of the custom routing accelerator.
--
-- 'httpStatus', 'describeCustomRoutingAcceleratorResponse_httpStatus' - The response's http status code.
newDescribeCustomRoutingAcceleratorResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeCustomRoutingAcceleratorResponse
newDescribeCustomRoutingAcceleratorResponse :: Int -> DescribeCustomRoutingAcceleratorResponse
newDescribeCustomRoutingAcceleratorResponse
  Int
pHttpStatus_ =
    DescribeCustomRoutingAcceleratorResponse' :: Maybe CustomRoutingAccelerator
-> Int -> DescribeCustomRoutingAcceleratorResponse
DescribeCustomRoutingAcceleratorResponse'
      { $sel:accelerator:DescribeCustomRoutingAcceleratorResponse' :: Maybe CustomRoutingAccelerator
accelerator =
          Maybe CustomRoutingAccelerator
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:DescribeCustomRoutingAcceleratorResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

-- | The description of the custom routing accelerator.
describeCustomRoutingAcceleratorResponse_accelerator :: Lens.Lens' DescribeCustomRoutingAcceleratorResponse (Prelude.Maybe CustomRoutingAccelerator)
describeCustomRoutingAcceleratorResponse_accelerator :: (Maybe CustomRoutingAccelerator
 -> f (Maybe CustomRoutingAccelerator))
-> DescribeCustomRoutingAcceleratorResponse
-> f DescribeCustomRoutingAcceleratorResponse
describeCustomRoutingAcceleratorResponse_accelerator = (DescribeCustomRoutingAcceleratorResponse
 -> Maybe CustomRoutingAccelerator)
-> (DescribeCustomRoutingAcceleratorResponse
    -> Maybe CustomRoutingAccelerator
    -> DescribeCustomRoutingAcceleratorResponse)
-> Lens
     DescribeCustomRoutingAcceleratorResponse
     DescribeCustomRoutingAcceleratorResponse
     (Maybe CustomRoutingAccelerator)
     (Maybe CustomRoutingAccelerator)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeCustomRoutingAcceleratorResponse' {Maybe CustomRoutingAccelerator
accelerator :: Maybe CustomRoutingAccelerator
$sel:accelerator:DescribeCustomRoutingAcceleratorResponse' :: DescribeCustomRoutingAcceleratorResponse
-> Maybe CustomRoutingAccelerator
accelerator} -> Maybe CustomRoutingAccelerator
accelerator) (\s :: DescribeCustomRoutingAcceleratorResponse
s@DescribeCustomRoutingAcceleratorResponse' {} Maybe CustomRoutingAccelerator
a -> DescribeCustomRoutingAcceleratorResponse
s {$sel:accelerator:DescribeCustomRoutingAcceleratorResponse' :: Maybe CustomRoutingAccelerator
accelerator = Maybe CustomRoutingAccelerator
a} :: DescribeCustomRoutingAcceleratorResponse)

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

instance
  Prelude.NFData
    DescribeCustomRoutingAcceleratorResponse