{-# 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.IoT.ListPolicies
(
ListPolicies (..),
newListPolicies,
listPolicies_ascendingOrder,
listPolicies_marker,
listPolicies_pageSize,
ListPoliciesResponse (..),
newListPoliciesResponse,
listPoliciesResponse_nextMarker,
listPoliciesResponse_policies,
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.IoT.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data ListPolicies = ListPolicies'
{
ListPolicies -> Maybe Bool
ascendingOrder :: Prelude.Maybe Prelude.Bool,
ListPolicies -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
ListPolicies -> Maybe Natural
pageSize :: Prelude.Maybe Prelude.Natural
}
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:ascendingOrder:ListPolicies' :: Maybe Bool
ascendingOrder = forall a. Maybe a
Prelude.Nothing,
$sel:marker:ListPolicies' :: Maybe Text
marker = forall a. Maybe a
Prelude.Nothing,
$sel:pageSize:ListPolicies' :: Maybe Natural
pageSize = forall a. Maybe a
Prelude.Nothing
}
listPolicies_ascendingOrder :: Lens.Lens' ListPolicies (Prelude.Maybe Prelude.Bool)
listPolicies_ascendingOrder :: Lens' ListPolicies (Maybe Bool)
listPolicies_ascendingOrder = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPolicies' {Maybe Bool
ascendingOrder :: Maybe Bool
$sel:ascendingOrder:ListPolicies' :: ListPolicies -> Maybe Bool
ascendingOrder} -> Maybe Bool
ascendingOrder) (\s :: ListPolicies
s@ListPolicies' {} Maybe Bool
a -> ListPolicies
s {$sel:ascendingOrder:ListPolicies' :: Maybe Bool
ascendingOrder = Maybe Bool
a} :: ListPolicies)
listPolicies_marker :: Lens.Lens' ListPolicies (Prelude.Maybe Prelude.Text)
listPolicies_marker :: Lens' ListPolicies (Maybe Text)
listPolicies_marker = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPolicies' {Maybe Text
marker :: Maybe Text
$sel:marker:ListPolicies' :: ListPolicies -> Maybe Text
marker} -> Maybe Text
marker) (\s :: ListPolicies
s@ListPolicies' {} Maybe Text
a -> ListPolicies
s {$sel:marker:ListPolicies' :: Maybe Text
marker = Maybe Text
a} :: ListPolicies)
listPolicies_pageSize :: Lens.Lens' ListPolicies (Prelude.Maybe Prelude.Natural)
listPolicies_pageSize :: Lens' ListPolicies (Maybe Natural)
listPolicies_pageSize = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPolicies' {Maybe Natural
pageSize :: Maybe Natural
$sel:pageSize:ListPolicies' :: ListPolicies -> Maybe Natural
pageSize} -> Maybe Natural
pageSize) (\s :: ListPolicies
s@ListPolicies' {} Maybe Natural
a -> ListPolicies
s {$sel:pageSize:ListPolicies' :: Maybe Natural
pageSize = Maybe Natural
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_nextMarker
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 [Policy])
listPoliciesResponse_policies
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_marker
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_nextMarker
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 => Service -> a -> Request a
Request.get (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 [Policy] -> 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
"nextMarker")
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
"policies" 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 Bool
Maybe Natural
Maybe Text
pageSize :: Maybe Natural
marker :: Maybe Text
ascendingOrder :: Maybe Bool
$sel:pageSize:ListPolicies' :: ListPolicies -> Maybe Natural
$sel:marker:ListPolicies' :: ListPolicies -> Maybe Text
$sel:ascendingOrder:ListPolicies' :: ListPolicies -> Maybe Bool
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
ascendingOrder
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
marker
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
pageSize
instance Prelude.NFData ListPolicies where
rnf :: ListPolicies -> ()
rnf ListPolicies' {Maybe Bool
Maybe Natural
Maybe Text
pageSize :: Maybe Natural
marker :: Maybe Text
ascendingOrder :: Maybe Bool
$sel:pageSize:ListPolicies' :: ListPolicies -> Maybe Natural
$sel:marker:ListPolicies' :: ListPolicies -> Maybe Text
$sel:ascendingOrder:ListPolicies' :: ListPolicies -> Maybe Bool
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
ascendingOrder
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
marker
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
pageSize
instance Data.ToHeaders ListPolicies where
toHeaders :: ListPolicies -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
instance Data.ToPath ListPolicies where
toPath :: ListPolicies -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/policies"
instance Data.ToQuery ListPolicies where
toQuery :: ListPolicies -> QueryString
toQuery ListPolicies' {Maybe Bool
Maybe Natural
Maybe Text
pageSize :: Maybe Natural
marker :: Maybe Text
ascendingOrder :: Maybe Bool
$sel:pageSize:ListPolicies' :: ListPolicies -> Maybe Natural
$sel:marker:ListPolicies' :: ListPolicies -> Maybe Text
$sel:ascendingOrder:ListPolicies' :: ListPolicies -> Maybe Bool
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"isAscendingOrder" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Bool
ascendingOrder,
ByteString
"marker" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
marker,
ByteString
"pageSize" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Natural
pageSize
]
data ListPoliciesResponse = ListPoliciesResponse'
{
ListPoliciesResponse -> Maybe Text
nextMarker :: Prelude.Maybe Prelude.Text,
ListPoliciesResponse -> Maybe [Policy]
policies :: Prelude.Maybe [Policy],
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:nextMarker:ListPoliciesResponse' :: Maybe Text
nextMarker = forall a. Maybe a
Prelude.Nothing,
$sel:policies:ListPoliciesResponse' :: Maybe [Policy]
policies = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListPoliciesResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listPoliciesResponse_nextMarker :: Lens.Lens' ListPoliciesResponse (Prelude.Maybe Prelude.Text)
listPoliciesResponse_nextMarker :: Lens' ListPoliciesResponse (Maybe Text)
listPoliciesResponse_nextMarker = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPoliciesResponse' {Maybe Text
nextMarker :: Maybe Text
$sel:nextMarker:ListPoliciesResponse' :: ListPoliciesResponse -> Maybe Text
nextMarker} -> Maybe Text
nextMarker) (\s :: ListPoliciesResponse
s@ListPoliciesResponse' {} Maybe Text
a -> ListPoliciesResponse
s {$sel:nextMarker:ListPoliciesResponse' :: Maybe Text
nextMarker = Maybe Text
a} :: ListPoliciesResponse)
listPoliciesResponse_policies :: Lens.Lens' ListPoliciesResponse (Prelude.Maybe [Policy])
listPoliciesResponse_policies :: Lens' ListPoliciesResponse (Maybe [Policy])
listPoliciesResponse_policies = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPoliciesResponse' {Maybe [Policy]
policies :: Maybe [Policy]
$sel:policies:ListPoliciesResponse' :: ListPoliciesResponse -> Maybe [Policy]
policies} -> Maybe [Policy]
policies) (\s :: ListPoliciesResponse
s@ListPoliciesResponse' {} Maybe [Policy]
a -> ListPoliciesResponse
s {$sel:policies:ListPoliciesResponse' :: Maybe [Policy]
policies = Maybe [Policy]
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 [Policy]
Maybe Text
httpStatus :: Int
policies :: Maybe [Policy]
nextMarker :: Maybe Text
$sel:httpStatus:ListPoliciesResponse' :: ListPoliciesResponse -> Int
$sel:policies:ListPoliciesResponse' :: ListPoliciesResponse -> Maybe [Policy]
$sel:nextMarker:ListPoliciesResponse' :: ListPoliciesResponse -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextMarker
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Policy]
policies
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus