{-# 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_eTag,
getDistributionConfigResponse_distributionConfig,
getDistributionConfigResponse_httpStatus,
)
where
import Amazonka.CloudFront.Types
import qualified Amazonka.Core as Core
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 GetDistributionConfig = GetDistributionConfig'
{
GetDistributionConfig -> Text
id :: Prelude.Text
}
deriving (GetDistributionConfig -> GetDistributionConfig -> Bool
(GetDistributionConfig -> GetDistributionConfig -> Bool)
-> (GetDistributionConfig -> GetDistributionConfig -> Bool)
-> Eq GetDistributionConfig
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]
(Int -> ReadS GetDistributionConfig)
-> ReadS [GetDistributionConfig]
-> ReadPrec GetDistributionConfig
-> ReadPrec [GetDistributionConfig]
-> Read 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
(Int -> GetDistributionConfig -> ShowS)
-> (GetDistributionConfig -> String)
-> ([GetDistributionConfig] -> ShowS)
-> Show GetDistributionConfig
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. GetDistributionConfig -> Rep GetDistributionConfig x)
-> (forall x. Rep GetDistributionConfig x -> GetDistributionConfig)
-> Generic GetDistributionConfig
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' :: Text -> GetDistributionConfig
GetDistributionConfig' {$sel:id:GetDistributionConfig' :: Text
id = Text
pId_}
getDistributionConfig_id :: Lens.Lens' GetDistributionConfig Prelude.Text
getDistributionConfig_id :: (Text -> f Text)
-> GetDistributionConfig -> f GetDistributionConfig
getDistributionConfig_id = (GetDistributionConfig -> Text)
-> (GetDistributionConfig -> Text -> GetDistributionConfig)
-> Lens GetDistributionConfig GetDistributionConfig Text Text
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 :: GetDistributionConfig -> Request GetDistributionConfig
request = Service -> GetDistributionConfig -> Request GetDistributionConfig
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetDistributionConfig
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetDistributionConfig)))
response =
(Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse GetDistributionConfig))
-> Logger
-> Service
-> Proxy GetDistributionConfig
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetDistributionConfig)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXML
( \Int
s ResponseHeaders
h [Node]
x ->
Maybe Text
-> Maybe DistributionConfig -> Int -> GetDistributionConfigResponse
GetDistributionConfigResponse'
(Maybe Text
-> Maybe DistributionConfig
-> Int
-> GetDistributionConfigResponse)
-> Either String (Maybe Text)
-> Either
String
(Maybe DistributionConfig -> Int -> GetDistributionConfigResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (ResponseHeaders
h ResponseHeaders -> HeaderName -> Either String (Maybe Text)
forall a.
FromText a =>
ResponseHeaders -> HeaderName -> Either String (Maybe a)
Core..#? HeaderName
"ETag")
Either
String
(Maybe DistributionConfig -> Int -> GetDistributionConfigResponse)
-> Either String (Maybe DistributionConfig)
-> Either String (Int -> GetDistributionConfigResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node] -> Either String (Maybe DistributionConfig)
forall a. FromXML a => [Node] -> Either String a
Core.parseXML [Node]
x)
Either String (Int -> GetDistributionConfigResponse)
-> Either String Int -> Either String GetDistributionConfigResponse
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 GetDistributionConfig
instance Prelude.NFData GetDistributionConfig
instance Core.ToHeaders GetDistributionConfig where
toHeaders :: GetDistributionConfig -> ResponseHeaders
toHeaders = ResponseHeaders -> GetDistributionConfig -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath GetDistributionConfig where
toPath :: GetDistributionConfig -> ByteString
toPath GetDistributionConfig' {Text
id :: Text
$sel:id:GetDistributionConfig' :: GetDistributionConfig -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/2020-05-31/distribution/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
id,
ByteString
"/config"
]
instance Core.ToQuery GetDistributionConfig where
toQuery :: GetDistributionConfig -> QueryString
toQuery = QueryString -> GetDistributionConfig -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetDistributionConfigResponse = GetDistributionConfigResponse'
{
GetDistributionConfigResponse -> Maybe Text
eTag :: Prelude.Maybe Prelude.Text,
GetDistributionConfigResponse -> Maybe DistributionConfig
distributionConfig :: Prelude.Maybe DistributionConfig,
GetDistributionConfigResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetDistributionConfigResponse
-> GetDistributionConfigResponse -> Bool
(GetDistributionConfigResponse
-> GetDistributionConfigResponse -> Bool)
-> (GetDistributionConfigResponse
-> GetDistributionConfigResponse -> Bool)
-> Eq GetDistributionConfigResponse
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
(Int -> GetDistributionConfigResponse -> ShowS)
-> (GetDistributionConfigResponse -> String)
-> ([GetDistributionConfigResponse] -> ShowS)
-> Show GetDistributionConfigResponse
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.
GetDistributionConfigResponse
-> Rep GetDistributionConfigResponse x)
-> (forall x.
Rep GetDistributionConfigResponse x
-> GetDistributionConfigResponse)
-> Generic GetDistributionConfigResponse
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' :: Maybe Text
-> Maybe DistributionConfig -> Int -> GetDistributionConfigResponse
GetDistributionConfigResponse'
{ $sel:eTag:GetDistributionConfigResponse' :: Maybe Text
eTag =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:distributionConfig:GetDistributionConfigResponse' :: Maybe DistributionConfig
distributionConfig = Maybe DistributionConfig
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetDistributionConfigResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getDistributionConfigResponse_eTag :: Lens.Lens' GetDistributionConfigResponse (Prelude.Maybe Prelude.Text)
getDistributionConfigResponse_eTag :: (Maybe Text -> f (Maybe Text))
-> GetDistributionConfigResponse -> f GetDistributionConfigResponse
getDistributionConfigResponse_eTag = (GetDistributionConfigResponse -> Maybe Text)
-> (GetDistributionConfigResponse
-> Maybe Text -> GetDistributionConfigResponse)
-> Lens
GetDistributionConfigResponse
GetDistributionConfigResponse
(Maybe Text)
(Maybe Text)
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_distributionConfig :: Lens.Lens' GetDistributionConfigResponse (Prelude.Maybe DistributionConfig)
getDistributionConfigResponse_distributionConfig :: (Maybe DistributionConfig -> f (Maybe DistributionConfig))
-> GetDistributionConfigResponse -> f GetDistributionConfigResponse
getDistributionConfigResponse_distributionConfig = (GetDistributionConfigResponse -> Maybe DistributionConfig)
-> (GetDistributionConfigResponse
-> Maybe DistributionConfig -> GetDistributionConfigResponse)
-> Lens
GetDistributionConfigResponse
GetDistributionConfigResponse
(Maybe DistributionConfig)
(Maybe 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_httpStatus :: Lens.Lens' GetDistributionConfigResponse Prelude.Int
getDistributionConfigResponse_httpStatus :: (Int -> f Int)
-> GetDistributionConfigResponse -> f GetDistributionConfigResponse
getDistributionConfigResponse_httpStatus = (GetDistributionConfigResponse -> Int)
-> (GetDistributionConfigResponse
-> Int -> GetDistributionConfigResponse)
-> Lens
GetDistributionConfigResponse GetDistributionConfigResponse Int Int
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