{-# 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.UpdateCachePolicy
(
UpdateCachePolicy (..),
newUpdateCachePolicy,
updateCachePolicy_ifMatch,
updateCachePolicy_cachePolicyConfig,
updateCachePolicy_id,
UpdateCachePolicyResponse (..),
newUpdateCachePolicyResponse,
updateCachePolicyResponse_cachePolicy,
updateCachePolicyResponse_eTag,
updateCachePolicyResponse_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 UpdateCachePolicy = UpdateCachePolicy'
{
UpdateCachePolicy -> Maybe Text
ifMatch :: Prelude.Maybe Prelude.Text,
UpdateCachePolicy -> CachePolicyConfig
cachePolicyConfig :: CachePolicyConfig,
UpdateCachePolicy -> Text
id :: Prelude.Text
}
deriving (UpdateCachePolicy -> UpdateCachePolicy -> Bool
(UpdateCachePolicy -> UpdateCachePolicy -> Bool)
-> (UpdateCachePolicy -> UpdateCachePolicy -> Bool)
-> Eq UpdateCachePolicy
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateCachePolicy -> UpdateCachePolicy -> Bool
$c/= :: UpdateCachePolicy -> UpdateCachePolicy -> Bool
== :: UpdateCachePolicy -> UpdateCachePolicy -> Bool
$c== :: UpdateCachePolicy -> UpdateCachePolicy -> Bool
Prelude.Eq, ReadPrec [UpdateCachePolicy]
ReadPrec UpdateCachePolicy
Int -> ReadS UpdateCachePolicy
ReadS [UpdateCachePolicy]
(Int -> ReadS UpdateCachePolicy)
-> ReadS [UpdateCachePolicy]
-> ReadPrec UpdateCachePolicy
-> ReadPrec [UpdateCachePolicy]
-> Read UpdateCachePolicy
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateCachePolicy]
$creadListPrec :: ReadPrec [UpdateCachePolicy]
readPrec :: ReadPrec UpdateCachePolicy
$creadPrec :: ReadPrec UpdateCachePolicy
readList :: ReadS [UpdateCachePolicy]
$creadList :: ReadS [UpdateCachePolicy]
readsPrec :: Int -> ReadS UpdateCachePolicy
$creadsPrec :: Int -> ReadS UpdateCachePolicy
Prelude.Read, Int -> UpdateCachePolicy -> ShowS
[UpdateCachePolicy] -> ShowS
UpdateCachePolicy -> String
(Int -> UpdateCachePolicy -> ShowS)
-> (UpdateCachePolicy -> String)
-> ([UpdateCachePolicy] -> ShowS)
-> Show UpdateCachePolicy
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateCachePolicy] -> ShowS
$cshowList :: [UpdateCachePolicy] -> ShowS
show :: UpdateCachePolicy -> String
$cshow :: UpdateCachePolicy -> String
showsPrec :: Int -> UpdateCachePolicy -> ShowS
$cshowsPrec :: Int -> UpdateCachePolicy -> ShowS
Prelude.Show, (forall x. UpdateCachePolicy -> Rep UpdateCachePolicy x)
-> (forall x. Rep UpdateCachePolicy x -> UpdateCachePolicy)
-> Generic UpdateCachePolicy
forall x. Rep UpdateCachePolicy x -> UpdateCachePolicy
forall x. UpdateCachePolicy -> Rep UpdateCachePolicy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateCachePolicy x -> UpdateCachePolicy
$cfrom :: forall x. UpdateCachePolicy -> Rep UpdateCachePolicy x
Prelude.Generic)
newUpdateCachePolicy ::
CachePolicyConfig ->
Prelude.Text ->
UpdateCachePolicy
newUpdateCachePolicy :: CachePolicyConfig -> Text -> UpdateCachePolicy
newUpdateCachePolicy CachePolicyConfig
pCachePolicyConfig_ Text
pId_ =
UpdateCachePolicy' :: Maybe Text -> CachePolicyConfig -> Text -> UpdateCachePolicy
UpdateCachePolicy'
{ $sel:ifMatch:UpdateCachePolicy' :: Maybe Text
ifMatch = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:cachePolicyConfig:UpdateCachePolicy' :: CachePolicyConfig
cachePolicyConfig = CachePolicyConfig
pCachePolicyConfig_,
$sel:id:UpdateCachePolicy' :: Text
id = Text
pId_
}
updateCachePolicy_ifMatch :: Lens.Lens' UpdateCachePolicy (Prelude.Maybe Prelude.Text)
updateCachePolicy_ifMatch :: (Maybe Text -> f (Maybe Text))
-> UpdateCachePolicy -> f UpdateCachePolicy
updateCachePolicy_ifMatch = (UpdateCachePolicy -> Maybe Text)
-> (UpdateCachePolicy -> Maybe Text -> UpdateCachePolicy)
-> Lens
UpdateCachePolicy UpdateCachePolicy (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateCachePolicy' {Maybe Text
ifMatch :: Maybe Text
$sel:ifMatch:UpdateCachePolicy' :: UpdateCachePolicy -> Maybe Text
ifMatch} -> Maybe Text
ifMatch) (\s :: UpdateCachePolicy
s@UpdateCachePolicy' {} Maybe Text
a -> UpdateCachePolicy
s {$sel:ifMatch:UpdateCachePolicy' :: Maybe Text
ifMatch = Maybe Text
a} :: UpdateCachePolicy)
updateCachePolicy_cachePolicyConfig :: Lens.Lens' UpdateCachePolicy CachePolicyConfig
updateCachePolicy_cachePolicyConfig :: (CachePolicyConfig -> f CachePolicyConfig)
-> UpdateCachePolicy -> f UpdateCachePolicy
updateCachePolicy_cachePolicyConfig = (UpdateCachePolicy -> CachePolicyConfig)
-> (UpdateCachePolicy -> CachePolicyConfig -> UpdateCachePolicy)
-> Lens
UpdateCachePolicy
UpdateCachePolicy
CachePolicyConfig
CachePolicyConfig
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateCachePolicy' {CachePolicyConfig
cachePolicyConfig :: CachePolicyConfig
$sel:cachePolicyConfig:UpdateCachePolicy' :: UpdateCachePolicy -> CachePolicyConfig
cachePolicyConfig} -> CachePolicyConfig
cachePolicyConfig) (\s :: UpdateCachePolicy
s@UpdateCachePolicy' {} CachePolicyConfig
a -> UpdateCachePolicy
s {$sel:cachePolicyConfig:UpdateCachePolicy' :: CachePolicyConfig
cachePolicyConfig = CachePolicyConfig
a} :: UpdateCachePolicy)
updateCachePolicy_id :: Lens.Lens' UpdateCachePolicy Prelude.Text
updateCachePolicy_id :: (Text -> f Text) -> UpdateCachePolicy -> f UpdateCachePolicy
updateCachePolicy_id = (UpdateCachePolicy -> Text)
-> (UpdateCachePolicy -> Text -> UpdateCachePolicy)
-> Lens UpdateCachePolicy UpdateCachePolicy Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateCachePolicy' {Text
id :: Text
$sel:id:UpdateCachePolicy' :: UpdateCachePolicy -> Text
id} -> Text
id) (\s :: UpdateCachePolicy
s@UpdateCachePolicy' {} Text
a -> UpdateCachePolicy
s {$sel:id:UpdateCachePolicy' :: Text
id = Text
a} :: UpdateCachePolicy)
instance Core.AWSRequest UpdateCachePolicy where
type
AWSResponse UpdateCachePolicy =
UpdateCachePolicyResponse
request :: UpdateCachePolicy -> Request UpdateCachePolicy
request = Service -> UpdateCachePolicy -> Request UpdateCachePolicy
forall a. (ToRequest a, ToElement a) => Service -> a -> Request a
Request.putXML Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateCachePolicy
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateCachePolicy)))
response =
(Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse UpdateCachePolicy))
-> Logger
-> Service
-> Proxy UpdateCachePolicy
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateCachePolicy)))
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 CachePolicy -> Maybe Text -> Int -> UpdateCachePolicyResponse
UpdateCachePolicyResponse'
(Maybe CachePolicy
-> Maybe Text -> Int -> UpdateCachePolicyResponse)
-> Either String (Maybe CachePolicy)
-> Either String (Maybe Text -> Int -> UpdateCachePolicyResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node] -> Either String (Maybe CachePolicy)
forall a. FromXML a => [Node] -> Either String a
Core.parseXML [Node]
x)
Either String (Maybe Text -> Int -> UpdateCachePolicyResponse)
-> Either String (Maybe Text)
-> Either String (Int -> UpdateCachePolicyResponse)
forall (f :: * -> *) a b. Applicative f => 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 (Int -> UpdateCachePolicyResponse)
-> Either String Int -> Either String UpdateCachePolicyResponse
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 UpdateCachePolicy
instance Prelude.NFData UpdateCachePolicy
instance Core.ToElement UpdateCachePolicy where
toElement :: UpdateCachePolicy -> Element
toElement UpdateCachePolicy' {Maybe Text
Text
CachePolicyConfig
id :: Text
cachePolicyConfig :: CachePolicyConfig
ifMatch :: Maybe Text
$sel:id:UpdateCachePolicy' :: UpdateCachePolicy -> Text
$sel:cachePolicyConfig:UpdateCachePolicy' :: UpdateCachePolicy -> CachePolicyConfig
$sel:ifMatch:UpdateCachePolicy' :: UpdateCachePolicy -> Maybe Text
..} =
Name -> CachePolicyConfig -> Element
forall a. ToXML a => Name -> a -> Element
Core.mkElement
Name
"{http://cloudfront.amazonaws.com/doc/2020-05-31/}CachePolicyConfig"
CachePolicyConfig
cachePolicyConfig
instance Core.ToHeaders UpdateCachePolicy where
toHeaders :: UpdateCachePolicy -> ResponseHeaders
toHeaders UpdateCachePolicy' {Maybe Text
Text
CachePolicyConfig
id :: Text
cachePolicyConfig :: CachePolicyConfig
ifMatch :: Maybe Text
$sel:id:UpdateCachePolicy' :: UpdateCachePolicy -> Text
$sel:cachePolicyConfig:UpdateCachePolicy' :: UpdateCachePolicy -> CachePolicyConfig
$sel:ifMatch:UpdateCachePolicy' :: UpdateCachePolicy -> Maybe Text
..} =
[ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat [HeaderName
"If-Match" HeaderName -> Maybe Text -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# Maybe Text
ifMatch]
instance Core.ToPath UpdateCachePolicy where
toPath :: UpdateCachePolicy -> ByteString
toPath UpdateCachePolicy' {Maybe Text
Text
CachePolicyConfig
id :: Text
cachePolicyConfig :: CachePolicyConfig
ifMatch :: Maybe Text
$sel:id:UpdateCachePolicy' :: UpdateCachePolicy -> Text
$sel:cachePolicyConfig:UpdateCachePolicy' :: UpdateCachePolicy -> CachePolicyConfig
$sel:ifMatch:UpdateCachePolicy' :: UpdateCachePolicy -> Maybe Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/2020-05-31/cache-policy/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
id]
instance Core.ToQuery UpdateCachePolicy where
toQuery :: UpdateCachePolicy -> QueryString
toQuery = QueryString -> UpdateCachePolicy -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateCachePolicyResponse = UpdateCachePolicyResponse'
{
UpdateCachePolicyResponse -> Maybe CachePolicy
cachePolicy :: Prelude.Maybe CachePolicy,
UpdateCachePolicyResponse -> Maybe Text
eTag :: Prelude.Maybe Prelude.Text,
UpdateCachePolicyResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateCachePolicyResponse -> UpdateCachePolicyResponse -> Bool
(UpdateCachePolicyResponse -> UpdateCachePolicyResponse -> Bool)
-> (UpdateCachePolicyResponse -> UpdateCachePolicyResponse -> Bool)
-> Eq UpdateCachePolicyResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateCachePolicyResponse -> UpdateCachePolicyResponse -> Bool
$c/= :: UpdateCachePolicyResponse -> UpdateCachePolicyResponse -> Bool
== :: UpdateCachePolicyResponse -> UpdateCachePolicyResponse -> Bool
$c== :: UpdateCachePolicyResponse -> UpdateCachePolicyResponse -> Bool
Prelude.Eq, ReadPrec [UpdateCachePolicyResponse]
ReadPrec UpdateCachePolicyResponse
Int -> ReadS UpdateCachePolicyResponse
ReadS [UpdateCachePolicyResponse]
(Int -> ReadS UpdateCachePolicyResponse)
-> ReadS [UpdateCachePolicyResponse]
-> ReadPrec UpdateCachePolicyResponse
-> ReadPrec [UpdateCachePolicyResponse]
-> Read UpdateCachePolicyResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateCachePolicyResponse]
$creadListPrec :: ReadPrec [UpdateCachePolicyResponse]
readPrec :: ReadPrec UpdateCachePolicyResponse
$creadPrec :: ReadPrec UpdateCachePolicyResponse
readList :: ReadS [UpdateCachePolicyResponse]
$creadList :: ReadS [UpdateCachePolicyResponse]
readsPrec :: Int -> ReadS UpdateCachePolicyResponse
$creadsPrec :: Int -> ReadS UpdateCachePolicyResponse
Prelude.Read, Int -> UpdateCachePolicyResponse -> ShowS
[UpdateCachePolicyResponse] -> ShowS
UpdateCachePolicyResponse -> String
(Int -> UpdateCachePolicyResponse -> ShowS)
-> (UpdateCachePolicyResponse -> String)
-> ([UpdateCachePolicyResponse] -> ShowS)
-> Show UpdateCachePolicyResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateCachePolicyResponse] -> ShowS
$cshowList :: [UpdateCachePolicyResponse] -> ShowS
show :: UpdateCachePolicyResponse -> String
$cshow :: UpdateCachePolicyResponse -> String
showsPrec :: Int -> UpdateCachePolicyResponse -> ShowS
$cshowsPrec :: Int -> UpdateCachePolicyResponse -> ShowS
Prelude.Show, (forall x.
UpdateCachePolicyResponse -> Rep UpdateCachePolicyResponse x)
-> (forall x.
Rep UpdateCachePolicyResponse x -> UpdateCachePolicyResponse)
-> Generic UpdateCachePolicyResponse
forall x.
Rep UpdateCachePolicyResponse x -> UpdateCachePolicyResponse
forall x.
UpdateCachePolicyResponse -> Rep UpdateCachePolicyResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateCachePolicyResponse x -> UpdateCachePolicyResponse
$cfrom :: forall x.
UpdateCachePolicyResponse -> Rep UpdateCachePolicyResponse x
Prelude.Generic)
newUpdateCachePolicyResponse ::
Prelude.Int ->
UpdateCachePolicyResponse
newUpdateCachePolicyResponse :: Int -> UpdateCachePolicyResponse
newUpdateCachePolicyResponse Int
pHttpStatus_ =
UpdateCachePolicyResponse' :: Maybe CachePolicy -> Maybe Text -> Int -> UpdateCachePolicyResponse
UpdateCachePolicyResponse'
{ $sel:cachePolicy:UpdateCachePolicyResponse' :: Maybe CachePolicy
cachePolicy =
Maybe CachePolicy
forall a. Maybe a
Prelude.Nothing,
$sel:eTag:UpdateCachePolicyResponse' :: Maybe Text
eTag = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:UpdateCachePolicyResponse' :: Int
httpStatus = Int
pHttpStatus_
}
updateCachePolicyResponse_cachePolicy :: Lens.Lens' UpdateCachePolicyResponse (Prelude.Maybe CachePolicy)
updateCachePolicyResponse_cachePolicy :: (Maybe CachePolicy -> f (Maybe CachePolicy))
-> UpdateCachePolicyResponse -> f UpdateCachePolicyResponse
updateCachePolicyResponse_cachePolicy = (UpdateCachePolicyResponse -> Maybe CachePolicy)
-> (UpdateCachePolicyResponse
-> Maybe CachePolicy -> UpdateCachePolicyResponse)
-> Lens
UpdateCachePolicyResponse
UpdateCachePolicyResponse
(Maybe CachePolicy)
(Maybe CachePolicy)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateCachePolicyResponse' {Maybe CachePolicy
cachePolicy :: Maybe CachePolicy
$sel:cachePolicy:UpdateCachePolicyResponse' :: UpdateCachePolicyResponse -> Maybe CachePolicy
cachePolicy} -> Maybe CachePolicy
cachePolicy) (\s :: UpdateCachePolicyResponse
s@UpdateCachePolicyResponse' {} Maybe CachePolicy
a -> UpdateCachePolicyResponse
s {$sel:cachePolicy:UpdateCachePolicyResponse' :: Maybe CachePolicy
cachePolicy = Maybe CachePolicy
a} :: UpdateCachePolicyResponse)
updateCachePolicyResponse_eTag :: Lens.Lens' UpdateCachePolicyResponse (Prelude.Maybe Prelude.Text)
updateCachePolicyResponse_eTag :: (Maybe Text -> f (Maybe Text))
-> UpdateCachePolicyResponse -> f UpdateCachePolicyResponse
updateCachePolicyResponse_eTag = (UpdateCachePolicyResponse -> Maybe Text)
-> (UpdateCachePolicyResponse
-> Maybe Text -> UpdateCachePolicyResponse)
-> Lens
UpdateCachePolicyResponse
UpdateCachePolicyResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateCachePolicyResponse' {Maybe Text
eTag :: Maybe Text
$sel:eTag:UpdateCachePolicyResponse' :: UpdateCachePolicyResponse -> Maybe Text
eTag} -> Maybe Text
eTag) (\s :: UpdateCachePolicyResponse
s@UpdateCachePolicyResponse' {} Maybe Text
a -> UpdateCachePolicyResponse
s {$sel:eTag:UpdateCachePolicyResponse' :: Maybe Text
eTag = Maybe Text
a} :: UpdateCachePolicyResponse)
updateCachePolicyResponse_httpStatus :: Lens.Lens' UpdateCachePolicyResponse Prelude.Int
updateCachePolicyResponse_httpStatus :: (Int -> f Int)
-> UpdateCachePolicyResponse -> f UpdateCachePolicyResponse
updateCachePolicyResponse_httpStatus = (UpdateCachePolicyResponse -> Int)
-> (UpdateCachePolicyResponse -> Int -> UpdateCachePolicyResponse)
-> Lens UpdateCachePolicyResponse UpdateCachePolicyResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateCachePolicyResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateCachePolicyResponse' :: UpdateCachePolicyResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateCachePolicyResponse
s@UpdateCachePolicyResponse' {} Int
a -> UpdateCachePolicyResponse
s {$sel:httpStatus:UpdateCachePolicyResponse' :: Int
httpStatus = Int
a} :: UpdateCachePolicyResponse)
instance Prelude.NFData UpdateCachePolicyResponse