{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.ManagedBlockChain.CreateProposal
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Creates a proposal for a change to the network that other members of the
-- network can vote on, for example, a proposal to add a new member to the
-- network. Any member can create a proposal.
--
-- Applies only to Hyperledger Fabric.
module Amazonka.ManagedBlockChain.CreateProposal
  ( -- * Creating a Request
    CreateProposal (..),
    newCreateProposal,

    -- * Request Lenses
    createProposal_description,
    createProposal_tags,
    createProposal_clientRequestToken,
    createProposal_networkId,
    createProposal_memberId,
    createProposal_actions,

    -- * Destructuring the Response
    CreateProposalResponse (..),
    newCreateProposalResponse,

    -- * Response Lenses
    createProposalResponse_proposalId,
    createProposalResponse_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

-- | /See:/ 'newCreateProposal' smart constructor.
data CreateProposal = CreateProposal'
  { -- | A description for the proposal that is visible to voting members, for
    -- example, \"Proposal to add Example Corp. as member.\"
    CreateProposal -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | Tags to assign to the proposal. Each tag consists of a key and optional
    -- value.
    --
    -- When specifying tags during creation, you can specify multiple key-value
    -- pairs in a single request, with an overall maximum of 50 tags added to
    -- each resource. If the proposal is for a network invitation, the
    -- invitation inherits the tags added to the proposal.
    --
    -- For more information about tags, see
    -- <https://docs.aws.amazon.com/managed-blockchain/latest/ethereum-dev/tagging-resources.html Tagging Resources>
    -- in the /Amazon Managed Blockchain Ethereum Developer Guide/, or
    -- <https://docs.aws.amazon.com/managed-blockchain/latest/hyperledger-fabric-dev/tagging-resources.html Tagging Resources>
    -- in the /Amazon Managed Blockchain Hyperledger Fabric Developer Guide/.
    CreateProposal -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | A unique, case-sensitive identifier that you provide to ensure the
    -- idempotency of the operation. An idempotent operation completes no more
    -- than one time. This identifier is required only if you make a service
    -- request directly using an HTTP client. It is generated automatically if
    -- you use an AWS SDK or the AWS CLI.
    CreateProposal -> Text
clientRequestToken :: Prelude.Text,
    -- | The unique identifier of the network for which the proposal is made.
    CreateProposal -> Text
networkId :: Prelude.Text,
    -- | The unique identifier of the member that is creating the proposal. This
    -- identifier is especially useful for identifying the member making the
    -- proposal when multiple members exist in a single AWS account.
    CreateProposal -> Text
memberId :: Prelude.Text,
    -- | The type of actions proposed, such as inviting a member or removing a
    -- member. The types of @Actions@ in a proposal are mutually exclusive. For
    -- example, a proposal with @Invitations@ actions cannot also contain
    -- @Removals@ actions.
    CreateProposal -> ProposalActions
actions :: ProposalActions
  }
  deriving (CreateProposal -> CreateProposal -> Bool
(CreateProposal -> CreateProposal -> Bool)
-> (CreateProposal -> CreateProposal -> Bool) -> Eq CreateProposal
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]
(Int -> ReadS CreateProposal)
-> ReadS [CreateProposal]
-> ReadPrec CreateProposal
-> ReadPrec [CreateProposal]
-> Read 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
(Int -> CreateProposal -> ShowS)
-> (CreateProposal -> String)
-> ([CreateProposal] -> ShowS)
-> Show CreateProposal
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. CreateProposal -> Rep CreateProposal x)
-> (forall x. Rep CreateProposal x -> CreateProposal)
-> Generic CreateProposal
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)

-- |
-- Create a value of 'CreateProposal' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'description', 'createProposal_description' - A description for the proposal that is visible to voting members, for
-- example, \"Proposal to add Example Corp. as member.\"
--
-- 'tags', 'createProposal_tags' - Tags to assign to the proposal. Each tag consists of a key and optional
-- value.
--
-- When specifying tags during creation, you can specify multiple key-value
-- pairs in a single request, with an overall maximum of 50 tags added to
-- each resource. If the proposal is for a network invitation, the
-- invitation inherits the tags added to the proposal.
--
-- For more information about tags, see
-- <https://docs.aws.amazon.com/managed-blockchain/latest/ethereum-dev/tagging-resources.html Tagging Resources>
-- in the /Amazon Managed Blockchain Ethereum Developer Guide/, or
-- <https://docs.aws.amazon.com/managed-blockchain/latest/hyperledger-fabric-dev/tagging-resources.html Tagging Resources>
-- in the /Amazon Managed Blockchain Hyperledger Fabric Developer Guide/.
--
-- 'clientRequestToken', 'createProposal_clientRequestToken' - A unique, case-sensitive identifier that you provide to ensure the
-- idempotency of the operation. An idempotent operation completes no more
-- than one time. This identifier is required only if you make a service
-- request directly using an HTTP client. It is generated automatically if
-- you use an AWS SDK or the AWS CLI.
--
-- 'networkId', 'createProposal_networkId' - The unique identifier of the network for which the proposal is made.
--
-- 'memberId', 'createProposal_memberId' - The unique identifier of the member that is creating the proposal. This
-- identifier is especially useful for identifying the member making the
-- proposal when multiple members exist in a single AWS account.
--
-- 'actions', 'createProposal_actions' - The type of actions proposed, such as inviting a member or removing a
-- member. The types of @Actions@ in a proposal are mutually exclusive. For
-- example, a proposal with @Invitations@ actions cannot also contain
-- @Removals@ actions.
newCreateProposal ::
  -- | 'clientRequestToken'
  Prelude.Text ->
  -- | 'networkId'
  Prelude.Text ->
  -- | 'memberId'
  Prelude.Text ->
  -- | 'actions'
  ProposalActions ->
  CreateProposal
