{-# 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.ManagedBlockChain.GetNode
(
GetNode (..),
newGetNode,
getNode_memberId,
getNode_networkId,
getNode_nodeId,
GetNodeResponse (..),
newGetNodeResponse,
getNodeResponse_node,
getNodeResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.ManagedBlockChain.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data GetNode = GetNode'
{
GetNode -> Maybe Text
memberId :: Prelude.Maybe Prelude.Text,
GetNode -> Text
networkId :: Prelude.Text,
GetNode -> Text
nodeId :: Prelude.Text
}
deriving (GetNode -> GetNode -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetNode -> GetNode -> Bool
$c/= :: GetNode -> GetNode -> Bool
== :: GetNode -> GetNode -> Bool
$c== :: GetNode -> GetNode -> Bool
Prelude.Eq, ReadPrec [GetNode]
ReadPrec GetNode
Int -> ReadS GetNode
ReadS [GetNode]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetNode]
$creadListPrec :: ReadPrec [GetNode]
readPrec :: ReadPrec GetNode
$creadPrec :: ReadPrec GetNode
readList :: ReadS [GetNode]
$creadList :: ReadS [GetNode]
readsPrec :: Int -> ReadS GetNode
$creadsPrec :: Int -> ReadS GetNode
Prelude.Read, Int -> GetNode -> ShowS
[GetNode] -> ShowS
GetNode -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetNode] -> ShowS
$cshowList :: [GetNode] -> ShowS
show :: GetNode -> String
$cshow :: GetNode -> String
showsPrec :: Int -> GetNode -> ShowS
$cshowsPrec :: Int -> GetNode -> ShowS
Prelude.Show, forall x. Rep GetNode x -> GetNode
forall x. GetNode -> Rep GetNode x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetNode x -> GetNode
$cfrom :: forall x. GetNode -> Rep GetNode x
Prelude.Generic)
newGetNode ::
Prelude.Text ->
Prelude.Text ->
GetNode
newGetNode :: Text -> Text -> GetNode
newGetNode Text
pNetworkId_ Text
pNodeId_ =
GetNode'
{ $sel:memberId:GetNode' :: Maybe Text
memberId = forall a. Maybe a
Prelude.Nothing,
$sel:networkId:GetNode' :: Text
networkId = Text
pNetworkId_,
$sel:nodeId:GetNode' :: Text
nodeId = Text
pNodeId_
}
getNode_memberId :: Lens.Lens' GetNode (Prelude.Maybe Prelude.Text)
getNode_memberId :: Lens' GetNode (Maybe Text)
getNode_memberId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetNode' {Maybe Text
memberId :: Maybe Text
$sel:memberId:GetNode' :: GetNode -> Maybe Text
memberId} -> Maybe Text
memberId) (\s :: GetNode
s@GetNode' {} Maybe Text
a -> GetNode
s {$sel:memberId:GetNode' :: Maybe Text
memberId = Maybe Text
a} :: GetNode)
getNode_networkId :: Lens.Lens' GetNode Prelude.Text
getNode_networkId :: Lens' GetNode Text
getNode_networkId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetNode' {Text
networkId :: Text
$sel:networkId:GetNode' :: GetNode -> Text
networkId} -> Text
networkId) (\s :: GetNode
s@GetNode' {} Text
a -> GetNode
s {$sel:networkId:GetNode' :: Text
networkId = Text
a} :: GetNode)
getNode_nodeId :: Lens.Lens' GetNode Prelude.Text
getNode_nodeId :: Lens' GetNode Text
getNode_nodeId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetNode' {Text
nodeId :: Text
$sel:nodeId:GetNode' :: GetNode -> Text
nodeId} -> Text
nodeId) (\s :: GetNode
s@GetNode' {} Text
a -> GetNode
s {$sel:nodeId:GetNode' :: Text
nodeId = Text
a} :: GetNode)
instance Core.AWSRequest GetNode where
type AWSResponse GetNode = GetNodeResponse
request :: (Service -> Service) -> GetNode -> Request GetNode
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 GetNode
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetNode)))
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 Node -> Int -> GetNodeResponse
GetNodeResponse'
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
"Node")
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 GetNode where
hashWithSalt :: Int -> GetNode -> Int
hashWithSalt Int
_salt GetNode' {Maybe Text
Text
nodeId :: Text
networkId :: Text
memberId :: Maybe Text
$sel:nodeId:GetNode' :: GetNode -> Text
$sel:networkId:GetNode' :: GetNode -> Text
$sel:memberId:GetNode' :: GetNode -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
memberId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
networkId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
nodeId
instance Prelude.NFData GetNode where
rnf :: GetNode -> ()
rnf GetNode' {Maybe Text
Text
nodeId :: Text
networkId :: Text
memberId :: Maybe Text
$sel:nodeId:GetNode' :: GetNode -> Text
$sel:networkId:GetNode' :: GetNode -> Text
$sel:memberId:GetNode' :: GetNode -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
memberId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
networkId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
nodeId
instance Data.ToHeaders GetNode where
toHeaders :: GetNode -> 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 GetNode where
toPath :: GetNode -> ByteString
toPath GetNode' {Maybe Text
Text
nodeId :: Text
networkId :: Text
memberId :: Maybe Text
$sel:nodeId:GetNode' :: GetNode -> Text
$sel:networkId:GetNode' :: GetNode -> Text
$sel:memberId:GetNode' :: GetNode -> Maybe Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/networks/",
forall a. ToByteString a => a -> ByteString
Data.toBS Text
networkId,
ByteString
"/nodes/",
forall a. ToByteString a => a -> ByteString
Data.toBS Text
nodeId
]
instance Data.ToQuery GetNode where
toQuery :: GetNode -> QueryString
toQuery GetNode' {Maybe Text
Text
nodeId :: Text
networkId :: Text
memberId :: Maybe Text
$sel:nodeId:GetNode' :: GetNode -> Text
$sel:networkId:GetNode' :: GetNode -> Text
$sel:memberId:GetNode' :: GetNode -> Maybe Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"memberId" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
memberId]
data GetNodeResponse = GetNodeResponse'
{
GetNodeResponse -> Maybe Node
node :: Prelude.Maybe Node,
GetNodeResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetNodeResponse -> GetNodeResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetNodeResponse -> GetNodeResponse -> Bool
$c/= :: GetNodeResponse -> GetNodeResponse -> Bool
== :: GetNodeResponse -> GetNodeResponse -> Bool
$c== :: GetNodeResponse -> GetNodeResponse -> Bool
Prelude.Eq, ReadPrec [GetNodeResponse]
ReadPrec GetNodeResponse
Int -> ReadS GetNodeResponse
ReadS [GetNodeResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetNodeResponse]
$creadListPrec :: ReadPrec [GetNodeResponse]
readPrec :: ReadPrec GetNodeResponse
$creadPrec :: ReadPrec GetNodeResponse
readList :: ReadS [GetNodeResponse]
$creadList :: ReadS [GetNodeResponse]
readsPrec :: Int -> ReadS GetNodeResponse
$creadsPrec :: Int -> ReadS GetNodeResponse
Prelude.Read, Int -> GetNodeResponse -> ShowS
[GetNodeResponse] -> ShowS
GetNodeResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetNodeResponse] -> ShowS
$cshowList :: [GetNodeResponse] -> ShowS
show :: GetNodeResponse -> String
$cshow :: GetNodeResponse -> String
showsPrec :: Int -> GetNodeResponse -> ShowS
$cshowsPrec :: Int -> GetNodeResponse -> ShowS
Prelude.Show, forall x. Rep GetNodeResponse x -> GetNodeResponse
forall x. GetNodeResponse -> Rep GetNodeResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetNodeResponse x -> GetNodeResponse
$cfrom :: forall x. GetNodeResponse -> Rep GetNodeResponse x
Prelude.Generic)
newGetNodeResponse ::
Prelude.Int ->
GetNodeResponse
newGetNodeResponse :: Int -> GetNodeResponse
newGetNodeResponse Int
pHttpStatus_ =
GetNodeResponse'
{ $sel:node:GetNodeResponse' :: Maybe Node
node = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetNodeResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getNodeResponse_node :: Lens.Lens' GetNodeResponse (Prelude.Maybe Node)
getNodeResponse_node :: Lens' GetNodeResponse (Maybe Node)
getNodeResponse_node = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetNodeResponse' {Maybe Node
node :: Maybe Node
$sel:node:GetNodeResponse' :: GetNodeResponse -> Maybe Node
node} -> Maybe Node
node) (\s :: GetNodeResponse
s@GetNodeResponse' {} Maybe Node
a -> GetNodeResponse
s {$sel:node:GetNodeResponse' :: Maybe Node
node = Maybe Node
a} :: GetNodeResponse)
getNodeResponse_httpStatus :: Lens.Lens' GetNodeResponse Prelude.Int
getNodeResponse_httpStatus :: Lens' GetNodeResponse Int
getNodeResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetNodeResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetNodeResponse' :: GetNodeResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetNodeResponse
s@GetNodeResponse' {} Int
a -> GetNodeResponse
s {$sel:httpStatus:GetNodeResponse' :: Int
httpStatus = Int
a} :: GetNodeResponse)
instance Prelude.NFData GetNodeResponse where
rnf :: GetNodeResponse -> ()
rnf GetNodeResponse' {Int
Maybe Node
httpStatus :: Int
node :: Maybe Node
$sel:httpStatus:GetNodeResponse' :: GetNodeResponse -> Int
$sel:node:GetNodeResponse' :: GetNodeResponse -> Maybe Node
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Node
node
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus