{-# 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.FMS.ListPolicies
(
ListPolicies (..),
newListPolicies,
listPolicies_maxResults,
listPolicies_nextToken,
ListPoliciesResponse (..),
newListPoliciesResponse,
listPoliciesResponse_nextToken,
listPoliciesResponse_policyList,
listPoliciesResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.FMS.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data ListPolicies = ListPolicies'
{
ListPolicies -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
ListPolicies -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text
}
deriving (ListPolicies -> ListPolicies -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListPolicies -> ListPolicies -> Bool
$c/= :: ListPolicies -> ListPolicies -> Bool
== :: ListPolicies -> ListPolicies -> Bool
$c== :: ListPolicies -> ListPolicies -> Bool
Prelude.Eq, ReadPrec [ListPolicies]
ReadPrec ListPolicies
Int -> ReadS ListPolicies
ReadS [ListPolicies]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListPolicies]
$creadListPrec :: ReadPrec [ListPolicies]
readPrec :: ReadPrec ListPolicies
$creadPrec :: ReadPrec ListPolicies
readList :: ReadS [ListPolicies]
$creadList :: ReadS [ListPolicies]
readsPrec :: Int -> ReadS ListPolicies
$creadsPrec :: Int -> ReadS ListPolicies
Prelude.Read, Int -> ListPolicies -> ShowS
[ListPolicies] -> ShowS
ListPolicies -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListPolicies] -> ShowS
$cshowList :: [ListPolicies] -> ShowS
show :: ListPolicies -> String
$cshow :: ListPolicies -> String
showsPrec :: Int -> ListPolicies -> ShowS
$cshowsPrec :: Int -> ListPolicies -> ShowS
Prelude.Show, forall x. Rep ListPolicies x -> ListPolicies
forall x. ListPolicies -> Rep ListPolicies x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListPolicies x -> ListPolicies
$cfrom :: forall x. ListPolicies -> Rep ListPolicies x
Prelude.Generic)
newListPolicies ::
ListPolicies
newListPolicies :: ListPolicies
newListPolicies =
ListPolicies'
{ $sel:maxResults:ListPolicies' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListPolicies' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing
}
listPolicies_maxResults :: Lens.Lens' ListPolicies (Prelude.Maybe Prelude.Natural)
listPolicies_maxResults :: Lens' ListPolicies (Maybe Natural)
listPolicies_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPolicies' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListPolicies' :: ListPolicies -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListPolicies
s@ListPolicies' {} Maybe Natural
a -> ListPolicies
s {$sel:maxResults:ListPolicies' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListPolicies)
listPolicies_nextToken :: Lens.Lens' ListPolicies (Prelude.Maybe Prelude.Text)
listPolicies_nextToken :: Lens' ListPolicies (Maybe Text)
listPolicies_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPolicies' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListPolicies' :: ListPolicies -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListPolicies
s@ListPolicies' {} Maybe Text
a -> ListPolicies
s {$sel:nextToken:ListPolicies' :: Maybe Text
nextToken = Maybe Text
a} :: ListPolicies)
instance Core.AWSPager ListPolicies where
page :: ListPolicies -> AWSResponse ListPolicies -> Maybe ListPolicies
page ListPolicies
rq AWSResponse ListPolicies
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListPolicies
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListPoliciesResponse (Maybe Text)
listPoliciesResponse_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 ListPolicies
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListPoliciesResponse (Maybe [PolicySummary])
listPoliciesResponse_policyList
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
| Bool
Prelude.otherwise =
forall a. a -> Maybe a
Prelude.Just
forall a b. (a -> b) -> a -> b
Prelude.$ ListPolicies
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListPolicies (Maybe Text)
listPolicies_nextToken
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListPolicies
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListPoliciesResponse (Maybe Text)
listPoliciesResponse_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 ListPolicies where
type AWSResponse ListPolicies = ListPoliciesResponse
request :: (Service -> Service) -> ListPolicies -> Request ListPolicies
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy ListPolicies
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListPolicies)))
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 -> Maybe [PolicySummary] -> Int -> ListPoliciesResponse
ListPoliciesResponse'
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.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"PolicyList" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
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 ListPolicies where
hashWithSalt :: Int -> ListPolicies -> Int
hashWithSalt Int
_salt ListPolicies' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListPolicies' :: ListPolicies -> Maybe Text
$sel:maxResults:ListPolicies' :: ListPolicies -> Maybe Natural
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxResults
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
instance Prelude.NFData ListPolicies where
rnf :: ListPolicies -> ()
rnf ListPolicies' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListPolicies' :: ListPolicies -> Maybe Text
$sel:maxResults:ListPolicies' :: ListPolicies -> Maybe Natural
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
maxResults
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
instance Data.ToHeaders ListPolicies where
toHeaders :: ListPolicies -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"AWSFMS_20180101.ListPolicies" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON ListPolicies where
toJSON :: ListPolicies -> Value
toJSON ListPolicies' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListPolicies' :: ListPolicies -> Maybe Text
$sel:maxResults:ListPolicies' :: ListPolicies -> Maybe Natural
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"MaxResults" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults,
(Key
"NextToken" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken
]
)
instance Data.ToPath ListPolicies where
toPath :: ListPolicies -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery ListPolicies where
toQuery :: ListPolicies -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data ListPoliciesResponse = ListPoliciesResponse'
{
ListPoliciesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListPoliciesResponse -> Maybe [PolicySummary]
policyList :: Prelude.Maybe [PolicySummary],
ListPoliciesResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListPoliciesResponse -> ListPoliciesResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListPoliciesResponse -> ListPoliciesResponse -> Bool
$c/= :: ListPoliciesResponse -> ListPoliciesResponse -> Bool
== :: ListPoliciesResponse -> ListPoliciesResponse -> Bool
$c== :: ListPoliciesResponse -> ListPoliciesResponse -> Bool
Prelude.Eq, ReadPrec [ListPoliciesResponse]
ReadPrec ListPoliciesResponse
Int -> ReadS ListPoliciesResponse
ReadS [ListPoliciesResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListPoliciesResponse]
$creadListPrec :: ReadPrec [ListPoliciesResponse]
readPrec :: ReadPrec ListPoliciesResponse
$creadPrec :: ReadPrec ListPoliciesResponse
readList :: ReadS [ListPoliciesResponse]
$creadList :: ReadS [ListPoliciesResponse]
readsPrec :: Int -> ReadS ListPoliciesResponse
$creadsPrec :: Int -> ReadS ListPoliciesResponse
Prelude.Read, Int -> ListPoliciesResponse -> ShowS
[ListPoliciesResponse] -> ShowS
ListPoliciesResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListPoliciesResponse] -> ShowS
$cshowList :: [ListPoliciesResponse] -> ShowS
show :: ListPoliciesResponse -> String
$cshow :: ListPoliciesResponse -> String
showsPrec :: Int -> ListPoliciesResponse -> ShowS
$cshowsPrec :: Int -> ListPoliciesResponse -> ShowS
Prelude.Show, forall x. Rep ListPoliciesResponse x -> ListPoliciesResponse
forall x. ListPoliciesResponse -> Rep ListPoliciesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListPoliciesResponse x -> ListPoliciesResponse
$cfrom :: forall x. ListPoliciesResponse -> Rep ListPoliciesResponse x
Prelude.Generic)
newListPoliciesResponse ::
Prelude.Int ->
ListPoliciesResponse
newListPoliciesResponse :: Int -> ListPoliciesResponse
newListPoliciesResponse Int
pHttpStatus_ =
ListPoliciesResponse'
{ $sel:nextToken:ListPoliciesResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:policyList:ListPoliciesResponse' :: Maybe [PolicySummary]
policyList = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListPoliciesResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listPoliciesResponse_nextToken :: Lens.Lens' ListPoliciesResponse (Prelude.Maybe Prelude.Text)
listPoliciesResponse_nextToken :: Lens' ListPoliciesResponse (Maybe Text)
listPoliciesResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPoliciesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListPoliciesResponse' :: ListPoliciesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListPoliciesResponse
s@ListPoliciesResponse' {} Maybe Text
a -> ListPoliciesResponse
s {$sel:nextToken:ListPoliciesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListPoliciesResponse)
listPoliciesResponse_policyList :: Lens.Lens' ListPoliciesResponse (Prelude.Maybe [PolicySummary])
listPoliciesResponse_policyList :: Lens' ListPoliciesResponse (Maybe [PolicySummary])
listPoliciesResponse_policyList = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPoliciesResponse' {Maybe [PolicySummary]
policyList :: Maybe [PolicySummary]
$sel:policyList:ListPoliciesResponse' :: ListPoliciesResponse -> Maybe [PolicySummary]
policyList} -> Maybe [PolicySummary]
policyList) (\s :: ListPoliciesResponse
s@ListPoliciesResponse' {} Maybe [PolicySummary]
a -> ListPoliciesResponse
s {$sel:policyList:ListPoliciesResponse' :: Maybe [PolicySummary]
policyList = Maybe [PolicySummary]
a} :: ListPoliciesResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
listPoliciesResponse_httpStatus :: Lens.Lens' ListPoliciesResponse Prelude.Int
listPoliciesResponse_httpStatus :: Lens' ListPoliciesResponse Int
listPoliciesResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPoliciesResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListPoliciesResponse' :: ListPoliciesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListPoliciesResponse
s@ListPoliciesResponse' {} Int
a -> ListPoliciesResponse
s {$sel:httpStatus:ListPoliciesResponse' :: Int
httpStatus = Int
a} :: ListPoliciesResponse)
instance Prelude.NFData ListPoliciesResponse where
rnf :: ListPoliciesResponse -> ()
rnf ListPoliciesResponse' {Int
Maybe [PolicySummary]
Maybe Text
httpStatus :: Int
policyList :: Maybe [PolicySummary]
nextToken :: Maybe Text
$sel:httpStatus:ListPoliciesResponse' :: ListPoliciesResponse -> Int
$sel:policyList:ListPoliciesResponse' :: ListPoliciesResponse -> Maybe [PolicySummary]
$sel:nextToken:ListPoliciesResponse' :: ListPoliciesResponse -> 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 Maybe [PolicySummary]
policyList
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus