{-# 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.ListThingsInBillingGroup
(
ListThingsInBillingGroup (..),
newListThingsInBillingGroup,
listThingsInBillingGroup_maxResults,
listThingsInBillingGroup_nextToken,
listThingsInBillingGroup_billingGroupName,
ListThingsInBillingGroupResponse (..),
newListThingsInBillingGroupResponse,
listThingsInBillingGroupResponse_nextToken,
listThingsInBillingGroupResponse_things,
listThingsInBillingGroupResponse_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 ListThingsInBillingGroup = ListThingsInBillingGroup'
{
ListThingsInBillingGroup -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
ListThingsInBillingGroup -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListThingsInBillingGroup -> Text
billingGroupName :: Prelude.Text
}
deriving (ListThingsInBillingGroup -> ListThingsInBillingGroup -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListThingsInBillingGroup -> ListThingsInBillingGroup -> Bool
$c/= :: ListThingsInBillingGroup -> ListThingsInBillingGroup -> Bool
== :: ListThingsInBillingGroup -> ListThingsInBillingGroup -> Bool
$c== :: ListThingsInBillingGroup -> ListThingsInBillingGroup -> Bool
Prelude.Eq, ReadPrec [ListThingsInBillingGroup]
ReadPrec ListThingsInBillingGroup
Int -> ReadS ListThingsInBillingGroup
ReadS [ListThingsInBillingGroup]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListThingsInBillingGroup]
$creadListPrec :: ReadPrec [ListThingsInBillingGroup]
readPrec :: ReadPrec ListThingsInBillingGroup
$creadPrec :: ReadPrec ListThingsInBillingGroup
readList :: ReadS [ListThingsInBillingGroup]
$creadList :: ReadS [ListThingsInBillingGroup]
readsPrec :: Int -> ReadS ListThingsInBillingGroup
$creadsPrec :: Int -> ReadS ListThingsInBillingGroup
Prelude.Read, Int -> ListThingsInBillingGroup -> ShowS
[ListThingsInBillingGroup] -> ShowS
ListThingsInBillingGroup -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListThingsInBillingGroup] -> ShowS
$cshowList :: [ListThingsInBillingGroup] -> ShowS
show :: ListThingsInBillingGroup -> String
$cshow :: ListThingsInBillingGroup -> String
showsPrec :: Int -> ListThingsInBillingGroup -> ShowS
$cshowsPrec :: Int -> ListThingsInBillingGroup -> ShowS
Prelude.Show, forall x.
Rep ListThingsInBillingGroup x -> ListThingsInBillingGroup
forall x.
ListThingsInBillingGroup -> Rep ListThingsInBillingGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListThingsInBillingGroup x -> ListThingsInBillingGroup
$cfrom :: forall x.
ListThingsInBillingGroup -> Rep ListThingsInBillingGroup x
Prelude.Generic)
newListThingsInBillingGroup ::
Prelude.Text ->
ListThingsInBillingGroup
newListThingsInBillingGroup :: Text -> ListThingsInBillingGroup
newListThingsInBillingGroup Text
pBillingGroupName_ =
ListThingsInBillingGroup'
{ $sel:maxResults:ListThingsInBillingGroup' :: Maybe Natural
maxResults =
forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListThingsInBillingGroup' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:billingGroupName:ListThingsInBillingGroup' :: Text
billingGroupName = Text
pBillingGroupName_
}
listThingsInBillingGroup_maxResults :: Lens.Lens' ListThingsInBillingGroup (Prelude.Maybe Prelude.Natural)
listThingsInBillingGroup_maxResults :: Lens' ListThingsInBillingGroup (Maybe Natural)
listThingsInBillingGroup_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListThingsInBillingGroup' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListThingsInBillingGroup' :: ListThingsInBillingGroup -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListThingsInBillingGroup
s@ListThingsInBillingGroup' {} Maybe Natural
a -> ListThingsInBillingGroup
s {$sel:maxResults:ListThingsInBillingGroup' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListThingsInBillingGroup)
listThingsInBillingGroup_nextToken :: Lens.Lens' ListThingsInBillingGroup (Prelude.Maybe Prelude.Text)
listThingsInBillingGroup_nextToken :: Lens' ListThingsInBillingGroup (Maybe Text)
listThingsInBillingGroup_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListThingsInBillingGroup' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListThingsInBillingGroup' :: ListThingsInBillingGroup -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListThingsInBillingGroup
s@ListThingsInBillingGroup' {} Maybe Text
a -> ListThingsInBillingGroup
s {$sel:nextToken:ListThingsInBillingGroup' :: Maybe Text
nextToken = Maybe Text
a} :: ListThingsInBillingGroup)
listThingsInBillingGroup_billingGroupName :: Lens.Lens' ListThingsInBillingGroup Prelude.Text
listThingsInBillingGroup_billingGroupName :: Lens' ListThingsInBillingGroup Text
listThingsInBillingGroup_billingGroupName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListThingsInBillingGroup' {Text
billingGroupName :: Text
$sel:billingGroupName:ListThingsInBillingGroup' :: ListThingsInBillingGroup -> Text
billingGroupName} -> Text
billingGroupName) (\s :: ListThingsInBillingGroup
s@ListThingsInBillingGroup' {} Text
a -> ListThingsInBillingGroup
s {$sel:billingGroupName:ListThingsInBillingGroup' :: Text
billingGroupName = Text
a} :: ListThingsInBillingGroup)
instance Core.AWSPager ListThingsInBillingGroup where
page :: ListThingsInBillingGroup
-> AWSResponse ListThingsInBillingGroup
-> Maybe ListThingsInBillingGroup
page ListThingsInBillingGroup
rq AWSResponse ListThingsInBillingGroup
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListThingsInBillingGroup
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListThingsInBillingGroupResponse (Maybe Text)
listThingsInBillingGroupResponse_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 ListThingsInBillingGroup
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListThingsInBillingGroupResponse (Maybe [Text])
listThingsInBillingGroupResponse_things
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.$ ListThingsInBillingGroup
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListThingsInBillingGroup (Maybe Text)
listThingsInBillingGroup_nextToken
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListThingsInBillingGroup
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListThingsInBillingGroupResponse (Maybe Text)
listThingsInBillingGroupResponse_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 ListThingsInBillingGroup where
type
AWSResponse ListThingsInBillingGroup =
ListThingsInBillingGroupResponse
request :: (Service -> Service)
-> ListThingsInBillingGroup -> Request ListThingsInBillingGroup
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 ListThingsInBillingGroup
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ListThingsInBillingGroup)))
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 -> ListThingsInBillingGroupResponse
ListThingsInBillingGroupResponse'
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
"things" 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 ListThingsInBillingGroup where
hashWithSalt :: Int -> ListThingsInBillingGroup -> Int
hashWithSalt Int
_salt ListThingsInBillingGroup' {Maybe Natural
Maybe Text
Text
billingGroupName :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:billingGroupName:ListThingsInBillingGroup' :: ListThingsInBillingGroup -> Text
$sel:nextToken:ListThingsInBillingGroup' :: ListThingsInBillingGroup -> Maybe Text
$sel:maxResults:ListThingsInBillingGroup' :: ListThingsInBillingGroup -> 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
billingGroupName
instance Prelude.NFData ListThingsInBillingGroup where
rnf :: ListThingsInBillingGroup -> ()
rnf ListThingsInBillingGroup' {Maybe Natural
Maybe Text
Text
billingGroupName :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:billingGroupName:ListThingsInBillingGroup' :: ListThingsInBillingGroup -> Text
$sel:nextToken:ListThingsInBillingGroup' :: ListThingsInBillingGroup -> Maybe Text
$sel:maxResults:ListThingsInBillingGroup' :: ListThingsInBillingGroup -> 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
billingGroupName
instance Data.ToHeaders ListThingsInBillingGroup where
toHeaders :: ListThingsInBillingGroup -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
instance Data.ToPath ListThingsInBillingGroup where
toPath :: ListThingsInBillingGroup -> ByteString
toPath ListThingsInBillingGroup' {Maybe Natural
Maybe Text
Text
billingGroupName :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:billingGroupName:ListThingsInBillingGroup' :: ListThingsInBillingGroup -> Text
$sel:nextToken:ListThingsInBillingGroup' :: ListThingsInBillingGroup -> Maybe Text
$sel:maxResults:ListThingsInBillingGroup' :: ListThingsInBillingGroup -> Maybe Natural
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/billing-groups/",
forall a. ToByteString a => a -> ByteString
Data.toBS Text
billingGroupName,
ByteString
"/things"
]
instance Data.ToQuery ListThingsInBillingGroup where
toQuery :: ListThingsInBillingGroup -> QueryString
toQuery ListThingsInBillingGroup' {Maybe Natural
Maybe Text
Text
billingGroupName :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:billingGroupName:ListThingsInBillingGroup' :: ListThingsInBillingGroup -> Text
$sel:nextToken:ListThingsInBillingGroup' :: ListThingsInBillingGroup -> Maybe Text
$sel:maxResults:ListThingsInBillingGroup' :: ListThingsInBillingGroup -> 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 ListThingsInBillingGroupResponse = ListThingsInBillingGroupResponse'
{
ListThingsInBillingGroupResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListThingsInBillingGroupResponse -> Maybe [Text]
things :: Prelude.Maybe [Prelude.Text],
ListThingsInBillingGroupResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListThingsInBillingGroupResponse
-> ListThingsInBillingGroupResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListThingsInBillingGroupResponse
-> ListThingsInBillingGroupResponse -> Bool
$c/= :: ListThingsInBillingGroupResponse
-> ListThingsInBillingGroupResponse -> Bool
== :: ListThingsInBillingGroupResponse
-> ListThingsInBillingGroupResponse -> Bool
$c== :: ListThingsInBillingGroupResponse
-> ListThingsInBillingGroupResponse -> Bool
Prelude.Eq, ReadPrec [ListThingsInBillingGroupResponse]
ReadPrec ListThingsInBillingGroupResponse
Int -> ReadS ListThingsInBillingGroupResponse
ReadS [ListThingsInBillingGroupResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListThingsInBillingGroupResponse]
$creadListPrec :: ReadPrec [ListThingsInBillingGroupResponse]
readPrec :: ReadPrec ListThingsInBillingGroupResponse
$creadPrec :: ReadPrec ListThingsInBillingGroupResponse
readList :: ReadS [ListThingsInBillingGroupResponse]
$creadList :: ReadS [ListThingsInBillingGroupResponse]
readsPrec :: Int -> ReadS ListThingsInBillingGroupResponse
$creadsPrec :: Int -> ReadS ListThingsInBillingGroupResponse
Prelude.Read, Int -> ListThingsInBillingGroupResponse -> ShowS
[ListThingsInBillingGroupResponse] -> ShowS
ListThingsInBillingGroupResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListThingsInBillingGroupResponse] -> ShowS
$cshowList :: [ListThingsInBillingGroupResponse] -> ShowS
show :: ListThingsInBillingGroupResponse -> String
$cshow :: ListThingsInBillingGroupResponse -> String
showsPrec :: Int -> ListThingsInBillingGroupResponse -> ShowS
$cshowsPrec :: Int -> ListThingsInBillingGroupResponse -> ShowS
Prelude.Show, forall x.
Rep ListThingsInBillingGroupResponse x
-> ListThingsInBillingGroupResponse
forall x.
ListThingsInBillingGroupResponse
-> Rep ListThingsInBillingGroupResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListThingsInBillingGroupResponse x
-> ListThingsInBillingGroupResponse
$cfrom :: forall x.
ListThingsInBillingGroupResponse
-> Rep ListThingsInBillingGroupResponse x
Prelude.Generic)
newListThingsInBillingGroupResponse ::
Prelude.Int ->
ListThingsInBillingGroupResponse
newListThingsInBillingGroupResponse :: Int -> ListThingsInBillingGroupResponse
newListThingsInBillingGroupResponse Int
pHttpStatus_ =
ListThingsInBillingGroupResponse'
{ $sel:nextToken:ListThingsInBillingGroupResponse' :: Maybe Text
nextToken =
forall a. Maybe a
Prelude.Nothing,
$sel:things:ListThingsInBillingGroupResponse' :: Maybe [Text]
things = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListThingsInBillingGroupResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listThingsInBillingGroupResponse_nextToken :: Lens.Lens' ListThingsInBillingGroupResponse (Prelude.Maybe Prelude.Text)
listThingsInBillingGroupResponse_nextToken :: Lens' ListThingsInBillingGroupResponse (Maybe Text)
listThingsInBillingGroupResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListThingsInBillingGroupResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListThingsInBillingGroupResponse' :: ListThingsInBillingGroupResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListThingsInBillingGroupResponse
s@ListThingsInBillingGroupResponse' {} Maybe Text
a -> ListThingsInBillingGroupResponse
s {$sel:nextToken:ListThingsInBillingGroupResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListThingsInBillingGroupResponse)
listThingsInBillingGroupResponse_things :: Lens.Lens' ListThingsInBillingGroupResponse (Prelude.Maybe [Prelude.Text])
listThingsInBillingGroupResponse_things :: Lens' ListThingsInBillingGroupResponse (Maybe [Text])
listThingsInBillingGroupResponse_things = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListThingsInBillingGroupResponse' {Maybe [Text]
things :: Maybe [Text]
$sel:things:ListThingsInBillingGroupResponse' :: ListThingsInBillingGroupResponse -> Maybe [Text]
things} -> Maybe [Text]
things) (\s :: ListThingsInBillingGroupResponse
s@ListThingsInBillingGroupResponse' {} Maybe [Text]
a -> ListThingsInBillingGroupResponse
s {$sel:things:ListThingsInBillingGroupResponse' :: Maybe [Text]
things = Maybe [Text]
a} :: ListThingsInBillingGroupResponse) 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
listThingsInBillingGroupResponse_httpStatus :: Lens.Lens' ListThingsInBillingGroupResponse Prelude.Int
listThingsInBillingGroupResponse_httpStatus :: Lens' ListThingsInBillingGroupResponse Int
listThingsInBillingGroupResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListThingsInBillingGroupResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListThingsInBillingGroupResponse' :: ListThingsInBillingGroupResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListThingsInBillingGroupResponse
s@ListThingsInBillingGroupResponse' {} Int
a -> ListThingsInBillingGroupResponse
s {$sel:httpStatus:ListThingsInBillingGroupResponse' :: Int
httpStatus = Int
a} :: ListThingsInBillingGroupResponse)
instance
Prelude.NFData
ListThingsInBillingGroupResponse
where
rnf :: ListThingsInBillingGroupResponse -> ()
rnf ListThingsInBillingGroupResponse' {Int
Maybe [Text]
Maybe Text
httpStatus :: Int
things :: Maybe [Text]
nextToken :: Maybe Text
$sel:httpStatus:ListThingsInBillingGroupResponse' :: ListThingsInBillingGroupResponse -> Int
$sel:things:ListThingsInBillingGroupResponse' :: ListThingsInBillingGroupResponse -> Maybe [Text]
$sel:nextToken:ListThingsInBillingGroupResponse' :: ListThingsInBillingGroupResponse -> 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]
things
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus