{-# 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.CreateCachePolicy
(
CreateCachePolicy (..),
newCreateCachePolicy,
createCachePolicy_cachePolicyConfig,
CreateCachePolicyResponse (..),
newCreateCachePolicyResponse,
createCachePolicyResponse_cachePolicy,
createCachePolicyResponse_eTag,
createCachePolicyResponse_location,
createCachePolicyResponse_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 CreateCachePolicy = CreateCachePolicy'
{
CreateCachePolicy -> CachePolicyConfig
cachePolicyConfig :: CachePolicyConfig
}
deriving (CreateCachePolicy -> CreateCachePolicy -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateCachePolicy -> CreateCachePolicy -> Bool
$c/= :: CreateCachePolicy -> CreateCachePolicy -> Bool
== :: CreateCachePolicy -> CreateCachePolicy -> Bool
$c== :: CreateCachePolicy -> CreateCachePolicy -> Bool
Prelude.Eq, ReadPrec [CreateCachePolicy]
ReadPrec CreateCachePolicy
Int -> ReadS CreateCachePolicy
ReadS [CreateCachePolicy]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateCachePolicy]
$creadListPrec :: ReadPrec [CreateCachePolicy]
readPrec :: ReadPrec CreateCachePolicy
$creadPrec :: ReadPrec CreateCachePolicy
readList :: ReadS [CreateCachePolicy]
$creadList :: ReadS [CreateCachePolicy]
readsPrec :: Int -> ReadS CreateCachePolicy
$creadsPrec :: Int -> ReadS CreateCachePolicy
Prelude.Read, Int -> CreateCachePolicy -> ShowS
[CreateCachePolicy] -> ShowS
CreateCachePolicy -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateCachePolicy] -> ShowS
$cshowList :: [CreateCachePolicy] -> ShowS
show :: CreateCachePolicy -> String
$cshow :: CreateCachePolicy -> String
showsPrec :: Int -> CreateCachePolicy -> ShowS
$cshowsPrec :: Int -> CreateCachePolicy -> ShowS
Prelude.Show, forall x. Rep CreateCachePolicy x -> CreateCachePolicy
forall x. CreateCachePolicy -> Rep CreateCachePolicy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateCachePolicy x -> CreateCachePolicy
$cfrom :: forall x. CreateCachePolicy -> Rep CreateCachePolicy x
Prelude.Generic)
newCreateCachePolicy ::
CachePolicyConfig ->
CreateCachePolicy
newCreateCachePolicy :: CachePolicyConfig -> CreateCachePolicy
newCreateCachePolicy CachePolicyConfig
pCachePolicyConfig_ =
CreateCachePolicy'
{ $sel:cachePolicyConfig:CreateCachePolicy' :: CachePolicyConfig
cachePolicyConfig =
CachePolicyConfig
pCachePolicyConfig_
}
createCachePolicy_cachePolicyConfig :: Lens.Lens' CreateCachePolicy CachePolicyConfig
createCachePolicy_cachePolicyConfig :: Lens' CreateCachePolicy CachePolicyConfig
createCachePolicy_cachePolicyConfig = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCachePolicy' {CachePolicyConfig
cachePolicyConfig :: CachePolicyConfig
$sel:cachePolicyConfig:CreateCachePolicy' :: CreateCachePolicy -> CachePolicyConfig
cachePolicyConfig} -> CachePolicyConfig
cachePolicyConfig) (\s :: CreateCachePolicy
s@CreateCachePolicy' {} CachePolicyConfig
a -> CreateCachePolicy
s {$sel:cachePolicyConfig:CreateCachePolicy' :: CachePolicyConfig
cachePolicyConfig = CachePolicyConfig
a} :: CreateCachePolicy)
instance Core.AWSRequest CreateCachePolicy where
type
AWSResponse CreateCachePolicy =
CreateCachePolicyResponse
request :: (Service -> Service)
-> CreateCachePolicy -> Request CreateCachePolicy
request Service -> Service
overrides =
forall a. (ToRequest a, ToElement a) => Service -> a -> Request a
Request.postXML (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy CreateCachePolicy
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateCachePolicy)))
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 CachePolicy
-> Maybe Text -> Maybe Text -> Int -> CreateCachePolicyResponse
CreateCachePolicyResponse'
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.<*> (ResponseHeaders
h forall a.
FromText a =>
ResponseHeaders -> HeaderName -> Either String (Maybe a)
Data..#? HeaderName
"Location")
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 CreateCachePolicy where
hashWithSalt :: Int -> CreateCachePolicy -> Int
hashWithSalt Int
_salt CreateCachePolicy' {CachePolicyConfig
cachePolicyConfig :: CachePolicyConfig
$sel:cachePolicyConfig:CreateCachePolicy' :: CreateCachePolicy -> CachePolicyConfig
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` CachePolicyConfig
cachePolicyConfig
instance Prelude.NFData CreateCachePolicy where
rnf :: CreateCachePolicy -> ()
rnf CreateCachePolicy' {CachePolicyConfig
cachePolicyConfig :: CachePolicyConfig
$sel:cachePolicyConfig:CreateCachePolicy' :: CreateCachePolicy -> CachePolicyConfig
..} =
forall a. NFData a => a -> ()
Prelude.rnf CachePolicyConfig
cachePolicyConfig
instance Data.ToElement CreateCachePolicy where
toElement :: CreateCachePolicy -> Element
toElement CreateCachePolicy' {CachePolicyConfig
cachePolicyConfig :: CachePolicyConfig
$sel:cachePolicyConfig:CreateCachePolicy' :: CreateCachePolicy -> CachePolicyConfig
..} =
forall a. ToXML a => Name -> a -> Element
Data.mkElement
Name
"{http://cloudfront.amazonaws.com/doc/2020-05-31/}CachePolicyConfig"
CachePolicyConfig
cachePolicyConfig
instance Data.ToHeaders CreateCachePolicy where
toHeaders :: CreateCachePolicy -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
instance Data.ToPath CreateCachePolicy where
toPath :: CreateCachePolicy -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/2020-05-31/cache-policy"
instance Data.ToQuery CreateCachePolicy where
toQuery :: CreateCachePolicy -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data CreateCachePolicyResponse = CreateCachePolicyResponse'
{
CreateCachePolicyResponse -> Maybe CachePolicy
cachePolicy :: Prelude.Maybe CachePolicy,
CreateCachePolicyResponse -> Maybe Text
eTag :: Prelude.Maybe Prelude.Text,
CreateCachePolicyResponse -> Maybe Text
location :: Prelude.Maybe Prelude.Text,
CreateCachePolicyResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateCachePolicyResponse -> CreateCachePolicyResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateCachePolicyResponse -> CreateCachePolicyResponse -> Bool
$c/= :: CreateCachePolicyResponse -> CreateCachePolicyResponse -> Bool
== :: CreateCachePolicyResponse -> CreateCachePolicyResponse -> Bool
$c== :: CreateCachePolicyResponse -> CreateCachePolicyResponse -> Bool
Prelude.Eq, ReadPrec [CreateCachePolicyResponse]
ReadPrec CreateCachePolicyResponse
Int -> ReadS CreateCachePolicyResponse
ReadS [CreateCachePolicyResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateCachePolicyResponse]
$creadListPrec :: ReadPrec [CreateCachePolicyResponse]
readPrec :: ReadPrec CreateCachePolicyResponse
$creadPrec :: ReadPrec CreateCachePolicyResponse
readList :: ReadS [CreateCachePolicyResponse]
$creadList :: ReadS [CreateCachePolicyResponse]
readsPrec :: Int -> ReadS CreateCachePolicyResponse
$creadsPrec :: Int -> ReadS CreateCachePolicyResponse
Prelude.Read, Int -> CreateCachePolicyResponse -> ShowS
[CreateCachePolicyResponse] -> ShowS
CreateCachePolicyResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateCachePolicyResponse] -> ShowS
$cshowList :: [CreateCachePolicyResponse] -> ShowS
show :: CreateCachePolicyResponse -> String
$cshow :: CreateCachePolicyResponse -> String
showsPrec :: Int -> CreateCachePolicyResponse -> ShowS
$cshowsPrec :: Int -> CreateCachePolicyResponse -> ShowS
Prelude.Show, forall x.
Rep CreateCachePolicyResponse x -> CreateCachePolicyResponse
forall x.
CreateCachePolicyResponse -> Rep CreateCachePolicyResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateCachePolicyResponse x -> CreateCachePolicyResponse
$cfrom :: forall x.
CreateCachePolicyResponse -> Rep CreateCachePolicyResponse x
Prelude.Generic)
newCreateCachePolicyResponse ::
Prelude.Int ->
CreateCachePolicyResponse
newCreateCachePolicyResponse :: Int -> CreateCachePolicyResponse
newCreateCachePolicyResponse Int
pHttpStatus_ =
CreateCachePolicyResponse'
{ $sel:cachePolicy:CreateCachePolicyResponse' :: Maybe CachePolicy
cachePolicy =
forall a. Maybe a
Prelude.Nothing,
$sel:eTag:CreateCachePolicyResponse' :: Maybe Text
eTag = forall a. Maybe a
Prelude.Nothing,
$sel:location:CreateCachePolicyResponse' :: Maybe Text
location = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateCachePolicyResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createCachePolicyResponse_cachePolicy :: Lens.Lens' CreateCachePolicyResponse (Prelude.Maybe CachePolicy)
createCachePolicyResponse_cachePolicy :: Lens' CreateCachePolicyResponse (Maybe CachePolicy)
createCachePolicyResponse_cachePolicy = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCachePolicyResponse' {Maybe CachePolicy
cachePolicy :: Maybe CachePolicy
$sel:cachePolicy:CreateCachePolicyResponse' :: CreateCachePolicyResponse -> Maybe CachePolicy
cachePolicy} -> Maybe CachePolicy
cachePolicy) (\s :: CreateCachePolicyResponse
s@CreateCachePolicyResponse' {} Maybe CachePolicy
a -> CreateCachePolicyResponse
s {$sel:cachePolicy:CreateCachePolicyResponse' :: Maybe CachePolicy
cachePolicy = Maybe CachePolicy
a} :: CreateCachePolicyResponse)
createCachePolicyResponse_eTag :: Lens.Lens' CreateCachePolicyResponse (Prelude.Maybe Prelude.Text)
createCachePolicyResponse_eTag :: Lens' CreateCachePolicyResponse (Maybe Text)
createCachePolicyResponse_eTag = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCachePolicyResponse' {Maybe Text
eTag :: Maybe Text
$sel:eTag:CreateCachePolicyResponse' :: CreateCachePolicyResponse -> Maybe Text
eTag} -> Maybe Text
eTag) (\s :: CreateCachePolicyResponse
s@CreateCachePolicyResponse' {} Maybe Text
a -> CreateCachePolicyResponse
s {$sel:eTag:CreateCachePolicyResponse' :: Maybe Text
eTag = Maybe Text
a} :: CreateCachePolicyResponse)
createCachePolicyResponse_location :: Lens.Lens' CreateCachePolicyResponse (Prelude.Maybe Prelude.Text)
createCachePolicyResponse_location :: Lens' CreateCachePolicyResponse (Maybe Text)
createCachePolicyResponse_location = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCachePolicyResponse' {Maybe Text
location :: Maybe Text
$sel:location:CreateCachePolicyResponse' :: CreateCachePolicyResponse -> Maybe Text
location} -> Maybe Text
location) (\s :: CreateCachePolicyResponse
s@CreateCachePolicyResponse' {} Maybe Text
a -> CreateCachePolicyResponse
s {$sel:location:CreateCachePolicyResponse' :: Maybe Text
location = Maybe Text
a} :: CreateCachePolicyResponse)
createCachePolicyResponse_httpStatus :: Lens.Lens' CreateCachePolicyResponse Prelude.Int
createCachePolicyResponse_httpStatus :: Lens' CreateCachePolicyResponse Int
createCachePolicyResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCachePolicyResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateCachePolicyResponse' :: CreateCachePolicyResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateCachePolicyResponse
s@CreateCachePolicyResponse' {} Int
a -> CreateCachePolicyResponse
s {$sel:httpStatus:CreateCachePolicyResponse' :: Int
httpStatus = Int
a} :: CreateCachePolicyResponse)
instance Prelude.NFData CreateCachePolicyResponse where
rnf :: CreateCachePolicyResponse -> ()
rnf CreateCachePolicyResponse' {Int
Maybe Text
Maybe CachePolicy
httpStatus :: Int
location :: Maybe Text
eTag :: Maybe Text
cachePolicy :: Maybe CachePolicy
$sel:httpStatus:CreateCachePolicyResponse' :: CreateCachePolicyResponse -> Int
$sel:location:CreateCachePolicyResponse' :: CreateCachePolicyResponse -> Maybe Text
$sel:eTag:CreateCachePolicyResponse' :: CreateCachePolicyResponse -> Maybe Text
$sel:cachePolicy:CreateCachePolicyResponse' :: CreateCachePolicyResponse -> Maybe CachePolicy
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe CachePolicy
cachePolicy
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 Maybe Text
location
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus