{-# 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.GetProposal
(
GetProposal (..),
newGetProposal,
getProposal_networkId,
getProposal_proposalId,
GetProposalResponse (..),
newGetProposalResponse,
getProposalResponse_proposal,
getProposalResponse_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 GetProposal = GetProposal'
{
GetProposal -> Text
networkId :: Prelude.Text,
GetProposal -> Text
proposalId :: Prelude.Text
}
deriving (GetProposal -> GetProposal -> Bool
(GetProposal -> GetProposal -> Bool)
-> (GetProposal -> GetProposal -> Bool) -> Eq GetProposal
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetProposal -> GetProposal -> Bool
$c/= :: GetProposal -> GetProposal -> Bool
== :: GetProposal -> GetProposal -> Bool
$c== :: GetProposal -> GetProposal -> Bool
Prelude.Eq, ReadPrec [GetProposal]
ReadPrec GetProposal
Int -> ReadS GetProposal
ReadS [GetProposal]
(Int -> ReadS GetProposal)
-> ReadS [GetProposal]
-> ReadPrec GetProposal
-> ReadPrec [GetProposal]
-> Read GetProposal
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetProposal]
$creadListPrec :: ReadPrec [GetProposal]
readPrec :: ReadPrec GetProposal
$creadPrec :: ReadPrec GetProposal
readList :: ReadS [GetProposal]
$creadList :: ReadS [GetProposal]
readsPrec :: Int -> ReadS GetProposal
$creadsPrec :: Int -> ReadS GetProposal
Prelude.Read, Int -> GetProposal -> ShowS
[GetProposal] -> ShowS
GetProposal -> String
(Int -> GetProposal -> ShowS)
-> (GetProposal -> String)
-> ([GetProposal] -> ShowS)
-> Show GetProposal
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetProposal] -> ShowS
$cshowList :: [GetProposal] -> ShowS
show :: GetProposal -> String
$cshow :: GetProposal -> String
showsPrec :: Int -> GetProposal -> ShowS
$cshowsPrec :: Int -> GetProposal -> ShowS
Prelude.Show, (forall x. GetProposal -> Rep GetProposal x)
-> (forall x. Rep GetProposal x -> GetProposal)
-> Generic GetProposal
forall x. Rep GetProposal x -> GetProposal
forall x. GetProposal -> Rep GetProposal x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetProposal x -> GetProposal
$cfrom :: forall x. GetProposal -> Rep GetProposal x
Prelude.Generic)
newGetProposal ::
Prelude.Text ->
Prelude.Text ->
GetProposal
newGetProposal :: Text -> Text -> GetProposal
newGetProposal Text
pNetworkId_ Text
pProposalId_ =
GetProposal' :: Text -> Text -> GetProposal
GetProposal'
{ $sel:networkId:GetProposal' :: Text
networkId = Text
pNetworkId_,
$sel:proposalId:GetProposal' :: Text
proposalId = Text
pProposalId_
}
getProposal_networkId :: Lens.Lens' GetProposal Prelude.Text
getProposal_networkId :: (Text -> f Text) -> GetProposal -> f GetProposal
getProposal_networkId = (GetProposal -> Text)
-> (GetProposal -> Text -> GetProposal)
-> Lens GetProposal GetProposal Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetProposal' {Text
networkId :: Text
$sel:networkId:GetProposal' :: GetProposal -> Text
networkId} -> Text
networkId) (\s :: GetProposal
s@GetProposal' {} Text
a -> GetProposal
s {$sel:networkId:GetProposal' :: Text
networkId = Text
a} :: GetProposal)
getProposal_proposalId :: Lens.Lens' GetProposal Prelude.Text
getProposal_proposalId :: (Text -> f Text) -> GetProposal -> f GetProposal
getProposal_proposalId = (GetProposal -> Text)
-> (GetProposal -> Text -> GetProposal)
-> Lens GetProposal GetProposal Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetProposal' {Text
proposalId :: Text
$sel:proposalId:GetProposal' :: GetProposal -> Text
proposalId} -> Text
proposalId) (\s :: GetProposal
s@GetProposal' {} Text
a -> GetProposal
s {$sel:proposalId:GetProposal' :: Text
proposalId = Text
a} :: GetProposal)
instance Core.AWSRequest GetProposal where
type AWSResponse GetProposal = GetProposalResponse
request :: GetProposal -> Request GetProposal
request = Service -> GetProposal -> Request GetProposal
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetProposal
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetProposal)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetProposal))
-> Logger
-> Service
-> Proxy GetProposal
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetProposal)))
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 Proposal -> Int -> GetProposalResponse
GetProposalResponse'
(Maybe Proposal -> Int -> GetProposalResponse)
-> Either String (Maybe Proposal)
-> Either String (Int -> GetProposalResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Proposal)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Proposal")
Either String (Int -> GetProposalResponse)
-> Either String Int -> Either String GetProposalResponse
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 GetProposal
instance Prelude.NFData GetProposal
instance Core.ToHeaders GetProposal where
toHeaders :: GetProposal -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetProposal -> 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 GetProposal where
toPath :: GetProposal -> ByteString
toPath GetProposal' {Text
proposalId :: Text
networkId :: Text
$sel:proposalId:GetProposal' :: GetProposal -> Text
$sel:networkId:GetProposal' :: GetProposal -> 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
"/proposals/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
proposalId
]
instance Core.ToQuery GetProposal where
toQuery :: GetProposal -> QueryString
toQuery = QueryString -> GetProposal -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetProposalResponse = GetProposalResponse'
{
GetProposalResponse -> Maybe Proposal
proposal :: Prelude.Maybe Proposal,
GetProposalResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetProposalResponse -> GetProposalResponse -> Bool
(GetProposalResponse -> GetProposalResponse -> Bool)
-> (GetProposalResponse -> GetProposalResponse -> Bool)
-> Eq GetProposalResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetProposalResponse -> GetProposalResponse -> Bool
$c/= :: GetProposalResponse -> GetProposalResponse -> Bool
== :: GetProposalResponse -> GetProposalResponse -> Bool
$c== :: GetProposalResponse -> GetProposalResponse -> Bool
Prelude.Eq, ReadPrec [GetProposalResponse]
ReadPrec GetProposalResponse
Int -> ReadS GetProposalResponse
ReadS [GetProposalResponse]
(Int -> ReadS GetProposalResponse)
-> ReadS [GetProposalResponse]
-> ReadPrec GetProposalResponse
-> ReadPrec [GetProposalResponse]
-> Read GetProposalResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetProposalResponse]
$creadListPrec :: ReadPrec [GetProposalResponse]
readPrec :: ReadPrec GetProposalResponse
$creadPrec :: ReadPrec GetProposalResponse
readList :: ReadS [GetProposalResponse]
$creadList :: ReadS [GetProposalResponse]
readsPrec :: Int -> ReadS GetProposalResponse
$creadsPrec :: Int -> ReadS GetProposalResponse
Prelude.Read, Int -> GetProposalResponse -> ShowS
[GetProposalResponse] -> ShowS
GetProposalResponse -> String
(Int -> GetProposalResponse -> ShowS)
-> (GetProposalResponse -> String)
-> ([GetProposalResponse] -> ShowS)
-> Show GetProposalResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetProposalResponse] -> ShowS
$cshowList :: [GetProposalResponse] -> ShowS
show :: GetProposalResponse -> String
$cshow :: GetProposalResponse -> String
showsPrec :: Int -> GetProposalResponse -> ShowS
$cshowsPrec :: Int -> GetProposalResponse -> ShowS
Prelude.Show, (forall x. GetProposalResponse -> Rep GetProposalResponse x)
-> (forall x. Rep GetProposalResponse x -> GetProposalResponse)
-> Generic GetProposalResponse
forall x. Rep GetProposalResponse x -> GetProposalResponse
forall x. GetProposalResponse -> Rep GetProposalResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetProposalResponse x -> GetProposalResponse
$cfrom :: forall x. GetProposalResponse -> Rep GetProposalResponse x
Prelude.Generic)
newGetProposalResponse ::
Prelude.Int ->
GetProposalResponse
newGetProposalResponse :: Int -> GetProposalResponse
newGetProposalResponse Int
pHttpStatus_ =
GetProposalResponse' :: Maybe Proposal -> Int -> GetProposalResponse
GetProposalResponse'
{ $sel:proposal:GetProposalResponse' :: Maybe Proposal
proposal = Maybe Proposal
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetProposalResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getProposalResponse_proposal :: Lens.Lens' GetProposalResponse (Prelude.Maybe Proposal)
getProposalResponse_proposal :: (Maybe Proposal -> f (Maybe Proposal))
-> GetProposalResponse -> f GetProposalResponse
getProposalResponse_proposal = (GetProposalResponse -> Maybe Proposal)
-> (GetProposalResponse -> Maybe Proposal -> GetProposalResponse)
-> Lens
GetProposalResponse
GetProposalResponse
(Maybe Proposal)
(Maybe Proposal)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetProposalResponse' {Maybe Proposal
proposal :: Maybe Proposal
$sel:proposal:GetProposalResponse' :: GetProposalResponse -> Maybe Proposal
proposal} -> Maybe Proposal
proposal) (\s :: GetProposalResponse
s@GetProposalResponse' {} Maybe Proposal
a -> GetProposalResponse
s {$sel:proposal:GetProposalResponse' :: Maybe Proposal
proposal = Maybe Proposal
a} :: GetProposalResponse)
getProposalResponse_httpStatus :: Lens.Lens' GetProposalResponse Prelude.Int
getProposalResponse_httpStatus :: (Int -> f Int) -> GetProposalResponse -> f GetProposalResponse
getProposalResponse_httpStatus = (GetProposalResponse -> Int)
-> (GetProposalResponse -> Int -> GetProposalResponse)
-> Lens GetProposalResponse GetProposalResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetProposalResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetProposalResponse' :: GetProposalResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetProposalResponse
s@GetProposalResponse' {} Int
a -> GetProposalResponse
s {$sel:httpStatus:GetProposalResponse' :: Int
httpStatus = Int
a} :: GetProposalResponse)
instance Prelude.NFData GetProposalResponse