{-# 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.ListInvalidations
(
ListInvalidations (..),
newListInvalidations,
listInvalidations_marker,
listInvalidations_maxItems,
listInvalidations_distributionId,
ListInvalidationsResponse (..),
newListInvalidationsResponse,
listInvalidationsResponse_httpStatus,
listInvalidationsResponse_invalidationList,
)
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 ListInvalidations = ListInvalidations'
{
ListInvalidations -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
ListInvalidations -> Maybe Text
maxItems :: Prelude.Maybe Prelude.Text,
ListInvalidations -> Text
distributionId :: Prelude.Text
}
deriving (ListInvalidations -> ListInvalidations -> Bool
(ListInvalidations -> ListInvalidations -> Bool)
-> (ListInvalidations -> ListInvalidations -> Bool)
-> Eq ListInvalidations
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListInvalidations -> ListInvalidations -> Bool
$c/= :: ListInvalidations -> ListInvalidations -> Bool
== :: ListInvalidations -> ListInvalidations -> Bool
$c== :: ListInvalidations -> ListInvalidations -> Bool
Prelude.Eq, ReadPrec [ListInvalidations]
ReadPrec ListInvalidations
Int -> ReadS ListInvalidations
ReadS [ListInvalidations]
(Int -> ReadS ListInvalidations)
-> ReadS [ListInvalidations]
-> ReadPrec ListInvalidations
-> ReadPrec [ListInvalidations]
-> Read ListInvalidations
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListInvalidations]
$creadListPrec :: ReadPrec [ListInvalidations]
readPrec :: ReadPrec ListInvalidations
$creadPrec :: ReadPrec ListInvalidations
readList :: ReadS [ListInvalidations]
$creadList :: ReadS [ListInvalidations]
readsPrec :: Int -> ReadS ListInvalidations
$creadsPrec :: Int -> ReadS ListInvalidations
Prelude.Read, Int -> ListInvalidations -> ShowS
[ListInvalidations] -> ShowS
ListInvalidations -> String
(Int -> ListInvalidations -> ShowS)
-> (ListInvalidations -> String)
-> ([ListInvalidations] -> ShowS)
-> Show ListInvalidations
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListInvalidations] -> ShowS
$cshowList :: [ListInvalidations] -> ShowS
show :: ListInvalidations -> String
$cshow :: ListInvalidations -> String
showsPrec :: Int -> ListInvalidations -> ShowS
$cshowsPrec :: Int -> ListInvalidations -> ShowS
Prelude.Show, (forall x. ListInvalidations -> Rep ListInvalidations x)
-> (forall x. Rep ListInvalidations x -> ListInvalidations)
-> Generic ListInvalidations
forall x. Rep ListInvalidations x -> ListInvalidations
forall x. ListInvalidations -> Rep ListInvalidations x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListInvalidations x -> ListInvalidations
$cfrom :: forall x. ListInvalidations -> Rep ListInvalidations x
Prelude.Generic)
newListInvalidations ::
Prelude.Text ->
ListInvalidations
newListInvalidations :: Text -> ListInvalidations
newListInvalidations Text
pDistributionId_ =
ListInvalidations' :: Maybe Text -> Maybe Text -> Text -> ListInvalidations
ListInvalidations'
{ $sel:marker:ListInvalidations' :: Maybe Text
marker = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:maxItems:ListInvalidations' :: Maybe Text
maxItems = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:distributionId:ListInvalidations' :: Text
distributionId = Text
pDistributionId_
}
listInvalidations_marker :: Lens.Lens' ListInvalidations (Prelude.Maybe Prelude.Text)
listInvalidations_marker :: (Maybe Text -> f (Maybe Text))
-> ListInvalidations -> f ListInvalidations
listInvalidations_marker = (ListInvalidations -> Maybe Text)
-> (ListInvalidations -> Maybe Text -> ListInvalidations)
-> Lens
ListInvalidations ListInvalidations (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListInvalidations' {Maybe Text
marker :: Maybe Text
$sel:marker:ListInvalidations' :: ListInvalidations -> Maybe Text
marker} -> Maybe Text
marker) (\s :: ListInvalidations
s@ListInvalidations' {} Maybe Text
a -> ListInvalidations
s {$sel:marker:ListInvalidations' :: Maybe Text
marker = Maybe Text
a} :: ListInvalidations)
listInvalidations_maxItems :: Lens.Lens' ListInvalidations (Prelude.Maybe Prelude.Text)
listInvalidations_maxItems :: (Maybe Text -> f (Maybe Text))
-> ListInvalidations -> f ListInvalidations
listInvalidations_maxItems = (ListInvalidations -> Maybe Text)
-> (ListInvalidations -> Maybe Text -> ListInvalidations)
-> Lens
ListInvalidations ListInvalidations (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListInvalidations' {Maybe Text
maxItems :: Maybe Text
$sel:maxItems:ListInvalidations' :: ListInvalidations -> Maybe Text
maxItems} -> Maybe Text
maxItems) (\s :: ListInvalidations
s@ListInvalidations' {} Maybe Text
a -> ListInvalidations
s {$sel:maxItems:ListInvalidations' :: Maybe Text
maxItems = Maybe Text
a} :: ListInvalidations)
listInvalidations_distributionId :: Lens.Lens' ListInvalidations Prelude.Text
listInvalidations_distributionId :: (Text -> f Text) -> ListInvalidations -> f ListInvalidations
listInvalidations_distributionId = (ListInvalidations -> Text)
-> (ListInvalidations -> Text -> ListInvalidations)
-> Lens ListInvalidations ListInvalidations Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListInvalidations' {Text
distributionId :: Text
$sel:distributionId:ListInvalidations' :: ListInvalidations -> Text
distributionId} -> Text
distributionId) (\s :: ListInvalidations
s@ListInvalidations' {} Text
a -> ListInvalidations
s {$sel:distributionId:ListInvalidations' :: Text
distributionId = Text
a} :: ListInvalidations)
instance Core.AWSPager ListInvalidations where
page :: ListInvalidations
-> AWSResponse ListInvalidations -> Maybe ListInvalidations
page ListInvalidations
rq AWSResponse ListInvalidations
rs
| Bool -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListInvalidations
ListInvalidationsResponse
rs
ListInvalidationsResponse
-> Getting Bool ListInvalidationsResponse Bool -> Bool
forall s a. s -> Getting a s a -> a
Lens.^. (InvalidationList -> Const Bool InvalidationList)
-> ListInvalidationsResponse
-> Const Bool ListInvalidationsResponse
Lens' ListInvalidationsResponse InvalidationList
listInvalidationsResponse_invalidationList
((InvalidationList -> Const Bool InvalidationList)
-> ListInvalidationsResponse
-> Const Bool ListInvalidationsResponse)
-> ((Bool -> Const Bool Bool)
-> InvalidationList -> Const Bool InvalidationList)
-> Getting Bool ListInvalidationsResponse Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Bool -> Const Bool Bool)
-> InvalidationList -> Const Bool InvalidationList
Lens' InvalidationList Bool
invalidationList_isTruncated
) =
Maybe ListInvalidations
forall a. Maybe a
Prelude.Nothing
| Maybe Text -> Bool
forall a. Maybe a -> Bool
Prelude.isNothing
( AWSResponse ListInvalidations
ListInvalidationsResponse
rs
ListInvalidationsResponse
-> Getting (First Text) ListInvalidationsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (InvalidationList -> Const (First Text) InvalidationList)
-> ListInvalidationsResponse
-> Const (First Text) ListInvalidationsResponse
Lens' ListInvalidationsResponse InvalidationList
listInvalidationsResponse_invalidationList
((InvalidationList -> Const (First Text) InvalidationList)
-> ListInvalidationsResponse
-> Const (First Text) ListInvalidationsResponse)
-> ((Text -> Const (First Text) Text)
-> InvalidationList -> Const (First Text) InvalidationList)
-> Getting (First Text) ListInvalidationsResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Maybe Text -> Const (First Text) (Maybe Text))
-> InvalidationList -> Const (First Text) InvalidationList
Lens' InvalidationList (Maybe Text)
invalidationList_nextMarker
((Maybe Text -> Const (First Text) (Maybe Text))
-> InvalidationList -> Const (First Text) InvalidationList)
-> ((Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text))
-> (Text -> Const (First Text) Text)
-> InvalidationList
-> Const (First Text) InvalidationList
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
Maybe ListInvalidations
forall a. Maybe a
Prelude.Nothing
| Bool
Prelude.otherwise =
ListInvalidations -> Maybe ListInvalidations
forall a. a -> Maybe a
Prelude.Just (ListInvalidations -> Maybe ListInvalidations)
-> ListInvalidations -> Maybe ListInvalidations
forall a b. (a -> b) -> a -> b
Prelude.$
ListInvalidations
rq
ListInvalidations
-> (ListInvalidations -> ListInvalidations) -> ListInvalidations
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListInvalidations -> Identity ListInvalidations
Lens ListInvalidations ListInvalidations (Maybe Text) (Maybe Text)
listInvalidations_marker
((Maybe Text -> Identity (Maybe Text))
-> ListInvalidations -> Identity ListInvalidations)
-> Maybe Text -> ListInvalidations -> ListInvalidations
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListInvalidations
ListInvalidationsResponse
rs
ListInvalidationsResponse
-> Getting (First Text) ListInvalidationsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (InvalidationList -> Const (First Text) InvalidationList)
-> ListInvalidationsResponse
-> Const (First Text) ListInvalidationsResponse
Lens' ListInvalidationsResponse InvalidationList
listInvalidationsResponse_invalidationList
((InvalidationList -> Const (First Text) InvalidationList)
-> ListInvalidationsResponse
-> Const (First Text) ListInvalidationsResponse)
-> ((Text -> Const (First Text) Text)
-> InvalidationList -> Const (First Text) InvalidationList)
-> Getting (First Text) ListInvalidationsResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Maybe Text -> Const (First Text) (Maybe Text))
-> InvalidationList -> Const (First Text) InvalidationList
Lens' InvalidationList (Maybe Text)
invalidationList_nextMarker
((Maybe Text -> Const (First Text) (Maybe Text))
-> InvalidationList -> Const (First Text) InvalidationList)
-> ((Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text))
-> (Text -> Const (First Text) Text)
-> InvalidationList
-> Const (First Text) InvalidationList
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
instance Core.AWSRequest ListInvalidations where
type
AWSResponse ListInvalidations =
ListInvalidationsResponse
request :: ListInvalidations -> Request ListInvalidations
request = Service -> ListInvalidations -> Request ListInvalidations
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy ListInvalidations
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ListInvalidations)))
response =
(Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse ListInvalidations))
-> Logger
-> Service
-> Proxy ListInvalidations
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ListInvalidations)))
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 ->
Int -> InvalidationList -> ListInvalidationsResponse
ListInvalidationsResponse'
(Int -> InvalidationList -> ListInvalidationsResponse)
-> Either String Int
-> Either String (InvalidationList -> ListInvalidationsResponse)
forall (f :: * -> *) a b. Functor 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))
Either String (InvalidationList -> ListInvalidationsResponse)
-> Either String InvalidationList
-> Either String ListInvalidationsResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node] -> Either String InvalidationList
forall a. FromXML a => [Node] -> Either String a
Core.parseXML [Node]
x)
)
instance Prelude.Hashable ListInvalidations
instance Prelude.NFData ListInvalidations
instance Core.ToHeaders ListInvalidations where
toHeaders :: ListInvalidations -> ResponseHeaders
toHeaders = ResponseHeaders -> ListInvalidations -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath ListInvalidations where
toPath :: ListInvalidations -> ByteString
toPath ListInvalidations' {Maybe Text
Text
distributionId :: Text
maxItems :: Maybe Text
marker :: Maybe Text
$sel:distributionId:ListInvalidations' :: ListInvalidations -> Text
$sel:maxItems:ListInvalidations' :: ListInvalidations -> Maybe Text
$sel:marker:ListInvalidations' :: ListInvalidations -> Maybe 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
distributionId,
ByteString
"/invalidation"
]
instance Core.ToQuery ListInvalidations where
toQuery :: ListInvalidations -> QueryString
toQuery ListInvalidations' {Maybe Text
Text
distributionId :: Text
maxItems :: Maybe Text
marker :: Maybe Text
$sel:distributionId:ListInvalidations' :: ListInvalidations -> Text
$sel:maxItems:ListInvalidations' :: ListInvalidations -> Maybe Text
$sel:marker:ListInvalidations' :: ListInvalidations -> 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
]
data ListInvalidationsResponse = ListInvalidationsResponse'
{
ListInvalidationsResponse -> Int
httpStatus :: Prelude.Int,
ListInvalidationsResponse -> InvalidationList
invalidationList :: InvalidationList
}
deriving (ListInvalidationsResponse -> ListInvalidationsResponse -> Bool
(ListInvalidationsResponse -> ListInvalidationsResponse -> Bool)
-> (ListInvalidationsResponse -> ListInvalidationsResponse -> Bool)
-> Eq ListInvalidationsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListInvalidationsResponse -> ListInvalidationsResponse -> Bool
$c/= :: ListInvalidationsResponse -> ListInvalidationsResponse -> Bool
== :: ListInvalidationsResponse -> ListInvalidationsResponse -> Bool
$c== :: ListInvalidationsResponse -> ListInvalidationsResponse -> Bool
Prelude.Eq, ReadPrec [ListInvalidationsResponse]
ReadPrec ListInvalidationsResponse
Int -> ReadS ListInvalidationsResponse
ReadS [ListInvalidationsResponse]
(Int -> ReadS ListInvalidationsResponse)
-> ReadS [ListInvalidationsResponse]
-> ReadPrec ListInvalidationsResponse
-> ReadPrec [ListInvalidationsResponse]
-> Read ListInvalidationsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListInvalidationsResponse]
$creadListPrec :: ReadPrec [ListInvalidationsResponse]
readPrec :: ReadPrec ListInvalidationsResponse
$creadPrec :: ReadPrec ListInvalidationsResponse
readList :: ReadS [ListInvalidationsResponse]
$creadList :: ReadS [ListInvalidationsResponse]
readsPrec :: Int -> ReadS ListInvalidationsResponse
$creadsPrec :: Int -> ReadS ListInvalidationsResponse
Prelude.Read, Int -> ListInvalidationsResponse -> ShowS
[ListInvalidationsResponse] -> ShowS
ListInvalidationsResponse -> String
(Int -> ListInvalidationsResponse -> ShowS)
-> (ListInvalidationsResponse -> String)
-> ([ListInvalidationsResponse] -> ShowS)
-> Show ListInvalidationsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListInvalidationsResponse] -> ShowS
$cshowList :: [ListInvalidationsResponse] -> ShowS
show :: ListInvalidationsResponse -> String
$cshow :: ListInvalidationsResponse -> String
showsPrec :: Int -> ListInvalidationsResponse -> ShowS
$cshowsPrec :: Int -> ListInvalidationsResponse -> ShowS
Prelude.Show, (forall x.
ListInvalidationsResponse -> Rep ListInvalidationsResponse x)
-> (forall x.
Rep ListInvalidationsResponse x -> ListInvalidationsResponse)
-> Generic ListInvalidationsResponse
forall x.
Rep ListInvalidationsResponse x -> ListInvalidationsResponse
forall x.
ListInvalidationsResponse -> Rep ListInvalidationsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListInvalidationsResponse x -> ListInvalidationsResponse
$cfrom :: forall x.
ListInvalidationsResponse -> Rep ListInvalidationsResponse x
Prelude.Generic)
newListInvalidationsResponse ::
Prelude.Int ->
InvalidationList ->
ListInvalidationsResponse
newListInvalidationsResponse :: Int -> InvalidationList -> ListInvalidationsResponse
newListInvalidationsResponse
Int
pHttpStatus_
InvalidationList
pInvalidationList_ =
ListInvalidationsResponse' :: Int -> InvalidationList -> ListInvalidationsResponse
ListInvalidationsResponse'
{ $sel:httpStatus:ListInvalidationsResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:invalidationList:ListInvalidationsResponse' :: InvalidationList
invalidationList = InvalidationList
pInvalidationList_
}
listInvalidationsResponse_httpStatus :: Lens.Lens' ListInvalidationsResponse Prelude.Int
listInvalidationsResponse_httpStatus :: (Int -> f Int)
-> ListInvalidationsResponse -> f ListInvalidationsResponse
listInvalidationsResponse_httpStatus = (ListInvalidationsResponse -> Int)
-> (ListInvalidationsResponse -> Int -> ListInvalidationsResponse)
-> Lens ListInvalidationsResponse ListInvalidationsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListInvalidationsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListInvalidationsResponse' :: ListInvalidationsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListInvalidationsResponse
s@ListInvalidationsResponse' {} Int
a -> ListInvalidationsResponse
s {$sel:httpStatus:ListInvalidationsResponse' :: Int
httpStatus = Int
a} :: ListInvalidationsResponse)
listInvalidationsResponse_invalidationList :: Lens.Lens' ListInvalidationsResponse InvalidationList
listInvalidationsResponse_invalidationList :: (InvalidationList -> f InvalidationList)
-> ListInvalidationsResponse -> f ListInvalidationsResponse
listInvalidationsResponse_invalidationList = (ListInvalidationsResponse -> InvalidationList)
-> (ListInvalidationsResponse
-> InvalidationList -> ListInvalidationsResponse)
-> Lens' ListInvalidationsResponse InvalidationList
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListInvalidationsResponse' {InvalidationList
invalidationList :: InvalidationList
$sel:invalidationList:ListInvalidationsResponse' :: ListInvalidationsResponse -> InvalidationList
invalidationList} -> InvalidationList
invalidationList) (\s :: ListInvalidationsResponse
s@ListInvalidationsResponse' {} InvalidationList
a -> ListInvalidationsResponse
s {$sel:invalidationList:ListInvalidationsResponse' :: InvalidationList
invalidationList = InvalidationList
a} :: ListInvalidationsResponse)
instance Prelude.NFData ListInvalidationsResponse