{-# 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.AccessAnalyzer.ListArchiveRules
(
ListArchiveRules (..),
newListArchiveRules,
listArchiveRules_maxResults,
listArchiveRules_nextToken,
listArchiveRules_analyzerName,
ListArchiveRulesResponse (..),
newListArchiveRulesResponse,
listArchiveRulesResponse_nextToken,
listArchiveRulesResponse_httpStatus,
listArchiveRulesResponse_archiveRules,
)
where
import Amazonka.AccessAnalyzer.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 ListArchiveRules = ListArchiveRules'
{
ListArchiveRules -> Maybe Int
maxResults :: Prelude.Maybe Prelude.Int,
ListArchiveRules -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListArchiveRules -> Text
analyzerName :: Prelude.Text
}
deriving (ListArchiveRules -> ListArchiveRules -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListArchiveRules -> ListArchiveRules -> Bool
$c/= :: ListArchiveRules -> ListArchiveRules -> Bool
== :: ListArchiveRules -> ListArchiveRules -> Bool
$c== :: ListArchiveRules -> ListArchiveRules -> Bool
Prelude.Eq, ReadPrec [ListArchiveRules]
ReadPrec ListArchiveRules
Int -> ReadS ListArchiveRules
ReadS [ListArchiveRules]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListArchiveRules]
$creadListPrec :: ReadPrec [ListArchiveRules]
readPrec :: ReadPrec ListArchiveRules
$creadPrec :: ReadPrec ListArchiveRules
readList :: ReadS [ListArchiveRules]
$creadList :: ReadS [ListArchiveRules]
readsPrec :: Int -> ReadS ListArchiveRules
$creadsPrec :: Int -> ReadS ListArchiveRules
Prelude.Read, Int -> ListArchiveRules -> ShowS
[ListArchiveRules] -> ShowS
ListArchiveRules -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListArchiveRules] -> ShowS
$cshowList :: [ListArchiveRules] -> ShowS
show :: ListArchiveRules -> String
$cshow :: ListArchiveRules -> String
showsPrec :: Int -> ListArchiveRules -> ShowS
$cshowsPrec :: Int -> ListArchiveRules -> ShowS
Prelude.Show, forall x. Rep ListArchiveRules x -> ListArchiveRules
forall x. ListArchiveRules -> Rep ListArchiveRules x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListArchiveRules x -> ListArchiveRules
$cfrom :: forall x. ListArchiveRules -> Rep ListArchiveRules x
Prelude.Generic)
newListArchiveRules ::
Prelude.Text ->
ListArchiveRules
newListArchiveRules :: Text -> ListArchiveRules
newListArchiveRules Text
pAnalyzerName_ =
ListArchiveRules'
{ $sel:maxResults:ListArchiveRules' :: Maybe Int
maxResults = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListArchiveRules' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:analyzerName:ListArchiveRules' :: Text
analyzerName = Text
pAnalyzerName_
}
listArchiveRules_maxResults :: Lens.Lens' ListArchiveRules (Prelude.Maybe Prelude.Int)
listArchiveRules_maxResults :: Lens' ListArchiveRules (Maybe Int)
listArchiveRules_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListArchiveRules' {Maybe Int
maxResults :: Maybe Int
$sel:maxResults:ListArchiveRules' :: ListArchiveRules -> Maybe Int
maxResults} -> Maybe Int
maxResults) (\s :: ListArchiveRules
s@ListArchiveRules' {} Maybe Int
a -> ListArchiveRules
s {$sel:maxResults:ListArchiveRules' :: Maybe Int
maxResults = Maybe Int
a} :: ListArchiveRules)
listArchiveRules_nextToken :: Lens.Lens' ListArchiveRules (Prelude.Maybe Prelude.Text)
listArchiveRules_nextToken :: Lens' ListArchiveRules (Maybe Text)
listArchiveRules_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListArchiveRules' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListArchiveRules' :: ListArchiveRules -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListArchiveRules
s@ListArchiveRules' {} Maybe Text
a -> ListArchiveRules
s {$sel:nextToken:ListArchiveRules' :: Maybe Text
nextToken = Maybe Text
a} :: ListArchiveRules)
listArchiveRules_analyzerName :: Lens.Lens' ListArchiveRules Prelude.Text
listArchiveRules_analyzerName :: Lens' ListArchiveRules Text
listArchiveRules_analyzerName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListArchiveRules' {Text
analyzerName :: Text
$sel:analyzerName:ListArchiveRules' :: ListArchiveRules -> Text
analyzerName} -> Text
analyzerName) (\s :: ListArchiveRules
s@ListArchiveRules' {} Text
a -> ListArchiveRules
s {$sel:analyzerName:ListArchiveRules' :: Text
analyzerName = Text
a} :: ListArchiveRules)
instance Core.AWSPager ListArchiveRules where
page :: ListArchiveRules
-> AWSResponse ListArchiveRules -> Maybe ListArchiveRules
page ListArchiveRules
rq AWSResponse ListArchiveRules
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListArchiveRules
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListArchiveRulesResponse (Maybe Text)
listArchiveRulesResponse_nextToken
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
forall a. Maybe a
Prelude.Nothing
| forall a. AWSTruncated a => a -> Bool
Core.stop
(AWSResponse ListArchiveRules
rs forall s a. s -> Getting a s a -> a
Lens.^. Lens' ListArchiveRulesResponse [ArchiveRuleSummary]
listArchiveRulesResponse_archiveRules) =
forall a. Maybe a
Prelude.Nothing
| Bool
Prelude.otherwise =
forall a. a -> Maybe a
Prelude.Just
forall a b. (a -> b) -> a -> b
Prelude.$ ListArchiveRules
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListArchiveRules (Maybe Text)
listArchiveRules_nextToken
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListArchiveRules
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListArchiveRulesResponse (Maybe Text)
listArchiveRulesResponse_nextToken
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
instance Core.AWSRequest ListArchiveRules where
type
AWSResponse ListArchiveRules =
ListArchiveRulesResponse
request :: (Service -> Service)
-> ListArchiveRules -> Request ListArchiveRules
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 ListArchiveRules
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListArchiveRules)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe Text
-> Int -> [ArchiveRuleSummary] -> ListArchiveRulesResponse
ListArchiveRulesResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"nextToken")
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))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"archiveRules" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable ListArchiveRules where
hashWithSalt :: Int -> ListArchiveRules -> Int
hashWithSalt Int
_salt ListArchiveRules' {Maybe Int
Maybe Text
Text
analyzerName :: Text
nextToken :: Maybe Text
maxResults :: Maybe Int
$sel:analyzerName:ListArchiveRules' :: ListArchiveRules -> Text
$sel:nextToken:ListArchiveRules' :: ListArchiveRules -> Maybe Text
$sel:maxResults:ListArchiveRules' :: ListArchiveRules -> Maybe Int
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
maxResults
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
analyzerName
instance Prelude.NFData ListArchiveRules where
rnf :: ListArchiveRules -> ()
rnf ListArchiveRules' {Maybe Int
Maybe Text
Text
analyzerName :: Text
nextToken :: Maybe Text
maxResults :: Maybe Int
$sel:analyzerName:ListArchiveRules' :: ListArchiveRules -> Text
$sel:nextToken:ListArchiveRules' :: ListArchiveRules -> Maybe Text
$sel:maxResults:ListArchiveRules' :: ListArchiveRules -> Maybe Int
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
maxResults
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
analyzerName
instance Data.ToHeaders ListArchiveRules where
toHeaders :: ListArchiveRules -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToPath ListArchiveRules where
toPath :: ListArchiveRules -> ByteString
toPath ListArchiveRules' {Maybe Int
Maybe Text
Text
analyzerName :: Text
nextToken :: Maybe Text
maxResults :: Maybe Int
$sel:analyzerName:ListArchiveRules' :: ListArchiveRules -> Text
$sel:nextToken:ListArchiveRules' :: ListArchiveRules -> Maybe Text
$sel:maxResults:ListArchiveRules' :: ListArchiveRules -> Maybe Int
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/analyzer/",
forall a. ToByteString a => a -> ByteString
Data.toBS Text
analyzerName,
ByteString
"/archive-rule"
]
instance Data.ToQuery ListArchiveRules where
toQuery :: ListArchiveRules -> QueryString
toQuery ListArchiveRules' {Maybe Int
Maybe Text
Text
analyzerName :: Text
nextToken :: Maybe Text
maxResults :: Maybe Int
$sel:analyzerName:ListArchiveRules' :: ListArchiveRules -> Text
$sel:nextToken:ListArchiveRules' :: ListArchiveRules -> Maybe Text
$sel:maxResults:ListArchiveRules' :: ListArchiveRules -> Maybe Int
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"maxResults" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Int
maxResults,
ByteString
"nextToken" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
nextToken
]
data ListArchiveRulesResponse = ListArchiveRulesResponse'
{
ListArchiveRulesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListArchiveRulesResponse -> Int
httpStatus :: Prelude.Int,
ListArchiveRulesResponse -> [ArchiveRuleSummary]
archiveRules :: [ArchiveRuleSummary]
}
deriving (ListArchiveRulesResponse -> ListArchiveRulesResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListArchiveRulesResponse -> ListArchiveRulesResponse -> Bool
$c/= :: ListArchiveRulesResponse -> ListArchiveRulesResponse -> Bool
== :: ListArchiveRulesResponse -> ListArchiveRulesResponse -> Bool
$c== :: ListArchiveRulesResponse -> ListArchiveRulesResponse -> Bool
Prelude.Eq, ReadPrec [ListArchiveRulesResponse]
ReadPrec ListArchiveRulesResponse
Int -> ReadS ListArchiveRulesResponse
ReadS [ListArchiveRulesResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListArchiveRulesResponse]
$creadListPrec :: ReadPrec [ListArchiveRulesResponse]
readPrec :: ReadPrec ListArchiveRulesResponse
$creadPrec :: ReadPrec ListArchiveRulesResponse
readList :: ReadS [ListArchiveRulesResponse]
$creadList :: ReadS [ListArchiveRulesResponse]
readsPrec :: Int -> ReadS ListArchiveRulesResponse
$creadsPrec :: Int -> ReadS ListArchiveRulesResponse
Prelude.Read, Int -> ListArchiveRulesResponse -> ShowS
[ListArchiveRulesResponse] -> ShowS
ListArchiveRulesResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListArchiveRulesResponse] -> ShowS
$cshowList :: [ListArchiveRulesResponse] -> ShowS
show :: ListArchiveRulesResponse -> String
$cshow :: ListArchiveRulesResponse -> String
showsPrec :: Int -> ListArchiveRulesResponse -> ShowS
$cshowsPrec :: Int -> ListArchiveRulesResponse -> ShowS
Prelude.Show, forall x.
Rep ListArchiveRulesResponse x -> ListArchiveRulesResponse
forall x.
ListArchiveRulesResponse -> Rep ListArchiveRulesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListArchiveRulesResponse x -> ListArchiveRulesResponse
$cfrom :: forall x.
ListArchiveRulesResponse -> Rep ListArchiveRulesResponse x
Prelude.Generic)
newListArchiveRulesResponse ::
Prelude.Int ->
ListArchiveRulesResponse
newListArchiveRulesResponse :: Int -> ListArchiveRulesResponse
newListArchiveRulesResponse Int
pHttpStatus_ =
ListArchiveRulesResponse'
{ $sel:nextToken:ListArchiveRulesResponse' :: Maybe Text
nextToken =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListArchiveRulesResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:archiveRules:ListArchiveRulesResponse' :: [ArchiveRuleSummary]
archiveRules = forall a. Monoid a => a
Prelude.mempty
}
listArchiveRulesResponse_nextToken :: Lens.Lens' ListArchiveRulesResponse (Prelude.Maybe Prelude.Text)
listArchiveRulesResponse_nextToken :: Lens' ListArchiveRulesResponse (Maybe Text)
listArchiveRulesResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListArchiveRulesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListArchiveRulesResponse' :: ListArchiveRulesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListArchiveRulesResponse
s@ListArchiveRulesResponse' {} Maybe Text
a -> ListArchiveRulesResponse
s {$sel:nextToken:ListArchiveRulesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListArchiveRulesResponse)
listArchiveRulesResponse_httpStatus :: Lens.Lens' ListArchiveRulesResponse Prelude.Int
listArchiveRulesResponse_httpStatus :: Lens' ListArchiveRulesResponse Int
listArchiveRulesResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListArchiveRulesResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListArchiveRulesResponse' :: ListArchiveRulesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListArchiveRulesResponse
s@ListArchiveRulesResponse' {} Int
a -> ListArchiveRulesResponse
s {$sel:httpStatus:ListArchiveRulesResponse' :: Int
httpStatus = Int
a} :: ListArchiveRulesResponse)
listArchiveRulesResponse_archiveRules :: Lens.Lens' ListArchiveRulesResponse [ArchiveRuleSummary]
listArchiveRulesResponse_archiveRules :: Lens' ListArchiveRulesResponse [ArchiveRuleSummary]
listArchiveRulesResponse_archiveRules = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListArchiveRulesResponse' {[ArchiveRuleSummary]
archiveRules :: [ArchiveRuleSummary]
$sel:archiveRules:ListArchiveRulesResponse' :: ListArchiveRulesResponse -> [ArchiveRuleSummary]
archiveRules} -> [ArchiveRuleSummary]
archiveRules) (\s :: ListArchiveRulesResponse
s@ListArchiveRulesResponse' {} [ArchiveRuleSummary]
a -> ListArchiveRulesResponse
s {$sel:archiveRules:ListArchiveRulesResponse' :: [ArchiveRuleSummary]
archiveRules = [ArchiveRuleSummary]
a} :: ListArchiveRulesResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Prelude.NFData ListArchiveRulesResponse where
rnf :: ListArchiveRulesResponse -> ()
rnf ListArchiveRulesResponse' {Int
[ArchiveRuleSummary]
Maybe Text
archiveRules :: [ArchiveRuleSummary]
httpStatus :: Int
nextToken :: Maybe Text
$sel:archiveRules:ListArchiveRulesResponse' :: ListArchiveRulesResponse -> [ArchiveRuleSummary]
$sel:httpStatus:ListArchiveRulesResponse' :: ListArchiveRulesResponse -> Int
$sel:nextToken:ListArchiveRulesResponse' :: ListArchiveRulesResponse -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [ArchiveRuleSummary]
archiveRules