{-# 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.ListCachePolicies
(
ListCachePolicies (..),
newListCachePolicies,
listCachePolicies_marker,
listCachePolicies_maxItems,
listCachePolicies_type,
ListCachePoliciesResponse (..),
newListCachePoliciesResponse,
listCachePoliciesResponse_cachePolicyList,
listCachePoliciesResponse_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 ListCachePolicies = ListCachePolicies'
{
ListCachePolicies -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
ListCachePolicies -> Maybe Text
maxItems :: Prelude.Maybe Prelude.Text,
ListCachePolicies -> Maybe CachePolicyType
type' :: Prelude.Maybe CachePolicyType
}
deriving (ListCachePolicies -> ListCachePolicies -> Bool
(ListCachePolicies -> ListCachePolicies -> Bool)
-> (ListCachePolicies -> ListCachePolicies -> Bool)
-> Eq ListCachePolicies
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListCachePolicies -> ListCachePolicies -> Bool
$c/= :: ListCachePolicies -> ListCachePolicies -> Bool
== :: ListCachePolicies -> ListCachePolicies -> Bool
$c== :: ListCachePolicies -> ListCachePolicies -> Bool
Prelude.Eq, ReadPrec [ListCachePolicies]
ReadPrec ListCachePolicies
Int -> ReadS ListCachePolicies
ReadS [ListCachePolicies]
(Int -> ReadS ListCachePolicies)
-> ReadS [ListCachePolicies]
-> ReadPrec ListCachePolicies
-> ReadPrec [ListCachePolicies]
-> Read ListCachePolicies
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListCachePolicies]
$creadListPrec :: ReadPrec [ListCachePolicies]
readPrec :: ReadPrec ListCachePolicies
$creadPrec :: ReadPrec ListCachePolicies
readList :: ReadS [ListCachePolicies]
$creadList :: ReadS [ListCachePolicies]
readsPrec :: Int -> ReadS ListCachePolicies
$creadsPrec :: Int -> ReadS ListCachePolicies
Prelude.Read, Int -> ListCachePolicies -> ShowS
[ListCachePolicies] -> ShowS
ListCachePolicies -> String
(Int -> ListCachePolicies -> ShowS)
-> (ListCachePolicies -> String)
-> ([ListCachePolicies] -> ShowS)
-> Show ListCachePolicies
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListCachePolicies] -> ShowS
$cshowList :: [ListCachePolicies] -> ShowS
show :: ListCachePolicies -> String
$cshow :: ListCachePolicies -> String
showsPrec :: Int -> ListCachePolicies -> ShowS
$cshowsPrec :: Int -> ListCachePolicies -> ShowS
Prelude.Show, (forall x. ListCachePolicies -> Rep ListCachePolicies x)
-> (forall x. Rep ListCachePolicies x -> ListCachePolicies)
-> Generic ListCachePolicies
forall x. Rep ListCachePolicies x -> ListCachePolicies
forall x. ListCachePolicies -> Rep ListCachePolicies x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListCachePolicies x -> ListCachePolicies
$cfrom :: forall x. ListCachePolicies -> Rep ListCachePolicies x
Prelude.Generic)
newListCachePolicies ::
ListCachePolicies
newListCachePolicies :: ListCachePolicies
newListCachePolicies =
ListCachePolicies' :: Maybe Text
-> Maybe Text -> Maybe CachePolicyType -> ListCachePolicies
ListCachePolicies'
{ $sel:marker:ListCachePolicies' :: Maybe Text
marker = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:maxItems:ListCachePolicies' :: Maybe Text
maxItems = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:type':ListCachePolicies' :: Maybe CachePolicyType
type' = Maybe CachePolicyType
forall a. Maybe a
Prelude.Nothing
}
listCachePolicies_marker :: Lens.Lens' ListCachePolicies (Prelude.Maybe Prelude.Text)
listCachePolicies_marker :: (Maybe Text -> f (Maybe Text))
-> ListCachePolicies -> f ListCachePolicies
listCachePolicies_marker = (ListCachePolicies -> Maybe Text)
-> (ListCachePolicies -> Maybe Text -> ListCachePolicies)
-> Lens
ListCachePolicies ListCachePolicies (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListCachePolicies' {Maybe Text
marker :: Maybe Text
$sel:marker:ListCachePolicies' :: ListCachePolicies -> Maybe Text
marker} -> Maybe Text
marker) (\s :: ListCachePolicies
s@ListCachePolicies' {} Maybe Text
a -> ListCachePolicies
s {$sel:marker:ListCachePolicies' :: Maybe Text
marker = Maybe Text
a} :: ListCachePolicies)
listCachePolicies_maxItems :: Lens.Lens' ListCachePolicies (Prelude.Maybe Prelude.Text)
listCachePolicies_maxItems :: (Maybe Text -> f (Maybe Text))
-> ListCachePolicies -> f ListCachePolicies
listCachePolicies_maxItems = (ListCachePolicies -> Maybe Text)
-> (ListCachePolicies -> Maybe Text -> ListCachePolicies)
-> Lens
ListCachePolicies ListCachePolicies (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListCachePolicies' {Maybe Text
maxItems :: Maybe Text
$sel:maxItems:ListCachePolicies' :: ListCachePolicies -> Maybe Text
maxItems} -> Maybe Text
maxItems) (\s :: ListCachePolicies
s@ListCachePolicies' {} Maybe Text
a -> ListCachePolicies
s {$sel:maxItems:ListCachePolicies' :: Maybe Text
maxItems = Maybe Text
a} :: ListCachePolicies)
listCachePolicies_type :: Lens.Lens' ListCachePolicies (Prelude.Maybe CachePolicyType)
listCachePolicies_type :: (Maybe CachePolicyType -> f (Maybe CachePolicyType))
-> ListCachePolicies -> f ListCachePolicies
listCachePolicies_type = (ListCachePolicies -> Maybe CachePolicyType)
-> (ListCachePolicies
-> Maybe CachePolicyType -> ListCachePolicies)
-> Lens
ListCachePolicies
ListCachePolicies
(Maybe CachePolicyType)
(Maybe CachePolicyType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListCachePolicies' {Maybe CachePolicyType
type' :: Maybe CachePolicyType
$sel:type':ListCachePolicies' :: ListCachePolicies -> Maybe CachePolicyType
type'} -> Maybe CachePolicyType
type') (\s :: ListCachePolicies
s@ListCachePolicies' {} Maybe CachePolicyType
a -> ListCachePolicies
s {$sel:type':ListCachePolicies' :: Maybe CachePolicyType
type' = Maybe CachePolicyType
a} :: ListCachePolicies)
instance Core.AWSRequest ListCachePolicies where
type
AWSResponse ListCachePolicies =
ListCachePoliciesResponse
request :: ListCachePolicies -> Request ListCachePolicies
request = Service -> ListCachePolicies -> Request ListCachePolicies
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy ListCachePolicies
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ListCachePolicies)))
response =
(Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse ListCachePolicies))
-> Logger
-> Service
-> Proxy ListCachePolicies
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ListCachePolicies)))
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 CachePolicyList -> Int -> ListCachePoliciesResponse
ListCachePoliciesResponse'
(Maybe CachePolicyList -> Int -> ListCachePoliciesResponse)
-> Either String (Maybe CachePolicyList)
-> Either String (Int -> ListCachePoliciesResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node] -> Either String (Maybe CachePolicyList)
forall a. FromXML a => [Node] -> Either String a
Core.parseXML [Node]
x)
Either String (Int -> ListCachePoliciesResponse)
-> Either String Int -> Either String ListCachePoliciesResponse
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 ListCachePolicies
instance Prelude.NFData ListCachePolicies
instance Core.ToHeaders ListCachePolicies where
toHeaders :: ListCachePolicies -> ResponseHeaders
toHeaders = ResponseHeaders -> ListCachePolicies -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath ListCachePolicies where
toPath :: ListCachePolicies -> ByteString
toPath = ByteString -> ListCachePolicies -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/2020-05-31/cache-policy"
instance Core.ToQuery ListCachePolicies where
toQuery :: ListCachePolicies -> QueryString
toQuery ListCachePolicies' {Maybe Text
Maybe CachePolicyType
type' :: Maybe CachePolicyType
maxItems :: Maybe Text
marker :: Maybe Text
$sel:type':ListCachePolicies' :: ListCachePolicies -> Maybe CachePolicyType
$sel:maxItems:ListCachePolicies' :: ListCachePolicies -> Maybe Text
$sel:marker:ListCachePolicies' :: ListCachePolicies -> Maybe Text
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"Marker" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
marker,
ByteString
"MaxItems" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
maxItems,
ByteString
"Type" ByteString -> Maybe CachePolicyType -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe CachePolicyType
type'
]
data ListCachePoliciesResponse = ListCachePoliciesResponse'
{
ListCachePoliciesResponse -> Maybe CachePolicyList
cachePolicyList :: Prelude.Maybe CachePolicyList,
ListCachePoliciesResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListCachePoliciesResponse -> ListCachePoliciesResponse -> Bool
(ListCachePoliciesResponse -> ListCachePoliciesResponse -> Bool)
-> (ListCachePoliciesResponse -> ListCachePoliciesResponse -> Bool)
-> Eq ListCachePoliciesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListCachePoliciesResponse -> ListCachePoliciesResponse -> Bool
$c/= :: ListCachePoliciesResponse -> ListCachePoliciesResponse -> Bool
== :: ListCachePoliciesResponse -> ListCachePoliciesResponse -> Bool
$c== :: ListCachePoliciesResponse -> ListCachePoliciesResponse -> Bool
Prelude.Eq, ReadPrec [ListCachePoliciesResponse]
ReadPrec ListCachePoliciesResponse
Int -> ReadS ListCachePoliciesResponse
ReadS [ListCachePoliciesResponse]
(Int -> ReadS ListCachePoliciesResponse)
-> ReadS [ListCachePoliciesResponse]
-> ReadPrec ListCachePoliciesResponse
-> ReadPrec [ListCachePoliciesResponse]
-> Read ListCachePoliciesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListCachePoliciesResponse]
$creadListPrec :: ReadPrec [ListCachePoliciesResponse]
readPrec :: ReadPrec ListCachePoliciesResponse
$creadPrec :: ReadPrec ListCachePoliciesResponse
readList :: ReadS [ListCachePoliciesResponse]
$creadList :: ReadS [ListCachePoliciesResponse]
readsPrec :: Int -> ReadS ListCachePoliciesResponse
$creadsPrec :: Int -> ReadS ListCachePoliciesResponse
Prelude.Read, Int -> ListCachePoliciesResponse -> ShowS
[ListCachePoliciesResponse] -> ShowS
ListCachePoliciesResponse -> String
(Int -> ListCachePoliciesResponse -> ShowS)
-> (ListCachePoliciesResponse -> String)
-> ([ListCachePoliciesResponse] -> ShowS)
-> Show ListCachePoliciesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListCachePoliciesResponse] -> ShowS
$cshowList :: [ListCachePoliciesResponse] -> ShowS
show :: ListCachePoliciesResponse -> String
$cshow :: ListCachePoliciesResponse -> String
showsPrec :: Int -> ListCachePoliciesResponse -> ShowS
$cshowsPrec :: Int -> ListCachePoliciesResponse -> ShowS
Prelude.Show, (forall x.
ListCachePoliciesResponse -> Rep ListCachePoliciesResponse x)
-> (forall x.
Rep ListCachePoliciesResponse x -> ListCachePoliciesResponse)
-> Generic ListCachePoliciesResponse
forall x.
Rep ListCachePoliciesResponse x -> ListCachePoliciesResponse
forall x.
ListCachePoliciesResponse -> Rep ListCachePoliciesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListCachePoliciesResponse x -> ListCachePoliciesResponse
$cfrom :: forall x.
ListCachePoliciesResponse -> Rep ListCachePoliciesResponse x
Prelude.Generic)
newListCachePoliciesResponse ::
Prelude.Int ->
ListCachePoliciesResponse
newListCachePoliciesResponse :: Int -> ListCachePoliciesResponse
newListCachePoliciesResponse Int
pHttpStatus_ =
ListCachePoliciesResponse' :: Maybe CachePolicyList -> Int -> ListCachePoliciesResponse
ListCachePoliciesResponse'
{ $sel:cachePolicyList:ListCachePoliciesResponse' :: Maybe CachePolicyList
cachePolicyList =
Maybe CachePolicyList
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListCachePoliciesResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listCachePoliciesResponse_cachePolicyList :: Lens.Lens' ListCachePoliciesResponse (Prelude.Maybe CachePolicyList)
listCachePoliciesResponse_cachePolicyList :: (Maybe CachePolicyList -> f (Maybe CachePolicyList))
-> ListCachePoliciesResponse -> f ListCachePoliciesResponse
listCachePoliciesResponse_cachePolicyList = (ListCachePoliciesResponse -> Maybe CachePolicyList)
-> (ListCachePoliciesResponse
-> Maybe CachePolicyList -> ListCachePoliciesResponse)
-> Lens
ListCachePoliciesResponse
ListCachePoliciesResponse
(Maybe CachePolicyList)
(Maybe CachePolicyList)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListCachePoliciesResponse' {Maybe CachePolicyList
cachePolicyList :: Maybe CachePolicyList
$sel:cachePolicyList:ListCachePoliciesResponse' :: ListCachePoliciesResponse -> Maybe CachePolicyList
cachePolicyList} -> Maybe CachePolicyList
cachePolicyList) (\s :: ListCachePoliciesResponse
s@ListCachePoliciesResponse' {} Maybe CachePolicyList
a -> ListCachePoliciesResponse
s {$sel:cachePolicyList:ListCachePoliciesResponse' :: Maybe CachePolicyList
cachePolicyList = Maybe CachePolicyList
a} :: ListCachePoliciesResponse)
listCachePoliciesResponse_httpStatus :: Lens.Lens' ListCachePoliciesResponse Prelude.Int
listCachePoliciesResponse_httpStatus :: (Int -> f Int)
-> ListCachePoliciesResponse -> f ListCachePoliciesResponse
listCachePoliciesResponse_httpStatus = (ListCachePoliciesResponse -> Int)
-> (ListCachePoliciesResponse -> Int -> ListCachePoliciesResponse)
-> Lens ListCachePoliciesResponse ListCachePoliciesResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListCachePoliciesResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListCachePoliciesResponse' :: ListCachePoliciesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListCachePoliciesResponse
s@ListCachePoliciesResponse' {} Int
a -> ListCachePoliciesResponse
s {$sel:httpStatus:ListCachePoliciesResponse' :: Int
httpStatus = Int
a} :: ListCachePoliciesResponse)
instance Prelude.NFData ListCachePoliciesResponse