newCreateProposal :: Text -> Text -> Text -> ProposalActions -> CreateProposal
newCreateProposal
  Text
pClientRequestToken_
  Text
pNetworkId_
  Text
pMemberId_
  ProposalActions
pActions_ =
    CreateProposal' :: Maybe Text
-> Maybe (HashMap Text Text)
-> Text
-> Text
-> Text
-> ProposalActions
-> CreateProposal
CreateProposal'
      { $sel:description:CreateProposal' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreateProposal' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
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_
      }

-- | A description for the proposal that is visible to voting members, for
-- example, \"Proposal to add Example Corp. as member.\"
createProposal_description :: Lens.Lens' CreateProposal (Prelude.Maybe Prelude.Text)
createProposal_description :: (Maybe Text -> f (Maybe Text))
-> CreateProposal -> f CreateProposal
createProposal_description = (CreateProposal -> Maybe Text)
-> (CreateProposal -> Maybe Text -> CreateProposal)
-> Lens CreateProposal CreateProposal (Maybe Text) (Maybe Text)
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)

-- | Tags to assign to the proposal. Each tag consists of a key and optional
-- value.
--
-- When specifying tags during creation, you can specify multiple key-value
-- pairs in a single request, with an overall maximum of 50 tags added to
-- each resource. If the proposal is for a network invitation, the
-- invitation inherits the tags added to the proposal.
--
-- For more information about tags, see
-- <https://docs.aws.amazon.com/managed-blockchain/latest/ethereum-dev/tagging-resources.html Tagging Resources>
-- in the /Amazon Managed Blockchain Ethereum Developer Guide/, or
-- <https://docs.aws.amazon.com/managed-blockchain/latest/hyperledger-fabric-dev/tagging-resources.html Tagging Resources>
-- in the /Amazon Managed Blockchain Hyperledger Fabric Developer Guide/.
createProposal_tags :: Lens.Lens' CreateProposal (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createProposal_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateProposal -> f CreateProposal
createProposal_tags = (CreateProposal -> Maybe (HashMap Text Text))
-> (CreateProposal -> Maybe (HashMap Text Text) -> CreateProposal)
-> Lens
     CreateProposal
     CreateProposal
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
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) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> CreateProposal -> f CreateProposal)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateProposal
-> f CreateProposal
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
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 AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A unique, case-sensitive identifier that you provide to ensure the
-- idempotency of the operation. An idempotent operation completes no more
-- than one time. This identifier is required only if you make a service
-- request directly using an HTTP client. It is generated automatically if
-- you use an AWS SDK or the AWS CLI.
createProposal_clientRequestToken :: Lens.Lens' CreateProposal Prelude.Text
createProposal_clientRequestToken :: (Text -> f Text) -> CreateProposal -> f CreateProposal
createProposal_clientRequestToken = (CreateProposal -> Text)
-> (CreateProposal -> Text -> CreateProposal)
-> Lens CreateProposal CreateProposal Text Text
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)

-- | The unique identifier of the network for which the proposal is made.
createProposal_networkId :: Lens.Lens' CreateProposal Prelude.Text
createProposal_networkId :: (Text -> f Text) -> CreateProposal -> f CreateProposal
createProposal_networkId = (CreateProposal -> Text)
-> (CreateProposal -> Text -> CreateProposal)
-> Lens CreateProposal CreateProposal Text Text
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)

-- | The unique identifier of the member that is creating the proposal. This
-- identifier is especially useful for identifying the member making the
-- proposal when multiple members exist in a single AWS account.
createProposal_memberId :: Lens.Lens' CreateProposal Prelude.Text
createProposal_memberId :: (Text -> f Text) -> CreateProposal -> f CreateProposal
createProposal_memberId = (CreateProposal -> Text)
-> (CreateProposal -> Text -> CreateProposal)
-> Lens CreateProposal CreateProposal Text Text
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)

