{-# 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.GetMember
(
GetMember (..),
newGetMember,
getMember_networkId,
getMember_memberId,
GetMemberResponse (..),
newGetMemberResponse,
getMemberResponse_member,
getMemberResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.ManagedBlockChain.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data GetMember = GetMember'
{
GetMember -> Text
networkId :: Prelude.Text,
GetMember -> Text
memberId :: Prelude.Text
}
deriving (GetMember -> GetMember -> Bool
(GetMember -> GetMember -> Bool)
-> (GetMember -> GetMember -> Bool) -> Eq GetMember
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetMember -> GetMember -> Bool
$c/= :: GetMember -> GetMember -> Bool
== :: GetMember -> GetMember -> Bool
$c== :: GetMember -> GetMember -> Bool
Prelude.Eq, ReadPrec [GetMember]
ReadPrec GetMember
Int -> ReadS GetMember
ReadS [GetMember]
(Int -> ReadS GetMember)
-> ReadS [GetMember]
-> ReadPrec GetMember
-> ReadPrec [GetMember]
-> Read GetMember
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetMember]
$creadListPrec :: ReadPrec [GetMember]
readPrec :: ReadPrec GetMember
$creadPrec :: ReadPrec GetMember
readList :: ReadS [GetMember]
$creadList :: ReadS [GetMember]
readsPrec :: Int -> ReadS GetMember
$creadsPrec :: Int -> ReadS GetMember
Prelude.Read, Int -> GetMember -> ShowS
[GetMember] -> ShowS
GetMember -> String
(Int -> GetMember -> ShowS)
-> (GetMember -> String)
-> ([GetMember] -> ShowS)
-> Show GetMember
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetMember] -> ShowS
$cshowList :: [GetMember] -> ShowS
show :: GetMember -> String
$cshow :: GetMember -> String
showsPrec :: Int -> GetMember -> ShowS
$cshowsPrec :: Int -> GetMember -> ShowS
Prelude.Show, (forall x. GetMember -> Rep GetMember x)
-> (forall x. Rep GetMember x -> GetMember) -> Generic GetMember
forall x. Rep GetMember x -> GetMember
forall x. GetMember -> Rep GetMember x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetMember x -> GetMember
$cfrom :: forall x. GetMember -> Rep GetMember x
Prelude.Generic)
newGetMember ::
Prelude.Text ->
Prelude.Text ->
GetMember
newGetMember :: Text -> Text -> GetMember
newGetMember Text
pNetworkId_ Text
pMemberId_ =
GetMember' :: Text -> Text -> GetMember
GetMember'
{ $sel:networkId:GetMember' :: Text
networkId = Text
pNetworkId_,
$sel:memberId:GetMember' :: Text
memberId = Text
pMemberId_
}
getMember_networkId :: Lens.Lens' GetMember Prelude.Text
getMember_networkId :: (Text -> f Text) -> GetMember -> f GetMember
getMember_networkId = (GetMember -> Text)
-> (GetMember -> Text -> GetMember)
-> Lens GetMember GetMember Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMember' {Text
networkId :: Text
$sel:networkId:GetMember' :: GetMember -> Text
networkId} -> Text
networkId) (\s :: GetMember
s@GetMember' {} Text
a -> GetMember
s {$sel:networkId:GetMember' :: Text
networkId = Text
a} :: GetMember)
getMember_memberId :: Lens.Lens' GetMember Prelude.Text
getMember_memberId :: (Text -> f Text) -> GetMember -> f GetMember
getMember_memberId = (GetMember -> Text)
-> (GetMember -> Text -> GetMember)
-> Lens GetMember GetMember Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMember' {Text
memberId :: Text
$sel:memberId:GetMember' :: GetMember -> Text
memberId} -> Text
memberId) (\s :: GetMember
s@GetMember' {} Text
a -> GetMember
s {$sel:memberId:GetMember' :: Text
memberId = Text
a} :: GetMember)
instance Core.AWSRequest GetMember where
type AWSResponse GetMember = GetMemberResponse
request :: GetMember -> Request GetMember
request = Service -> GetMember -> Request GetMember
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetMember
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetMember)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetMember))
-> Logger
-> Service
-> Proxy GetMember
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetMember)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe Member -> Int -> GetMemberResponse
GetMemberResponse'
(Maybe Member -> Int -> GetMemberResponse)
-> Either String (Maybe Member)
-> Either String (Int -> GetMemberResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Member)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Member")
Either String (Int -> GetMemberResponse)
-> Either String Int -> Either String GetMemberResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable GetMember
instance Prelude.NFData GetMember
instance Core.ToHeaders GetMember where
toHeaders :: GetMember -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetMember -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToPath GetMember where
toPath :: GetMember -> ByteString
toPath GetMember' {Text
memberId :: Text
networkId :: Text
$sel:memberId:GetMember' :: GetMember -> Text
$sel:networkId:GetMember' :: GetMember -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/networks/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
networkId,
ByteString
"/members/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
memberId
]
instance Core.ToQuery GetMember where
toQuery :: GetMember -> QueryString
toQuery = QueryString -> GetMember -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetMemberResponse = GetMemberResponse'
{
GetMemberResponse -> Maybe Member
member :: Prelude.Maybe Member,
GetMemberResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetMemberResponse -> GetMemberResponse -> Bool
(GetMemberResponse -> GetMemberResponse -> Bool)
-> (GetMemberResponse -> GetMemberResponse -> Bool)
-> Eq GetMemberResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetMemberResponse -> GetMemberResponse -> Bool
$c/= :: GetMemberResponse -> GetMemberResponse -> Bool
== :: GetMemberResponse -> GetMemberResponse -> Bool
$c== :: GetMemberResponse -> GetMemberResponse -> Bool
Prelude.Eq, ReadPrec [GetMemberResponse]
ReadPrec GetMemberResponse
Int -> ReadS GetMemberResponse
ReadS [GetMemberResponse]
(Int -> ReadS GetMemberResponse)
-> ReadS [GetMemberResponse]
-> ReadPrec GetMemberResponse
-> ReadPrec [GetMemberResponse]
-> Read GetMemberResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetMemberResponse]
$creadListPrec :: ReadPrec [GetMemberResponse]
readPrec :: ReadPrec GetMemberResponse
$creadPrec :: ReadPrec GetMemberResponse
readList :: ReadS [GetMemberResponse]
$creadList :: ReadS [GetMemberResponse]
readsPrec :: Int -> ReadS GetMemberResponse
$creadsPrec :: Int -> ReadS GetMemberResponse
Prelude.Read, Int -> GetMemberResponse -> ShowS
[GetMemberResponse] -> ShowS
GetMemberResponse -> String
(Int -> GetMemberResponse -> ShowS)
-> (GetMemberResponse -> String)
-> ([GetMemberResponse] -> ShowS)
-> Show GetMemberResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetMemberResponse] -> ShowS
$cshowList :: [GetMemberResponse] -> ShowS
show :: GetMemberResponse -> String
$cshow :: GetMemberResponse -> String
showsPrec :: Int -> GetMemberResponse -> ShowS
$cshowsPrec :: Int -> GetMemberResponse -> ShowS
Prelude.Show, (forall x. GetMemberResponse -> Rep GetMemberResponse x)
-> (forall x. Rep GetMemberResponse x -> GetMemberResponse)
-> Generic GetMemberResponse
forall x. Rep GetMemberResponse x -> GetMemberResponse
forall x. GetMemberResponse -> Rep GetMemberResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetMemberResponse x -> GetMemberResponse
$cfrom :: forall x. GetMemberResponse -> Rep GetMemberResponse x
Prelude.Generic)
newGetMemberResponse ::
Prelude.Int ->
GetMemberResponse
newGetMemberResponse :: Int -> GetMemberResponse
newGetMemberResponse Int
pHttpStatus_ =
GetMemberResponse' :: Maybe Member -> Int -> GetMemberResponse
GetMemberResponse'
{ $sel:member:GetMemberResponse' :: Maybe Member
member = Maybe Member
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetMemberResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getMemberResponse_member :: Lens.Lens' GetMemberResponse (Prelude.Maybe Member)
getMemberResponse_member :: (Maybe Member -> f (Maybe Member))
-> GetMemberResponse -> f GetMemberResponse
getMemberResponse_member = (GetMemberResponse -> Maybe Member)
-> (GetMemberResponse -> Maybe Member -> GetMemberResponse)
-> Lens
GetMemberResponse GetMemberResponse (Maybe Member) (Maybe Member)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMemberResponse' {Maybe Member
member :: Maybe Member
$sel:member:GetMemberResponse' :: GetMemberResponse -> Maybe Member
member} -> Maybe Member
member) (\s :: GetMemberResponse
s@GetMemberResponse' {} Maybe Member
a -> GetMemberResponse
s {$sel:member:GetMemberResponse' :: Maybe Member
member = Maybe Member
a} :: GetMemberResponse)
getMemberResponse_httpStatus :: Lens.Lens' GetMemberResponse Prelude.Int
getMemberResponse_httpStatus :: (Int -> f Int) -> GetMemberResponse -> f GetMemberResponse
getMemberResponse_httpStatus = (GetMemberResponse -> Int)
-> (GetMemberResponse -> Int -> GetMemberResponse)
-> Lens GetMemberResponse GetMemberResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMemberResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetMemberResponse' :: GetMemberResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetMemberResponse
s@GetMemberResponse' {} Int
a -> GetMemberResponse
s {$sel:httpStatus:GetMemberResponse' :: Int
httpStatus = Int
a} :: GetMemberResponse)
instance Prelude.NFData GetMemberResponse