{-# 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.GetCachePolicyConfig
(
GetCachePolicyConfig (..),
newGetCachePolicyConfig,
getCachePolicyConfig_id,
GetCachePolicyConfigResponse (..),
newGetCachePolicyConfigResponse,
getCachePolicyConfigResponse_cachePolicyConfig,
getCachePolicyConfigResponse_eTag,
getCachePolicyConfigResponse_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 GetCachePolicyConfig = GetCachePolicyConfig'
{
GetCachePolicyConfig -> Text
id :: Prelude.Text
}
deriving (GetCachePolicyConfig -> GetCachePolicyConfig -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetCachePolicyConfig -> GetCachePolicyConfig -> Bool
$c/= :: GetCachePolicyConfig -> GetCachePolicyConfig -> Bool
== :: GetCachePolicyConfig -> GetCachePolicyConfig -> Bool
$c== :: GetCachePolicyConfig -> GetCachePolicyConfig -> Bool
Prelude.Eq, ReadPrec [GetCachePolicyConfig]
ReadPrec GetCachePolicyConfig
Int -> ReadS GetCachePolicyConfig
ReadS [GetCachePolicyConfig]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetCachePolicyConfig]
$creadListPrec :: ReadPrec [GetCachePolicyConfig]
readPrec :: ReadPrec GetCachePolicyConfig
$creadPrec :: ReadPrec GetCachePolicyConfig
readList :: ReadS [GetCachePolicyConfig]
$creadList :: ReadS [GetCachePolicyConfig]
readsPrec :: Int -> ReadS GetCachePolicyConfig
$creadsPrec :: Int -> ReadS GetCachePolicyConfig
Prelude.Read, Int -> GetCachePolicyConfig -> ShowS
[GetCachePolicyConfig] -> ShowS
GetCachePolicyConfig -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetCachePolicyConfig] -> ShowS
$cshowList :: [GetCachePolicyConfig] -> ShowS
show :: GetCachePolicyConfig -> String
$cshow :: GetCachePolicyConfig -> String
showsPrec :: Int -> GetCachePolicyConfig -> ShowS
$cshowsPrec :: Int -> GetCachePolicyConfig -> ShowS
Prelude.Show, forall x. Rep GetCachePolicyConfig x -> GetCachePolicyConfig
forall x. GetCachePolicyConfig -> Rep GetCachePolicyConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetCachePolicyConfig x -> GetCachePolicyConfig
$cfrom :: forall x. GetCachePolicyConfig -> Rep GetCachePolicyConfig x
Prelude.Generic)
newGetCachePolicyConfig ::
Prelude.Text ->
GetCachePolicyConfig
newGetCachePolicyConfig :: Text -> GetCachePolicyConfig
newGetCachePolicyConfig Text
pId_ =
GetCachePolicyConfig' {$sel:id:GetCachePolicyConfig' :: Text
id = Text
pId_}
getCachePolicyConfig_id :: Lens.Lens' GetCachePolicyConfig Prelude.Text
getCachePolicyConfig_id :: Lens' GetCachePolicyConfig Text
getCachePolicyConfig_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCachePolicyConfig' {Text
id :: Text
$sel:id:GetCachePolicyConfig' :: GetCachePolicyConfig -> Text
id} -> Text
id) (\s :: GetCachePolicyConfig
s@GetCachePolicyConfig' {} Text
a -> GetCachePolicyConfig
s {$sel:id:GetCachePolicyConfig' :: Text
id = Text
a} :: GetCachePolicyConfig)
instance Core.AWSRequest GetCachePolicyConfig where
type
AWSResponse GetCachePolicyConfig =
GetCachePolicyConfigResponse
request :: (Service -> Service)
-> GetCachePolicyConfig -> Request GetCachePolicyConfig
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 GetCachePolicyConfig
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetCachePolicyConfig)))
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 CachePolicyConfig
-> Maybe Text -> Int -> GetCachePolicyConfigResponse
GetCachePolicyConfigResponse'
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 GetCachePolicyConfig where
hashWithSalt :: Int -> GetCachePolicyConfig -> Int
hashWithSalt Int
_salt GetCachePolicyConfig' {Text
id :: Text
$sel:id:GetCachePolicyConfig' :: GetCachePolicyConfig -> Text
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
id
instance Prelude.NFData GetCachePolicyConfig where
rnf :: GetCachePolicyConfig -> ()
rnf GetCachePolicyConfig' {Text
id :: Text
$sel:id:GetCachePolicyConfig' :: GetCachePolicyConfig -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
id
instance Data.ToHeaders GetCachePolicyConfig where
toHeaders :: GetCachePolicyConfig -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
instance Data.ToPath GetCachePolicyConfig where
toPath :: GetCachePolicyConfig -> ByteString
toPath GetCachePolicyConfig' {Text
id :: Text
$sel:id:GetCachePolicyConfig' :: GetCachePolicyConfig -> Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/2020-05-31/cache-policy/",
forall a. ToByteString a => a -> ByteString
Data.toBS Text
id,
ByteString
"/config"
]
instance Data.ToQuery GetCachePolicyConfig where
toQuery :: GetCachePolicyConfig -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data GetCachePolicyConfigResponse = GetCachePolicyConfigResponse'
{
GetCachePolicyConfigResponse -> Maybe CachePolicyConfig
cachePolicyConfig :: Prelude.Maybe CachePolicyConfig,
GetCachePolicyConfigResponse -> Maybe Text
eTag :: Prelude.Maybe Prelude.Text,
GetCachePolicyConfigResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetCachePolicyConfigResponse
-> GetCachePolicyConfigResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetCachePolicyConfigResponse
-> GetCachePolicyConfigResponse -> Bool
$c/= :: GetCachePolicyConfigResponse
-> GetCachePolicyConfigResponse -> Bool
== :: GetCachePolicyConfigResponse
-> GetCachePolicyConfigResponse -> Bool
$c== :: GetCachePolicyConfigResponse
-> GetCachePolicyConfigResponse -> Bool
Prelude.Eq, ReadPrec [GetCachePolicyConfigResponse]
ReadPrec GetCachePolicyConfigResponse
Int -> ReadS GetCachePolicyConfigResponse
ReadS [GetCachePolicyConfigResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetCachePolicyConfigResponse]
$creadListPrec :: ReadPrec [GetCachePolicyConfigResponse]
readPrec :: ReadPrec GetCachePolicyConfigResponse
$creadPrec :: ReadPrec GetCachePolicyConfigResponse
readList :: ReadS [GetCachePolicyConfigResponse]
$creadList :: ReadS [GetCachePolicyConfigResponse]
readsPrec :: Int -> ReadS GetCachePolicyConfigResponse
$creadsPrec :: Int -> ReadS GetCachePolicyConfigResponse
Prelude.Read, Int -> GetCachePolicyConfigResponse -> ShowS
[GetCachePolicyConfigResponse] -> ShowS
GetCachePolicyConfigResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetCachePolicyConfigResponse] -> ShowS
$cshowList :: [GetCachePolicyConfigResponse] -> ShowS
show :: GetCachePolicyConfigResponse -> String
$cshow :: GetCachePolicyConfigResponse -> String
showsPrec :: Int -> GetCachePolicyConfigResponse -> ShowS
$cshowsPrec :: Int -> GetCachePolicyConfigResponse -> ShowS
Prelude.Show, forall x.
Rep GetCachePolicyConfigResponse x -> GetCachePolicyConfigResponse
forall x.
GetCachePolicyConfigResponse -> Rep GetCachePolicyConfigResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetCachePolicyConfigResponse x -> GetCachePolicyConfigResponse
$cfrom :: forall x.
GetCachePolicyConfigResponse -> Rep GetCachePolicyConfigResponse x
Prelude.Generic)
newGetCachePolicyConfigResponse ::
Prelude.Int ->
GetCachePolicyConfigResponse
newGetCachePolicyConfigResponse :: Int -> GetCachePolicyConfigResponse
newGetCachePolicyConfigResponse Int
pHttpStatus_ =
GetCachePolicyConfigResponse'
{ $sel:cachePolicyConfig:GetCachePolicyConfigResponse' :: Maybe CachePolicyConfig
cachePolicyConfig =
forall a. Maybe a
Prelude.Nothing,
$sel:eTag:GetCachePolicyConfigResponse' :: Maybe Text
eTag = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetCachePolicyConfigResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getCachePolicyConfigResponse_cachePolicyConfig :: Lens.Lens' GetCachePolicyConfigResponse (Prelude.Maybe CachePolicyConfig)
getCachePolicyConfigResponse_cachePolicyConfig :: Lens' GetCachePolicyConfigResponse (Maybe CachePolicyConfig)
getCachePolicyConfigResponse_cachePolicyConfig = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCachePolicyConfigResponse' {Maybe CachePolicyConfig
cachePolicyConfig :: Maybe CachePolicyConfig
$sel:cachePolicyConfig:GetCachePolicyConfigResponse' :: GetCachePolicyConfigResponse -> Maybe CachePolicyConfig
cachePolicyConfig} -> Maybe CachePolicyConfig
cachePolicyConfig) (\s :: GetCachePolicyConfigResponse
s@GetCachePolicyConfigResponse' {} Maybe CachePolicyConfig
a -> GetCachePolicyConfigResponse
s {$sel:cachePolicyConfig:GetCachePolicyConfigResponse' :: Maybe CachePolicyConfig
cachePolicyConfig = Maybe CachePolicyConfig
a} :: GetCachePolicyConfigResponse)
getCachePolicyConfigResponse_eTag :: Lens.Lens' GetCachePolicyConfigResponse (Prelude.Maybe Prelude.Text)
getCachePolicyConfigResponse_eTag :: Lens' GetCachePolicyConfigResponse (Maybe Text)
getCachePolicyConfigResponse_eTag = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCachePolicyConfigResponse' {Maybe Text
eTag :: Maybe Text
$sel:eTag:GetCachePolicyConfigResponse' :: GetCachePolicyConfigResponse -> Maybe Text
eTag} -> Maybe Text
eTag) (\s :: GetCachePolicyConfigResponse
s@GetCachePolicyConfigResponse' {} Maybe Text
a -> GetCachePolicyConfigResponse
s {$sel:eTag:GetCachePolicyConfigResponse' :: Maybe Text
eTag = Maybe Text
a} :: GetCachePolicyConfigResponse)
getCachePolicyConfigResponse_httpStatus :: Lens.Lens' GetCachePolicyConfigResponse Prelude.Int
getCachePolicyConfigResponse_httpStatus :: Lens' GetCachePolicyConfigResponse Int
getCachePolicyConfigResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCachePolicyConfigResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetCachePolicyConfigResponse' :: GetCachePolicyConfigResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetCachePolicyConfigResponse
s@GetCachePolicyConfigResponse' {} Int
a -> GetCachePolicyConfigResponse
s {$sel:httpStatus:GetCachePolicyConfigResponse' :: Int
httpStatus = Int
a} :: GetCachePolicyConfigResponse)
instance Prelude.NFData GetCachePolicyConfigResponse where
rnf :: GetCachePolicyConfigResponse -> ()
rnf GetCachePolicyConfigResponse' {Int
Maybe Text
Maybe CachePolicyConfig
httpStatus :: Int
eTag :: Maybe Text
cachePolicyConfig :: Maybe CachePolicyConfig
$sel:httpStatus:GetCachePolicyConfigResponse' :: GetCachePolicyConfigResponse -> Int
$sel:eTag:GetCachePolicyConfigResponse' :: GetCachePolicyConfigResponse -> Maybe Text
$sel:cachePolicyConfig:GetCachePolicyConfigResponse' :: GetCachePolicyConfigResponse -> Maybe CachePolicyConfig
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe CachePolicyConfig
cachePolicyConfig
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