-- | The type of actions proposed, such as inviting a member or removing a
-- member. The types of @Actions@ in a proposal are mutually exclusive. For
-- example, a proposal with @Invitations@ actions cannot also contain
-- @Removals@ actions.
createProposal_actions :: Lens.Lens' CreateProposal ProposalActions
createProposal_actions :: (ProposalActions -> f ProposalActions)
-> CreateProposal -> f CreateProposal
createProposal_actions = (CreateProposal -> ProposalActions)
-> (CreateProposal -> ProposalActions -> CreateProposal)
-> Lens
     CreateProposal CreateProposal ProposalActions ProposalActions
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 :: CreateProposal -> Request CreateProposal
request = Service -> CreateProposal -> Request CreateProposal
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateProposal
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateProposal)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateProposal))
-> Logger
-> Service
-> Proxy CreateProposal
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateProposal)))
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 Text -> Int -> CreateProposalResponse
CreateProposalResponse'
            (Maybe Text -> Int -> CreateProposalResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CreateProposalResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ProposalId")
            Either String (Int -> CreateProposalResponse)
-> Either String Int -> Either String CreateProposalResponse
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 CreateProposal

instance Prelude.NFData CreateProposal

instance Core.ToHeaders CreateProposal where
  toHeaders :: CreateProposal -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateProposal -> 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.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
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"Description" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
description,
            (Text
"Tags" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
tags,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"ClientRequestToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
clientRequestToken),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"MemberId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
memberId),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Actions" Text -> ProposalActions -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ProposalActions
actions)
          ]
      )

instance Core.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
..} =
    [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"]

instance Core.ToQuery CreateProposal where
  toQuery :: CreateProposal -> QueryString
toQuery = QueryString -> CreateProposal -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newCreateProposalResponse' smart constructor.
data CreateProposalResponse = CreateProposalResponse'
  { -- | The unique identifier of the proposal.
    CreateProposalResponse -> Maybe Text
proposalId :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    CreateProposalResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateProposalResponse -> CreateProposalResponse -> Bool
(CreateProposalResponse -> CreateProposalResponse -> Bool)
-> (CreateProposalResponse -> CreateProposalResponse -> Bool)
-> Eq CreateProposalResponse
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]
(Int -> ReadS CreateProposalResponse)
-> ReadS [CreateProposalResponse]
-> ReadPrec CreateProposalResponse
-> ReadPrec [CreateProposalResponse]
-> Read 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
(Int -> CreateProposalResponse -> ShowS)
-> (CreateProposalResponse -> String)
-> ([CreateProposalResponse] -> ShowS)
-> Show CreateProposalResponse
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. CreateProposalResponse -> Rep CreateProposalResponse x)
-> (forall x.
    Rep CreateProposalResponse x -> CreateProposalResponse)
-> Generic CreateProposalResponse
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)

-- |
-- Create a value of 'CreateProposalResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'proposalId', 'createProposalResponse_proposalId' - The unique identifier of the proposal.
--
-- 'httpStatus', 'createProposalResponse_httpStatus' - The response's http status code.
newCreateProposalResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateProposalResponse
newCreateProposalResponse :: Int -> CreateProposalResponse
newCreateProposalResponse Int
pHttpStatus_ =
  CreateProposalResponse' :: Maybe Text -> Int -> CreateProposalResponse
CreateProposalResponse'
    { $sel:proposalId:CreateProposalResponse' :: Maybe Text
proposalId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateProposalResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The unique identifier of the proposal.
createProposalResponse_proposalId :: Lens.Lens' CreateProposalResponse (Prelude.Maybe Prelude.Text)
createProposalResponse_proposalId :: (Maybe Text -> f (Maybe Text))
-> CreateProposalResponse -> f CreateProposalResponse
createProposalResponse_proposalId = (CreateProposalResponse -> Maybe Text)
-> (CreateProposalResponse -> Maybe Text -> CreateProposalResponse)
-> Lens
     CreateProposalResponse
     CreateProposalResponse
     (Maybe Text)
     (Maybe Text)
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)

-- | The response's http status code.
createProposalResponse_httpStatus :: Lens.Lens' CreateProposalResponse Prelude.Int
createProposalResponse_httpStatus :: (Int -> f Int)
-> CreateProposalResponse -> f CreateProposalResponse
createProposalResponse_httpStatus = (CreateProposalResponse -> Int)
-> (CreateProposalResponse -> Int -> CreateProposalResponse)
-> Lens CreateProposalResponse CreateProposalResponse Int Int
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