{-# 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.Kafka.ListNodes
(
ListNodes (..),
newListNodes,
listNodes_maxResults,
listNodes_nextToken,
listNodes_clusterArn,
ListNodesResponse (..),
newListNodesResponse,
listNodesResponse_nextToken,
listNodesResponse_nodeInfoList,
listNodesResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Kafka.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data ListNodes = ListNodes'
{
ListNodes -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
ListNodes -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListNodes -> Text
clusterArn :: Prelude.Text
}
deriving (ListNodes -> ListNodes -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListNodes -> ListNodes -> Bool
$c/= :: ListNodes -> ListNodes -> Bool
== :: ListNodes -> ListNodes -> Bool
$c== :: ListNodes -> ListNodes -> Bool
Prelude.Eq, ReadPrec [ListNodes]
ReadPrec ListNodes
Int -> ReadS ListNodes
ReadS [ListNodes]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListNodes]
$creadListPrec :: ReadPrec [ListNodes]
readPrec :: ReadPrec ListNodes
$creadPrec :: ReadPrec ListNodes
readList :: ReadS [ListNodes]
$creadList :: ReadS [ListNodes]
readsPrec :: Int -> ReadS ListNodes
$creadsPrec :: Int -> ReadS ListNodes
Prelude.Read, Int -> ListNodes -> ShowS
[ListNodes] -> ShowS
ListNodes -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListNodes] -> ShowS
$cshowList :: [ListNodes] -> ShowS
show :: ListNodes -> String
$cshow :: ListNodes -> String
showsPrec :: Int -> ListNodes -> ShowS
$cshowsPrec :: Int -> ListNodes -> ShowS
Prelude.Show, forall x. Rep ListNodes x -> ListNodes
forall x. ListNodes -> Rep ListNodes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListNodes x -> ListNodes
$cfrom :: forall x. ListNodes -> Rep ListNodes x
Prelude.Generic)
newListNodes ::
Prelude.Text ->
ListNodes
newListNodes :: Text -> ListNodes
newListNodes Text
pClusterArn_ =
ListNodes'
{ $sel:maxResults:ListNodes' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListNodes' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:clusterArn:ListNodes' :: Text
clusterArn = Text
pClusterArn_
}
listNodes_maxResults :: Lens.Lens' ListNodes (Prelude.Maybe Prelude.Natural)
listNodes_maxResults :: Lens' ListNodes (Maybe Natural)
listNodes_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListNodes' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListNodes' :: ListNodes -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListNodes
s@ListNodes' {} Maybe Natural
a -> ListNodes
s {$sel:maxResults:ListNodes' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListNodes)
listNodes_nextToken :: Lens.Lens' ListNodes (Prelude.Maybe Prelude.Text)
listNodes_nextToken :: Lens' ListNodes (Maybe Text)
listNodes_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListNodes' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListNodes' :: ListNodes -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListNodes
s@ListNodes' {} Maybe Text
a -> ListNodes
s {$sel:nextToken:ListNodes' :: Maybe Text
nextToken = Maybe Text
a} :: ListNodes)
listNodes_clusterArn :: Lens.Lens' ListNodes Prelude.Text
listNodes_clusterArn :: Lens' ListNodes Text
listNodes_clusterArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListNodes' {Text
clusterArn :: Text
$sel:clusterArn:ListNodes' :: ListNodes -> Text
clusterArn} -> Text
clusterArn) (\s :: ListNodes
s@ListNodes' {} Text
a -> ListNodes
s {$sel:clusterArn:ListNodes' :: Text
clusterArn = Text
a} :: ListNodes)
instance Core.AWSPager ListNodes where
page :: ListNodes -> AWSResponse ListNodes -> Maybe ListNodes
page ListNodes
rq AWSResponse ListNodes
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListNodes
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListNodesResponse (Maybe Text)
listNodesResponse_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 ListNodes
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListNodesResponse (Maybe [NodeInfo])
listNodesResponse_nodeInfoList
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.$ ListNodes
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListNodes (Maybe Text)
listNodes_nextToken
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListNodes
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListNodesResponse (Maybe Text)
listNodesResponse_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 ListNodes where
type AWSResponse ListNodes = ListNodesResponse
request :: (Service -> Service) -> ListNodes -> Request ListNodes
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 ListNodes
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListNodes)))
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 [NodeInfo] -> Int -> ListNodesResponse
ListNodesResponse'
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
"nodeInfoList" 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 ListNodes where
hashWithSalt :: Int -> ListNodes -> Int
hashWithSalt Int
_salt ListNodes' {Maybe Natural
Maybe Text
Text
clusterArn :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:clusterArn:ListNodes' :: ListNodes -> Text
$sel:nextToken:ListNodes' :: ListNodes -> Maybe Text
$sel:maxResults:ListNodes' :: ListNodes -> 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
clusterArn
instance Prelude.NFData ListNodes where
rnf :: ListNodes -> ()
rnf ListNodes' {Maybe Natural
Maybe Text
Text
clusterArn :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:clusterArn:ListNodes' :: ListNodes -> Text
$sel:nextToken:ListNodes' :: ListNodes -> Maybe Text
$sel:maxResults:ListNodes' :: ListNodes -> 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
clusterArn
instance Data.ToHeaders ListNodes where
toHeaders :: ListNodes -> 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 ListNodes where
toPath :: ListNodes -> ByteString
toPath ListNodes' {Maybe Natural
Maybe Text
Text
clusterArn :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:clusterArn:ListNodes' :: ListNodes -> Text
$sel:nextToken:ListNodes' :: ListNodes -> Maybe Text
$sel:maxResults:ListNodes' :: ListNodes -> Maybe Natural
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/v1/clusters/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
clusterArn, ByteString
"/nodes"]
instance Data.ToQuery ListNodes where
toQuery :: ListNodes -> QueryString
toQuery ListNodes' {Maybe Natural
Maybe Text
Text
clusterArn :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:clusterArn:ListNodes' :: ListNodes -> Text
$sel:nextToken:ListNodes' :: ListNodes -> Maybe Text
$sel:maxResults:ListNodes' :: ListNodes -> 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 ListNodesResponse = ListNodesResponse'
{
ListNodesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListNodesResponse -> Maybe [NodeInfo]
nodeInfoList :: Prelude.Maybe [NodeInfo],
ListNodesResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListNodesResponse -> ListNodesResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListNodesResponse -> ListNodesResponse -> Bool
$c/= :: ListNodesResponse -> ListNodesResponse -> Bool
== :: ListNodesResponse -> ListNodesResponse -> Bool
$c== :: ListNodesResponse -> ListNodesResponse -> Bool
Prelude.Eq, ReadPrec [ListNodesResponse]
ReadPrec ListNodesResponse
Int -> ReadS ListNodesResponse
ReadS [ListNodesResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListNodesResponse]
$creadListPrec :: ReadPrec [ListNodesResponse]
readPrec :: ReadPrec ListNodesResponse
$creadPrec :: ReadPrec ListNodesResponse
readList :: ReadS [ListNodesResponse]
$creadList :: ReadS [ListNodesResponse]
readsPrec :: Int -> ReadS ListNodesResponse
$creadsPrec :: Int -> ReadS ListNodesResponse
Prelude.Read, Int -> ListNodesResponse -> ShowS
[ListNodesResponse] -> ShowS
ListNodesResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListNodesResponse] -> ShowS
$cshowList :: [ListNodesResponse] -> ShowS
show :: ListNodesResponse -> String
$cshow :: ListNodesResponse -> String
showsPrec :: Int -> ListNodesResponse -> ShowS
$cshowsPrec :: Int -> ListNodesResponse -> ShowS
Prelude.Show, forall x. Rep ListNodesResponse x -> ListNodesResponse
forall x. ListNodesResponse -> Rep ListNodesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListNodesResponse x -> ListNodesResponse
$cfrom :: forall x. ListNodesResponse -> Rep ListNodesResponse x
Prelude.Generic)
newListNodesResponse ::
Prelude.Int ->
ListNodesResponse
newListNodesResponse :: Int -> ListNodesResponse
newListNodesResponse Int
pHttpStatus_ =
ListNodesResponse'
{ $sel:nextToken:ListNodesResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:nodeInfoList:ListNodesResponse' :: Maybe [NodeInfo]
nodeInfoList = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListNodesResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listNodesResponse_nextToken :: Lens.Lens' ListNodesResponse (Prelude.Maybe Prelude.Text)
listNodesResponse_nextToken :: Lens' ListNodesResponse (Maybe Text)
listNodesResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListNodesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListNodesResponse' :: ListNodesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListNodesResponse
s@ListNodesResponse' {} Maybe Text
a -> ListNodesResponse
s {$sel:nextToken:ListNodesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListNodesResponse)
listNodesResponse_nodeInfoList :: Lens.Lens' ListNodesResponse (Prelude.Maybe [NodeInfo])
listNodesResponse_nodeInfoList :: Lens' ListNodesResponse (Maybe [NodeInfo])
listNodesResponse_nodeInfoList = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListNodesResponse' {Maybe [NodeInfo]
nodeInfoList :: Maybe [NodeInfo]
$sel:nodeInfoList:ListNodesResponse' :: ListNodesResponse -> Maybe [NodeInfo]
nodeInfoList} -> Maybe [NodeInfo]
nodeInfoList) (\s :: ListNodesResponse
s@ListNodesResponse' {} Maybe [NodeInfo]
a -> ListNodesResponse
s {$sel:nodeInfoList:ListNodesResponse' :: Maybe [NodeInfo]
nodeInfoList = Maybe [NodeInfo]
a} :: ListNodesResponse) 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
listNodesResponse_httpStatus :: Lens.Lens' ListNodesResponse Prelude.Int
listNodesResponse_httpStatus :: Lens' ListNodesResponse Int
listNodesResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListNodesResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListNodesResponse' :: ListNodesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListNodesResponse
s@ListNodesResponse' {} Int
a -> ListNodesResponse
s {$sel:httpStatus:ListNodesResponse' :: Int
httpStatus = Int
a} :: ListNodesResponse)
instance Prelude.NFData ListNodesResponse where
rnf :: ListNodesResponse -> ()
rnf ListNodesResponse' {Int
Maybe [NodeInfo]
Maybe Text
httpStatus :: Int
nodeInfoList :: Maybe [NodeInfo]
nextToken :: Maybe Text
$sel:httpStatus:ListNodesResponse' :: ListNodesResponse -> Int
$sel:nodeInfoList:ListNodesResponse' :: ListNodesResponse -> Maybe [NodeInfo]
$sel:nextToken:ListNodesResponse' :: ListNodesResponse -> 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 [NodeInfo]
nodeInfoList
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus