{-# 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.DescribeAccelerator
(
DescribeAccelerator (..),
newDescribeAccelerator,
describeAccelerator_acceleratorArn,
DescribeAcceleratorResponse (..),
newDescribeAcceleratorResponse,
describeAcceleratorResponse_accelerator,
describeAcceleratorResponse_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 DescribeAccelerator = DescribeAccelerator'
{
DescribeAccelerator -> Text
acceleratorArn :: Prelude.Text
}
deriving (DescribeAccelerator -> DescribeAccelerator -> Bool
(DescribeAccelerator -> DescribeAccelerator -> Bool)
-> (DescribeAccelerator -> DescribeAccelerator -> Bool)
-> Eq DescribeAccelerator
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeAccelerator -> DescribeAccelerator -> Bool
$c/= :: DescribeAccelerator -> DescribeAccelerator -> Bool
== :: DescribeAccelerator -> DescribeAccelerator -> Bool
$c== :: DescribeAccelerator -> DescribeAccelerator -> Bool
Prelude.Eq, ReadPrec [DescribeAccelerator]
ReadPrec DescribeAccelerator
Int -> ReadS DescribeAccelerator
ReadS [DescribeAccelerator]
(Int -> ReadS DescribeAccelerator)
-> ReadS [DescribeAccelerator]
-> ReadPrec DescribeAccelerator
-> ReadPrec [DescribeAccelerator]
-> Read DescribeAccelerator
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeAccelerator]
$creadListPrec :: ReadPrec [DescribeAccelerator]
readPrec :: ReadPrec DescribeAccelerator
$creadPrec :: ReadPrec DescribeAccelerator
readList :: ReadS [DescribeAccelerator]
$creadList :: ReadS [DescribeAccelerator]
readsPrec :: Int -> ReadS DescribeAccelerator
$creadsPrec :: Int -> ReadS DescribeAccelerator
Prelude.Read, Int -> DescribeAccelerator -> ShowS
[DescribeAccelerator] -> ShowS
DescribeAccelerator -> String
(Int -> DescribeAccelerator -> ShowS)
-> (DescribeAccelerator -> String)
-> ([DescribeAccelerator] -> ShowS)
-> Show DescribeAccelerator
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeAccelerator] -> ShowS
$cshowList :: [DescribeAccelerator] -> ShowS
show :: DescribeAccelerator -> String
$cshow :: DescribeAccelerator -> String
showsPrec :: Int -> DescribeAccelerator -> ShowS
$cshowsPrec :: Int -> DescribeAccelerator -> ShowS
Prelude.Show, (forall x. DescribeAccelerator -> Rep DescribeAccelerator x)
-> (forall x. Rep DescribeAccelerator x -> DescribeAccelerator)
-> Generic DescribeAccelerator
forall x. Rep DescribeAccelerator x -> DescribeAccelerator
forall x. DescribeAccelerator -> Rep DescribeAccelerator x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeAccelerator x -> DescribeAccelerator
$cfrom :: forall x. DescribeAccelerator -> Rep DescribeAccelerator x
Prelude.Generic)
newDescribeAccelerator ::
Prelude.Text ->
DescribeAccelerator
newDescribeAccelerator :: Text -> DescribeAccelerator
newDescribeAccelerator Text
pAcceleratorArn_ =
DescribeAccelerator' :: Text -> DescribeAccelerator
DescribeAccelerator'
{ $sel:acceleratorArn:DescribeAccelerator' :: Text
acceleratorArn =
Text
pAcceleratorArn_
}
describeAccelerator_acceleratorArn :: Lens.Lens' DescribeAccelerator Prelude.Text
describeAccelerator_acceleratorArn :: (Text -> f Text) -> DescribeAccelerator -> f DescribeAccelerator
describeAccelerator_acceleratorArn = (DescribeAccelerator -> Text)
-> (DescribeAccelerator -> Text -> DescribeAccelerator)
-> Lens DescribeAccelerator DescribeAccelerator Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAccelerator' {Text
acceleratorArn :: Text
$sel:acceleratorArn:DescribeAccelerator' :: DescribeAccelerator -> Text
acceleratorArn} -> Text
acceleratorArn) (\s :: DescribeAccelerator
s@DescribeAccelerator' {} Text
a -> DescribeAccelerator
s {$sel:acceleratorArn:DescribeAccelerator' :: Text
acceleratorArn = Text
a} :: DescribeAccelerator)
instance Core.AWSRequest DescribeAccelerator where
type
AWSResponse DescribeAccelerator =
DescribeAcceleratorResponse
request :: DescribeAccelerator -> Request DescribeAccelerator
request = Service -> DescribeAccelerator -> Request DescribeAccelerator
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DescribeAccelerator
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DescribeAccelerator)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DescribeAccelerator))
-> Logger
-> Service
-> Proxy DescribeAccelerator
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DescribeAccelerator)))
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 Accelerator -> Int -> DescribeAcceleratorResponse
DescribeAcceleratorResponse'
(Maybe Accelerator -> Int -> DescribeAcceleratorResponse)
-> Either String (Maybe Accelerator)
-> Either String (Int -> DescribeAcceleratorResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Accelerator)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Accelerator")
Either String (Int -> DescribeAcceleratorResponse)
-> Either String Int -> Either String DescribeAcceleratorResponse
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 DescribeAccelerator
instance Prelude.NFData DescribeAccelerator
instance Core.ToHeaders DescribeAccelerator where
toHeaders :: DescribeAccelerator -> ResponseHeaders
toHeaders =
ResponseHeaders -> DescribeAccelerator -> 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.DescribeAccelerator" ::
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 DescribeAccelerator where
toJSON :: DescribeAccelerator -> Value
toJSON DescribeAccelerator' {Text
acceleratorArn :: Text
$sel:acceleratorArn:DescribeAccelerator' :: DescribeAccelerator -> 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 DescribeAccelerator where
toPath :: DescribeAccelerator -> ByteString
toPath = ByteString -> DescribeAccelerator -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DescribeAccelerator where
toQuery :: DescribeAccelerator -> QueryString
toQuery = QueryString -> DescribeAccelerator -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DescribeAcceleratorResponse = DescribeAcceleratorResponse'
{
DescribeAcceleratorResponse -> Maybe Accelerator
accelerator :: Prelude.Maybe Accelerator,
DescribeAcceleratorResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DescribeAcceleratorResponse -> DescribeAcceleratorResponse -> Bool
(DescribeAcceleratorResponse
-> DescribeAcceleratorResponse -> Bool)
-> (DescribeAcceleratorResponse
-> DescribeAcceleratorResponse -> Bool)
-> Eq DescribeAcceleratorResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeAcceleratorResponse -> DescribeAcceleratorResponse -> Bool
$c/= :: DescribeAcceleratorResponse -> DescribeAcceleratorResponse -> Bool
== :: DescribeAcceleratorResponse -> DescribeAcceleratorResponse -> Bool
$c== :: DescribeAcceleratorResponse -> DescribeAcceleratorResponse -> Bool
Prelude.Eq, ReadPrec [DescribeAcceleratorResponse]
ReadPrec DescribeAcceleratorResponse
Int -> ReadS DescribeAcceleratorResponse
ReadS [DescribeAcceleratorResponse]
(Int -> ReadS DescribeAcceleratorResponse)
-> ReadS [DescribeAcceleratorResponse]
-> ReadPrec DescribeAcceleratorResponse
-> ReadPrec [DescribeAcceleratorResponse]
-> Read DescribeAcceleratorResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeAcceleratorResponse]
$creadListPrec :: ReadPrec [DescribeAcceleratorResponse]
readPrec :: ReadPrec DescribeAcceleratorResponse
$creadPrec :: ReadPrec DescribeAcceleratorResponse
readList :: ReadS [DescribeAcceleratorResponse]
$creadList :: ReadS [DescribeAcceleratorResponse]
readsPrec :: Int -> ReadS DescribeAcceleratorResponse
$creadsPrec :: Int -> ReadS DescribeAcceleratorResponse
Prelude.Read, Int -> DescribeAcceleratorResponse -> ShowS
[DescribeAcceleratorResponse] -> ShowS
DescribeAcceleratorResponse -> String
(Int -> DescribeAcceleratorResponse -> ShowS)
-> (DescribeAcceleratorResponse -> String)
-> ([DescribeAcceleratorResponse] -> ShowS)
-> Show DescribeAcceleratorResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeAcceleratorResponse] -> ShowS
$cshowList :: [DescribeAcceleratorResponse] -> ShowS
show :: DescribeAcceleratorResponse -> String
$cshow :: DescribeAcceleratorResponse -> String
showsPrec :: Int -> DescribeAcceleratorResponse -> ShowS
$cshowsPrec :: Int -> DescribeAcceleratorResponse -> ShowS
Prelude.Show, (forall x.
DescribeAcceleratorResponse -> Rep DescribeAcceleratorResponse x)
-> (forall x.
Rep DescribeAcceleratorResponse x -> DescribeAcceleratorResponse)
-> Generic DescribeAcceleratorResponse
forall x.
Rep DescribeAcceleratorResponse x -> DescribeAcceleratorResponse
forall x.
DescribeAcceleratorResponse -> Rep DescribeAcceleratorResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeAcceleratorResponse x -> DescribeAcceleratorResponse
$cfrom :: forall x.
DescribeAcceleratorResponse -> Rep DescribeAcceleratorResponse x
Prelude.Generic)
newDescribeAcceleratorResponse ::
Prelude.Int ->
DescribeAcceleratorResponse
newDescribeAcceleratorResponse :: Int -> DescribeAcceleratorResponse
newDescribeAcceleratorResponse Int
pHttpStatus_ =
DescribeAcceleratorResponse' :: Maybe Accelerator -> Int -> DescribeAcceleratorResponse
DescribeAcceleratorResponse'
{ $sel:accelerator:DescribeAcceleratorResponse' :: Maybe Accelerator
accelerator =
Maybe Accelerator
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DescribeAcceleratorResponse' :: Int
httpStatus = Int
pHttpStatus_
}
describeAcceleratorResponse_accelerator :: Lens.Lens' DescribeAcceleratorResponse (Prelude.Maybe Accelerator)
describeAcceleratorResponse_accelerator :: (Maybe Accelerator -> f (Maybe Accelerator))
-> DescribeAcceleratorResponse -> f DescribeAcceleratorResponse
describeAcceleratorResponse_accelerator = (DescribeAcceleratorResponse -> Maybe Accelerator)
-> (DescribeAcceleratorResponse
-> Maybe Accelerator -> DescribeAcceleratorResponse)
-> Lens
DescribeAcceleratorResponse
DescribeAcceleratorResponse
(Maybe Accelerator)
(Maybe Accelerator)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAcceleratorResponse' {Maybe Accelerator
accelerator :: Maybe Accelerator
$sel:accelerator:DescribeAcceleratorResponse' :: DescribeAcceleratorResponse -> Maybe Accelerator
accelerator} -> Maybe Accelerator
accelerator) (\s :: DescribeAcceleratorResponse
s@DescribeAcceleratorResponse' {} Maybe Accelerator
a -> DescribeAcceleratorResponse
s {$sel:accelerator:DescribeAcceleratorResponse' :: Maybe Accelerator
accelerator = Maybe Accelerator
a} :: DescribeAcceleratorResponse)
describeAcceleratorResponse_httpStatus :: Lens.Lens' DescribeAcceleratorResponse Prelude.Int
describeAcceleratorResponse_httpStatus :: (Int -> f Int)
-> DescribeAcceleratorResponse -> f DescribeAcceleratorResponse
describeAcceleratorResponse_httpStatus = (DescribeAcceleratorResponse -> Int)
-> (DescribeAcceleratorResponse
-> Int -> DescribeAcceleratorResponse)
-> Lens
DescribeAcceleratorResponse DescribeAcceleratorResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAcceleratorResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeAcceleratorResponse' :: DescribeAcceleratorResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeAcceleratorResponse
s@DescribeAcceleratorResponse' {} Int
a -> DescribeAcceleratorResponse
s {$sel:httpStatus:DescribeAcceleratorResponse' :: Int
httpStatus = Int
a} :: DescribeAcceleratorResponse)
instance Prelude.NFData DescribeAcceleratorResponse