{-# 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.ListThingPrincipals
(
ListThingPrincipals (..),
newListThingPrincipals,
listThingPrincipals_maxResults,
listThingPrincipals_nextToken,
listThingPrincipals_thingName,
ListThingPrincipalsResponse (..),
newListThingPrincipalsResponse,
listThingPrincipalsResponse_nextToken,
listThingPrincipalsResponse_principals,
listThingPrincipalsResponse_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 ListThingPrincipals = ListThingPrincipals'
{
ListThingPrincipals -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
ListThingPrincipals -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListThingPrincipals -> Text
thingName :: Prelude.Text
}
deriving (ListThingPrincipals -> ListThingPrincipals -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListThingPrincipals -> ListThingPrincipals -> Bool
$c/= :: ListThingPrincipals -> ListThingPrincipals -> Bool
== :: ListThingPrincipals -> ListThingPrincipals -> Bool
$c== :: ListThingPrincipals -> ListThingPrincipals -> Bool
Prelude.Eq, ReadPrec [ListThingPrincipals]
ReadPrec ListThingPrincipals
Int -> ReadS ListThingPrincipals
ReadS [ListThingPrincipals]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListThingPrincipals]
$creadListPrec :: ReadPrec [ListThingPrincipals]
readPrec :: ReadPrec ListThingPrincipals
$creadPrec :: ReadPrec ListThingPrincipals
readList :: ReadS [ListThingPrincipals]
$creadList :: ReadS [ListThingPrincipals]
readsPrec :: Int -> ReadS ListThingPrincipals
$creadsPrec :: Int -> ReadS ListThingPrincipals
Prelude.Read, Int -> ListThingPrincipals -> ShowS
[ListThingPrincipals] -> ShowS
ListThingPrincipals -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListThingPrincipals] -> ShowS
$cshowList :: [ListThingPrincipals] -> ShowS
show :: ListThingPrincipals -> String
$cshow :: ListThingPrincipals -> String
showsPrec :: Int -> ListThingPrincipals -> ShowS
$cshowsPrec :: Int -> ListThingPrincipals -> ShowS
Prelude.Show, forall x. Rep ListThingPrincipals x -> ListThingPrincipals
forall x. ListThingPrincipals -> Rep ListThingPrincipals x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListThingPrincipals x -> ListThingPrincipals
$cfrom :: forall x. ListThingPrincipals -> Rep ListThingPrincipals x
Prelude.Generic)
newListThingPrincipals ::
Prelude.Text ->
ListThingPrincipals
newListThingPrincipals :: Text -> ListThingPrincipals
newListThingPrincipals Text
pThingName_ =
ListThingPrincipals'
{ $sel:maxResults:ListThingPrincipals' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListThingPrincipals' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:thingName:ListThingPrincipals' :: Text
thingName = Text
pThingName_
}
listThingPrincipals_maxResults :: Lens.Lens' ListThingPrincipals (Prelude.Maybe Prelude.Natural)
listThingPrincipals_maxResults :: Lens' ListThingPrincipals (Maybe Natural)
listThingPrincipals_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListThingPrincipals' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListThingPrincipals' :: ListThingPrincipals -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListThingPrincipals
s@ListThingPrincipals' {} Maybe Natural
a -> ListThingPrincipals
s {$sel:maxResults:ListThingPrincipals' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListThingPrincipals)
listThingPrincipals_nextToken :: Lens.Lens' ListThingPrincipals (Prelude.Maybe Prelude.Text)
listThingPrincipals_nextToken :: Lens' ListThingPrincipals (Maybe Text)
listThingPrincipals_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListThingPrincipals' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListThingPrincipals' :: ListThingPrincipals -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListThingPrincipals
s@ListThingPrincipals' {} Maybe Text
a -> ListThingPrincipals
s {$sel:nextToken:ListThingPrincipals' :: Maybe Text
nextToken = Maybe Text
a} :: ListThingPrincipals)
listThingPrincipals_thingName :: Lens.Lens' ListThingPrincipals Prelude.Text
listThingPrincipals_thingName :: Lens' ListThingPrincipals Text
listThingPrincipals_thingName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListThingPrincipals' {Text
thingName :: Text
$sel:thingName:ListThingPrincipals' :: ListThingPrincipals -> Text
thingName} -> Text
thingName) (\s :: ListThingPrincipals
s@ListThingPrincipals' {} Text
a -> ListThingPrincipals
s {$sel:thingName:ListThingPrincipals' :: Text
thingName = Text
a} :: ListThingPrincipals)
instance Core.AWSPager ListThingPrincipals where
page :: ListThingPrincipals
-> AWSResponse ListThingPrincipals -> Maybe ListThingPrincipals
page ListThingPrincipals
rq AWSResponse ListThingPrincipals
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListThingPrincipals
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListThingPrincipalsResponse (Maybe Text)
listThingPrincipalsResponse_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 ListThingPrincipals
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListThingPrincipalsResponse (Maybe [Text])
listThingPrincipalsResponse_principals
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.$ ListThingPrincipals
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListThingPrincipals (Maybe Text)
listThingPrincipals_nextToken
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListThingPrincipals
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListThingPrincipalsResponse (Maybe Text)
listThingPrincipalsResponse_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 ListThingPrincipals where
type
AWSResponse ListThingPrincipals =
ListThingPrincipalsResponse
request :: (Service -> Service)
-> ListThingPrincipals -> Request ListThingPrincipals
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 ListThingPrincipals
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ListThingPrincipals)))
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 [Text] -> Int -> ListThingPrincipalsResponse
ListThingPrincipalsResponse'
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
"principals" 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 ListThingPrincipals where
hashWithSalt :: Int -> ListThingPrincipals -> Int
hashWithSalt Int
_salt ListThingPrincipals' {Maybe Natural
Maybe Text
Text
thingName :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:thingName:ListThingPrincipals' :: ListThingPrincipals -> Text
$sel:nextToken:ListThingPrincipals' :: ListThingPrincipals -> Maybe Text
$sel:maxResults:ListThingPrincipals' :: ListThingPrincipals -> 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
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
thingName
instance Prelude.NFData ListThingPrincipals where
rnf :: ListThingPrincipals -> ()
rnf ListThingPrincipals' {Maybe Natural
Maybe Text
Text
thingName :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:thingName:ListThingPrincipals' :: ListThingPrincipals -> Text
$sel:nextToken:ListThingPrincipals' :: ListThingPrincipals -> Maybe Text
$sel:maxResults:ListThingPrincipals' :: ListThingPrincipals -> 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
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
thingName
instance Data.ToHeaders ListThingPrincipals where
toHeaders :: ListThingPrincipals -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
instance Data.ToPath ListThingPrincipals where
toPath :: ListThingPrincipals -> ByteString
toPath ListThingPrincipals' {Maybe Natural
Maybe Text
Text
thingName :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:thingName:ListThingPrincipals' :: ListThingPrincipals -> Text
$sel:nextToken:ListThingPrincipals' :: ListThingPrincipals -> Maybe Text
$sel:maxResults:ListThingPrincipals' :: ListThingPrincipals -> Maybe Natural
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/things/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
thingName, ByteString
"/principals"]
instance Data.ToQuery ListThingPrincipals where
toQuery :: ListThingPrincipals -> QueryString
toQuery ListThingPrincipals' {Maybe Natural
Maybe Text
Text
thingName :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:thingName:ListThingPrincipals' :: ListThingPrincipals -> Text
$sel:nextToken:ListThingPrincipals' :: ListThingPrincipals -> Maybe Text
$sel:maxResults:ListThingPrincipals' :: ListThingPrincipals -> Maybe Natural
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"maxResults" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Natural
maxResults,
ByteString
"nextToken" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
nextToken
]
data ListThingPrincipalsResponse = ListThingPrincipalsResponse'
{
ListThingPrincipalsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListThingPrincipalsResponse -> Maybe [Text]
principals :: Prelude.Maybe [Prelude.Text],
ListThingPrincipalsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListThingPrincipalsResponse -> ListThingPrincipalsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListThingPrincipalsResponse -> ListThingPrincipalsResponse -> Bool
$c/= :: ListThingPrincipalsResponse -> ListThingPrincipalsResponse -> Bool
== :: ListThingPrincipalsResponse -> ListThingPrincipalsResponse -> Bool
$c== :: ListThingPrincipalsResponse -> ListThingPrincipalsResponse -> Bool
Prelude.Eq, ReadPrec [ListThingPrincipalsResponse]
ReadPrec ListThingPrincipalsResponse
Int -> ReadS ListThingPrincipalsResponse
ReadS [ListThingPrincipalsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListThingPrincipalsResponse]
$creadListPrec :: ReadPrec [ListThingPrincipalsResponse]
readPrec :: ReadPrec ListThingPrincipalsResponse
$creadPrec :: ReadPrec ListThingPrincipalsResponse
readList :: ReadS [ListThingPrincipalsResponse]
$creadList :: ReadS [ListThingPrincipalsResponse]
readsPrec :: Int -> ReadS ListThingPrincipalsResponse
$creadsPrec :: Int -> ReadS ListThingPrincipalsResponse
Prelude.Read, Int -> ListThingPrincipalsResponse -> ShowS
[ListThingPrincipalsResponse] -> ShowS
ListThingPrincipalsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListThingPrincipalsResponse] -> ShowS
$cshowList :: [ListThingPrincipalsResponse] -> ShowS
show :: ListThingPrincipalsResponse -> String
$cshow :: ListThingPrincipalsResponse -> String
showsPrec :: Int -> ListThingPrincipalsResponse -> ShowS
$cshowsPrec :: Int -> ListThingPrincipalsResponse -> ShowS
Prelude.Show, forall x.
Rep ListThingPrincipalsResponse x -> ListThingPrincipalsResponse
forall x.
ListThingPrincipalsResponse -> Rep ListThingPrincipalsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListThingPrincipalsResponse x -> ListThingPrincipalsResponse
$cfrom :: forall x.
ListThingPrincipalsResponse -> Rep ListThingPrincipalsResponse x
Prelude.Generic)
newListThingPrincipalsResponse ::
Prelude.Int ->
ListThingPrincipalsResponse
newListThingPrincipalsResponse :: Int -> ListThingPrincipalsResponse
newListThingPrincipalsResponse Int
pHttpStatus_ =
ListThingPrincipalsResponse'
{ $sel:nextToken:ListThingPrincipalsResponse' :: Maybe Text
nextToken =
forall a. Maybe a
Prelude.Nothing,
$sel:principals:ListThingPrincipalsResponse' :: Maybe [Text]
principals = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListThingPrincipalsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listThingPrincipalsResponse_nextToken :: Lens.Lens' ListThingPrincipalsResponse (Prelude.Maybe Prelude.Text)
listThingPrincipalsResponse_nextToken :: Lens' ListThingPrincipalsResponse (Maybe Text)
listThingPrincipalsResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListThingPrincipalsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListThingPrincipalsResponse' :: ListThingPrincipalsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListThingPrincipalsResponse
s@ListThingPrincipalsResponse' {} Maybe Text
a -> ListThingPrincipalsResponse
s {$sel:nextToken:ListThingPrincipalsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListThingPrincipalsResponse)
listThingPrincipalsResponse_principals :: Lens.Lens' ListThingPrincipalsResponse (Prelude.Maybe [Prelude.Text])
listThingPrincipalsResponse_principals :: Lens' ListThingPrincipalsResponse (Maybe [Text])
listThingPrincipalsResponse_principals = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListThingPrincipalsResponse' {Maybe [Text]
principals :: Maybe [Text]
$sel:principals:ListThingPrincipalsResponse' :: ListThingPrincipalsResponse -> Maybe [Text]
principals} -> Maybe [Text]
principals) (\s :: ListThingPrincipalsResponse
s@ListThingPrincipalsResponse' {} Maybe [Text]
a -> ListThingPrincipalsResponse
s {$sel:principals:ListThingPrincipalsResponse' :: Maybe [Text]
principals = Maybe [Text]
a} :: ListThingPrincipalsResponse) 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
listThingPrincipalsResponse_httpStatus :: Lens.Lens' ListThingPrincipalsResponse Prelude.Int
listThingPrincipalsResponse_httpStatus :: Lens' ListThingPrincipalsResponse Int
listThingPrincipalsResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListThingPrincipalsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListThingPrincipalsResponse' :: ListThingPrincipalsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListThingPrincipalsResponse
s@ListThingPrincipalsResponse' {} Int
a -> ListThingPrincipalsResponse
s {$sel:httpStatus:ListThingPrincipalsResponse' :: Int
httpStatus = Int
a} :: ListThingPrincipalsResponse)
instance Prelude.NFData ListThingPrincipalsResponse where
rnf :: ListThingPrincipalsResponse -> ()
rnf ListThingPrincipalsResponse' {Int
Maybe [Text]
Maybe Text
httpStatus :: Int
principals :: Maybe [Text]
nextToken :: Maybe Text
$sel:httpStatus:ListThingPrincipalsResponse' :: ListThingPrincipalsResponse -> Int
$sel:principals:ListThingPrincipalsResponse' :: ListThingPrincipalsResponse -> Maybe [Text]
$sel:nextToken:ListThingPrincipalsResponse' :: ListThingPrincipalsResponse -> 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 [Text]
principals
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus