{-# 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.CloudFront.GetDistributionConfig
(
GetDistributionConfig (..),
newGetDistributionConfig,
getDistributionConfig_id,
GetDistributionConfigResponse (..),
newGetDistributionConfigResponse,
getDistributionConfigResponse_distributionConfig,
getDistributionConfigResponse_eTag,
getDistributionConfigResponse_httpStatus,
)
where
import Amazonka.CloudFront.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data GetDistributionConfig = GetDistributionConfig'
{
GetDistributionConfig -> Text
id :: Prelude.Text
}
deriving (GetDistributionConfig -> GetDistributionConfig -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetDistributionConfig -> GetDistributionConfig -> Bool
$c/= :: GetDistributionConfig -> GetDistributionConfig -> Bool
== :: GetDistributionConfig -> GetDistributionConfig -> Bool
$c== :: GetDistributionConfig -> GetDistributionConfig -> Bool
Prelude.Eq, ReadPrec [GetDistributionConfig]
ReadPrec GetDistributionConfig
Int -> ReadS GetDistributionConfig
ReadS [GetDistributionConfig]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetDistributionConfig]
$creadListPrec :: ReadPrec [GetDistributionConfig]
readPrec :: ReadPrec GetDistributionConfig
$creadPrec :: ReadPrec GetDistributionConfig
readList :: ReadS [GetDistributionConfig]
$creadList :: ReadS [GetDistributionConfig]
readsPrec :: Int -> ReadS GetDistributionConfig
$creadsPrec :: Int -> ReadS GetDistributionConfig
Prelude.Read, Int -> GetDistributionConfig -> ShowS
[GetDistributionConfig] -> ShowS
GetDistributionConfig -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetDistributionConfig] -> ShowS
$cshowList :: [GetDistributionConfig] -> ShowS
show :: GetDistributionConfig -> String
$cshow :: GetDistributionConfig -> String
showsPrec :: Int -> GetDistributionConfig -> ShowS
$cshowsPrec :: Int -> GetDistributionConfig -> ShowS
Prelude.Show, forall x. Rep GetDistributionConfig x -> GetDistributionConfig
forall x. GetDistributionConfig -> Rep GetDistributionConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetDistributionConfig x -> GetDistributionConfig
$cfrom :: forall x. GetDistributionConfig -> Rep GetDistributionConfig x
Prelude.Generic)
newGetDistributionConfig ::
Prelude.Text ->
GetDistributionConfig
newGetDistributionConfig :: Text -> GetDistributionConfig
newGetDistributionConfig Text
pId_ =
GetDistributionConfig' {$sel:id:GetDistributionConfig' :: Text
id = Text
pId_}
getDistributionConfig_id :: Lens.Lens' GetDistributionConfig Prelude.Text
getDistributionConfig_id :: Lens' GetDistributionConfig Text
getDistributionConfig_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDistributionConfig' {Text
id :: Text
$sel:id:GetDistributionConfig' :: GetDistributionConfig -> Text
id} -> Text
id) (\s :: GetDistributionConfig
s@GetDistributionConfig' {} Text
a -> GetDistributionConfig
s {$sel:id:GetDistributionConfig' :: Text
id = Text
a} :: GetDistributionConfig)
instance Core.AWSRequest GetDistributionConfig where
type
AWSResponse GetDistributionConfig =
GetDistributionConfigResponse
request :: (Service -> Service)
-> GetDistributionConfig -> Request GetDistributionConfig
request Service -> Service
overrides =
forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetDistributionConfig
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetDistributionConfig)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXML
( \Int
s ResponseHeaders
h [Node]
x ->
Maybe DistributionConfig
-> Maybe Text -> Int -> GetDistributionConfigResponse
GetDistributionConfigResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (forall a. FromXML a => [Node] -> Either String a
Data.parseXML [Node]
x)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (ResponseHeaders
h forall a.
FromText a =>
ResponseHeaders -> HeaderName -> Either String (Maybe a)
Data..#? HeaderName
"ETag")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable GetDistributionConfig where
hashWithSalt :: Int -> GetDistributionConfig -> Int
hashWithSalt Int
_salt GetDistributionConfig' {Text
id :: Text
$sel:id:GetDistributionConfig' :: GetDistributionConfig -> Text
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
id
instance Prelude.NFData GetDistributionConfig where
rnf :: GetDistributionConfig -> ()
rnf GetDistributionConfig' {Text
id :: Text
$sel:id:GetDistributionConfig' :: GetDistributionConfig -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
id
instance Data.ToHeaders GetDistributionConfig where
toHeaders :: GetDistributionConfig -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
instance Data.ToPath GetDistributionConfig where
toPath :: GetDistributionConfig -> ByteString
toPath GetDistributionConfig' {Text
id :: Text
$sel:id:GetDistributionConfig' :: GetDistributionConfig -> Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/2020-05-31/distribution/",
forall a. ToByteString a => a -> ByteString
Data.toBS Text
id,
ByteString
"/config"
]
instance Data.ToQuery GetDistributionConfig where
toQuery :: GetDistributionConfig -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data GetDistributionConfigResponse = GetDistributionConfigResponse'
{
GetDistributionConfigResponse -> Maybe DistributionConfig
distributionConfig :: Prelude.Maybe DistributionConfig,
GetDistributionConfigResponse -> Maybe Text
eTag :: Prelude.Maybe Prelude.Text,
GetDistributionConfigResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetDistributionConfigResponse
-> GetDistributionConfigResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetDistributionConfigResponse
-> GetDistributionConfigResponse -> Bool
$c/= :: GetDistributionConfigResponse
-> GetDistributionConfigResponse -> Bool
== :: GetDistributionConfigResponse
-> GetDistributionConfigResponse -> Bool
$c== :: GetDistributionConfigResponse
-> GetDistributionConfigResponse -> Bool
Prelude.Eq, Int -> GetDistributionConfigResponse -> ShowS
[GetDistributionConfigResponse] -> ShowS
GetDistributionConfigResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetDistributionConfigResponse] -> ShowS
$cshowList :: [GetDistributionConfigResponse] -> ShowS
show :: GetDistributionConfigResponse -> String
$cshow :: GetDistributionConfigResponse -> String
showsPrec :: Int -> GetDistributionConfigResponse -> ShowS
$cshowsPrec :: Int -> GetDistributionConfigResponse -> ShowS
Prelude.Show, forall x.
Rep GetDistributionConfigResponse x
-> GetDistributionConfigResponse
forall x.
GetDistributionConfigResponse
-> Rep GetDistributionConfigResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetDistributionConfigResponse x
-> GetDistributionConfigResponse
$cfrom :: forall x.
GetDistributionConfigResponse
-> Rep GetDistributionConfigResponse x
Prelude.Generic)
newGetDistributionConfigResponse ::
Prelude.Int ->
GetDistributionConfigResponse
newGetDistributionConfigResponse :: Int -> GetDistributionConfigResponse
newGetDistributionConfigResponse Int
pHttpStatus_ =
GetDistributionConfigResponse'
{ $sel:distributionConfig:GetDistributionConfigResponse' :: Maybe DistributionConfig
distributionConfig =
forall a. Maybe a
Prelude.Nothing,
$sel:eTag:GetDistributionConfigResponse' :: Maybe Text
eTag = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetDistributionConfigResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getDistributionConfigResponse_distributionConfig :: Lens.Lens' GetDistributionConfigResponse (Prelude.Maybe DistributionConfig)
getDistributionConfigResponse_distributionConfig :: Lens' GetDistributionConfigResponse (Maybe DistributionConfig)
getDistributionConfigResponse_distributionConfig = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDistributionConfigResponse' {Maybe DistributionConfig
distributionConfig :: Maybe DistributionConfig
$sel:distributionConfig:GetDistributionConfigResponse' :: GetDistributionConfigResponse -> Maybe DistributionConfig
distributionConfig} -> Maybe DistributionConfig
distributionConfig) (\s :: GetDistributionConfigResponse
s@GetDistributionConfigResponse' {} Maybe DistributionConfig
a -> GetDistributionConfigResponse
s {$sel:distributionConfig:GetDistributionConfigResponse' :: Maybe DistributionConfig
distributionConfig = Maybe DistributionConfig
a} :: GetDistributionConfigResponse)
getDistributionConfigResponse_eTag :: Lens.Lens' GetDistributionConfigResponse (Prelude.Maybe Prelude.Text)
getDistributionConfigResponse_eTag :: Lens' GetDistributionConfigResponse (Maybe Text)
getDistributionConfigResponse_eTag = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDistributionConfigResponse' {Maybe Text
eTag :: Maybe Text
$sel:eTag:GetDistributionConfigResponse' :: GetDistributionConfigResponse -> Maybe Text
eTag} -> Maybe Text
eTag) (\s :: GetDistributionConfigResponse
s@GetDistributionConfigResponse' {} Maybe Text
a -> GetDistributionConfigResponse
s {$sel:eTag:GetDistributionConfigResponse' :: Maybe Text
eTag = Maybe Text
a} :: GetDistributionConfigResponse)
getDistributionConfigResponse_httpStatus :: Lens.Lens' GetDistributionConfigResponse Prelude.Int
getDistributionConfigResponse_httpStatus :: Lens' GetDistributionConfigResponse Int
getDistributionConfigResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDistributionConfigResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetDistributionConfigResponse' :: GetDistributionConfigResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetDistributionConfigResponse
s@GetDistributionConfigResponse' {} Int
a -> GetDistributionConfigResponse
s {$sel:httpStatus:GetDistributionConfigResponse' :: Int
httpStatus = Int
a} :: GetDistributionConfigResponse)
instance Prelude.NFData GetDistributionConfigResponse where
rnf :: GetDistributionConfigResponse -> ()
rnf GetDistributionConfigResponse' {Int
Maybe Text
Maybe DistributionConfig
httpStatus :: Int
eTag :: Maybe Text
distributionConfig :: Maybe DistributionConfig
$sel:httpStatus:GetDistributionConfigResponse' :: GetDistributionConfigResponse -> Int
$sel:eTag:GetDistributionConfigResponse' :: GetDistributionConfigResponse -> Maybe Text
$sel:distributionConfig:GetDistributionConfigResponse' :: GetDistributionConfigResponse -> Maybe DistributionConfig
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe DistributionConfig
distributionConfig
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
eTag
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus