{-# 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.CreateProposal
(
CreateProposal (..),
newCreateProposal,
createProposal_description,
createProposal_tags,
createProposal_clientRequestToken,
createProposal_networkId,
createProposal_memberId,
createProposal_actions,
CreateProposalResponse (..),
newCreateProposalResponse,
createProposalResponse_proposalId,
createProposalResponse_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 CreateProposal = CreateProposal'
{
CreateProposal -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
CreateProposal -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
CreateProposal -> Text
clientRequestToken :: Prelude.Text,
CreateProposal -> Text
networkId :: Prelude.Text,
CreateProposal -> Text
memberId :: Prelude.Text,
CreateProposal -> ProposalActions
actions :: ProposalActions
}
deriving (CreateProposal -> CreateProposal -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateProposal -> CreateProposal -> Bool
$c/= :: CreateProposal -> CreateProposal -> Bool
== :: CreateProposal -> CreateProposal -> Bool
$c== :: CreateProposal -> CreateProposal -> Bool
Prelude.Eq, ReadPrec [CreateProposal]
ReadPrec CreateProposal
Int -> ReadS CreateProposal
ReadS [CreateProposal]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateProposal]
$creadListPrec :: ReadPrec [CreateProposal]
readPrec :: ReadPrec CreateProposal
$creadPrec :: ReadPrec CreateProposal
readList :: ReadS [CreateProposal]
$creadList :: ReadS [CreateProposal]
readsPrec :: Int -> ReadS CreateProposal
$creadsPrec :: Int -> ReadS CreateProposal
Prelude.Read, Int -> CreateProposal -> ShowS
[CreateProposal] -> ShowS
CreateProposal -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateProposal] -> ShowS
$cshowList :: [CreateProposal] -> ShowS
show :: CreateProposal -> String
$cshow :: CreateProposal -> String
showsPrec :: Int -> CreateProposal -> ShowS
$cshowsPrec :: Int -> CreateProposal -> ShowS
Prelude.Show, forall x. Rep CreateProposal x -> CreateProposal
forall x. CreateProposal -> Rep CreateProposal x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateProposal x -> CreateProposal
$cfrom :: forall x. CreateProposal -> Rep CreateProposal x
Prelude.Generic)
newCreateProposal ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
ProposalActions ->
CreateProposal
newCreateProposal :: Text -> Text -> Text -> ProposalActions -> CreateProposal
newCreateProposal
Text
pClientRequestToken_
Text
pNetworkId_
Text
pMemberId_
ProposalActions
pActions_ =
CreateProposal'
{ $sel:description:CreateProposal' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
$sel:tags:CreateProposal' :: Maybe (HashMap Text Text)
tags = forall a. Maybe a
Prelude.Nothing,
$sel:clientRequestToken:CreateProposal' :: Text
clientRequestToken = Text
pClientRequestToken_,
$sel:networkId:CreateProposal' :: Text
networkId = Text
pNetworkId_,
$sel:memberId:CreateProposal' :: Text
memberId = Text
pMemberId_,
$sel:actions:CreateProposal' :: ProposalActions
actions = ProposalActions
pActions_
}
createProposal_description :: Lens.Lens' CreateProposal (Prelude.Maybe Prelude.Text)
createProposal_description :: Lens' CreateProposal (Maybe Text)
createProposal_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateProposal' {Maybe Text
description :: Maybe Text
$sel:description:CreateProposal' :: CreateProposal -> Maybe Text
description} -> Maybe Text
description) (\s :: CreateProposal
s@CreateProposal' {} Maybe Text
a -> CreateProposal
s {$sel:description:CreateProposal' :: Maybe Text
description = Maybe Text
a} :: CreateProposal)
createProposal_tags :: Lens.Lens' CreateProposal (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createProposal_tags :: Lens' CreateProposal (Maybe (HashMap Text Text))
createProposal_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateProposal' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:CreateProposal' :: CreateProposal -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: CreateProposal
s@CreateProposal' {} Maybe (HashMap Text Text)
a -> CreateProposal
s {$sel:tags:CreateProposal' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: CreateProposal) 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
createProposal_clientRequestToken :: Lens.Lens' CreateProposal Prelude.Text
createProposal_clientRequestToken :: Lens' CreateProposal Text
createProposal_clientRequestToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateProposal' {Text
clientRequestToken :: Text
$sel:clientRequestToken:CreateProposal' :: CreateProposal -> Text
clientRequestToken} -> Text
clientRequestToken) (\s :: CreateProposal
s@CreateProposal' {} Text
a -> CreateProposal
s {$sel:clientRequestToken:CreateProposal' :: Text
clientRequestToken = Text
a} :: CreateProposal)
createProposal_networkId :: Lens.Lens' CreateProposal Prelude.Text
createProposal_networkId :: Lens' CreateProposal Text
createProposal_networkId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateProposal' {Text
networkId :: Text
$sel:networkId:CreateProposal' :: CreateProposal -> Text
networkId} -> Text
networkId) (\s :: CreateProposal
s@CreateProposal' {} Text
a -> CreateProposal
s {$sel:networkId:CreateProposal' :: Text
networkId = Text
a} :: CreateProposal)
createProposal_memberId :: Lens.Lens' CreateProposal Prelude.Text
createProposal_memberId :: Lens' CreateProposal Text
createProposal_memberId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateProposal' {Text
memberId :: Text
$sel:memberId:CreateProposal' :: CreateProposal -> Text
memberId} -> Text
memberId) (\s :: CreateProposal
s@CreateProposal' {} Text
a -> CreateProposal
s {$sel:memberId:CreateProposal' :: Text
memberId = Text
a} :: CreateProposal)
createProposal_actions :: Lens.Lens' CreateProposal ProposalActions
createProposal_actions :: Lens' CreateProposal ProposalActions
createProposal_actions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateProposal' {ProposalActions
actions :: ProposalActions
$sel:actions:CreateProposal' :: CreateProposal -> ProposalActions
actions} -> ProposalActions
actions) (\s :: CreateProposal
s@CreateProposal' {} ProposalActions
a -> CreateProposal
s {$sel:actions:CreateProposal' :: ProposalActions
actions = ProposalActions
a} :: CreateProposal)
instance Core.AWSRequest CreateProposal where
type
AWSResponse CreateProposal =
CreateProposalResponse
request :: (Service -> Service) -> CreateProposal -> Request CreateProposal
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy CreateProposal
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateProposal)))
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 -> Int -> CreateProposalResponse
CreateProposalResponse'
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
"ProposalId")
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 CreateProposal where
hashWithSalt :: Int -> CreateProposal -> Int
hashWithSalt Int
_salt CreateProposal' {Maybe Text
Maybe (HashMap Text Text)
Text
ProposalActions
actions :: ProposalActions
memberId :: Text
networkId :: Text
clientRequestToken :: Text
tags :: Maybe (HashMap Text Text)
description :: Maybe Text
$sel:actions:CreateProposal' :: CreateProposal -> ProposalActions
$sel:memberId:CreateProposal' :: CreateProposal -> Text
$sel:networkId:CreateProposal' :: CreateProposal -> Text
$sel:clientRequestToken:CreateProposal' :: CreateProposal -> Text
$sel:tags:CreateProposal' :: CreateProposal -> Maybe (HashMap Text Text)
$sel:description:CreateProposal' :: CreateProposal -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
tags
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
clientRequestToken
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
networkId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
memberId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ProposalActions
actions
instance Prelude.NFData CreateProposal where
rnf :: CreateProposal -> ()
rnf CreateProposal' {Maybe Text
Maybe (HashMap Text Text)
Text
ProposalActions
actions :: ProposalActions
memberId :: Text
networkId :: Text
clientRequestToken :: Text
tags :: Maybe (HashMap Text Text)
description :: Maybe Text
$sel:actions:CreateProposal' :: CreateProposal -> ProposalActions
$sel:memberId:CreateProposal' :: CreateProposal -> Text
$sel:networkId:CreateProposal' :: CreateProposal -> Text
$sel:clientRequestToken:CreateProposal' :: CreateProposal -> Text
$sel:tags:CreateProposal' :: CreateProposal -> Maybe (HashMap Text Text)
$sel:description:CreateProposal' :: CreateProposal -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
tags
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
clientRequestToken
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
memberId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ProposalActions
actions
instance Data.ToHeaders CreateProposal where
toHeaders :: CreateProposal -> 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.ToJSON CreateProposal where
toJSON :: CreateProposal -> Value
toJSON CreateProposal' {Maybe Text
Maybe (HashMap Text Text)
Text
ProposalActions
actions :: ProposalActions
memberId :: Text
networkId :: Text
clientRequestToken :: Text
tags :: Maybe (HashMap Text Text)
description :: Maybe Text
$sel:actions:CreateProposal' :: CreateProposal -> ProposalActions
$sel:memberId:CreateProposal' :: CreateProposal -> Text
$sel:networkId:CreateProposal' :: CreateProposal -> Text
$sel:clientRequestToken:CreateProposal' :: CreateProposal -> Text
$sel:tags:CreateProposal' :: CreateProposal -> Maybe (HashMap Text Text)
$sel:description:CreateProposal' :: CreateProposal -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"Description" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
description,
(Key
"Tags" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
tags,
forall a. a -> Maybe a
Prelude.Just
(Key
"ClientRequestToken" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
clientRequestToken),
forall a. a -> Maybe a
Prelude.Just (Key
"MemberId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
memberId),
forall a. a -> Maybe a
Prelude.Just (Key
"Actions" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= ProposalActions
actions)
]
)
instance Data.ToPath CreateProposal where
toPath :: CreateProposal -> ByteString
toPath CreateProposal' {Maybe Text
Maybe (HashMap Text Text)
Text
ProposalActions
actions :: ProposalActions
memberId :: Text
networkId :: Text
clientRequestToken :: Text
tags :: Maybe (HashMap Text Text)
description :: Maybe Text
$sel:actions:CreateProposal' :: CreateProposal -> ProposalActions
$sel:memberId:CreateProposal' :: CreateProposal -> Text
$sel:networkId:CreateProposal' :: CreateProposal -> Text
$sel:clientRequestToken:CreateProposal' :: CreateProposal -> Text
$sel:tags:CreateProposal' :: CreateProposal -> Maybe (HashMap Text Text)
$sel:description:CreateProposal' :: CreateProposal -> Maybe Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/networks/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
networkId, ByteString
"/proposals"]
instance Data.ToQuery CreateProposal where
toQuery :: CreateProposal -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data CreateProposalResponse = CreateProposalResponse'
{
CreateProposalResponse -> Maybe Text
proposalId :: Prelude.Maybe Prelude.Text,
CreateProposalResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateProposalResponse -> CreateProposalResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateProposalResponse -> CreateProposalResponse -> Bool
$c/= :: CreateProposalResponse -> CreateProposalResponse -> Bool
== :: CreateProposalResponse -> CreateProposalResponse -> Bool
$c== :: CreateProposalResponse -> CreateProposalResponse -> Bool
Prelude.Eq, ReadPrec [CreateProposalResponse]
ReadPrec CreateProposalResponse
Int -> ReadS CreateProposalResponse
ReadS [CreateProposalResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateProposalResponse]
$creadListPrec :: ReadPrec [CreateProposalResponse]
readPrec :: ReadPrec CreateProposalResponse
$creadPrec :: ReadPrec CreateProposalResponse
readList :: ReadS [CreateProposalResponse]
$creadList :: ReadS [CreateProposalResponse]
readsPrec :: Int -> ReadS CreateProposalResponse
$creadsPrec :: Int -> ReadS CreateProposalResponse
Prelude.Read, Int -> CreateProposalResponse -> ShowS
[CreateProposalResponse] -> ShowS
CreateProposalResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateProposalResponse] -> ShowS
$cshowList :: [CreateProposalResponse] -> ShowS
show :: CreateProposalResponse -> String
$cshow :: CreateProposalResponse -> String
showsPrec :: Int -> CreateProposalResponse -> ShowS
$cshowsPrec :: Int -> CreateProposalResponse -> ShowS
Prelude.Show, forall x. Rep CreateProposalResponse x -> CreateProposalResponse
forall x. CreateProposalResponse -> Rep CreateProposalResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateProposalResponse x -> CreateProposalResponse
$cfrom :: forall x. CreateProposalResponse -> Rep CreateProposalResponse x
Prelude.Generic)
newCreateProposalResponse ::
Prelude.Int ->
CreateProposalResponse
newCreateProposalResponse :: Int -> CreateProposalResponse
newCreateProposalResponse Int
pHttpStatus_ =
CreateProposalResponse'
{ $sel:proposalId:CreateProposalResponse' :: Maybe Text
proposalId =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateProposalResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createProposalResponse_proposalId :: Lens.Lens' CreateProposalResponse (Prelude.Maybe Prelude.Text)
createProposalResponse_proposalId :: Lens' CreateProposalResponse (Maybe Text)
createProposalResponse_proposalId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateProposalResponse' {Maybe Text
proposalId :: Maybe Text
$sel:proposalId:CreateProposalResponse' :: CreateProposalResponse -> Maybe Text
proposalId} -> Maybe Text
proposalId) (\s :: CreateProposalResponse
s@CreateProposalResponse' {} Maybe Text
a -> CreateProposalResponse
s {$sel:proposalId:CreateProposalResponse' :: Maybe Text
proposalId = Maybe Text
a} :: CreateProposalResponse)
createProposalResponse_httpStatus :: Lens.Lens' CreateProposalResponse Prelude.Int
createProposalResponse_httpStatus :: Lens' CreateProposalResponse Int
createProposalResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateProposalResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateProposalResponse' :: CreateProposalResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateProposalResponse
s@CreateProposalResponse' {} Int
a -> CreateProposalResponse
s {$sel:httpStatus:CreateProposalResponse' :: Int
httpStatus = Int
a} :: CreateProposalResponse)
instance Prelude.NFData CreateProposalResponse where
rnf :: CreateProposalResponse -> ()
rnf CreateProposalResponse' {Int
Maybe Text
httpStatus :: Int
proposalId :: Maybe Text
$sel:httpStatus:CreateProposalResponse' :: CreateProposalResponse -> Int
$sel:proposalId:CreateProposalResponse' :: CreateProposalResponse -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
proposalId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus