{-# 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.CreateNetwork
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Creates a new blockchain network using Amazon Managed Blockchain.
--
-- Applies only to Hyperledger Fabric.
module Amazonka.ManagedBlockChain.CreateNetwork
  ( -- * Creating a Request
    CreateNetwork (..),
    newCreateNetwork,

    -- * Request Lenses
    createNetwork_description,
    createNetwork_frameworkConfiguration,
    createNetwork_tags,
    createNetwork_clientRequestToken,
    createNetwork_name,
    createNetwork_framework,
    createNetwork_frameworkVersion,
    createNetwork_votingPolicy,
    createNetwork_memberConfiguration,

    -- * Destructuring the Response
    CreateNetworkResponse (..),
    newCreateNetworkResponse,

    -- * Response Lenses
    createNetworkResponse_memberId,
    createNetworkResponse_networkId,
    createNetworkResponse_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

-- | /See:/ 'newCreateNetwork' smart constructor.
data CreateNetwork = CreateNetwork'
  { -- | An optional description for the network.
    CreateNetwork -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | Configuration properties of the blockchain framework relevant to the
    -- network configuration.
    CreateNetwork -> Maybe NetworkFrameworkConfiguration
frameworkConfiguration :: Prelude.Maybe NetworkFrameworkConfiguration,
    -- | Tags to assign to the network. 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.
    --
    -- 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/.
    CreateNetwork -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | This is a unique, case-sensitive identifier that you provide to ensure
    -- the idempotency of the operation. An idempotent operation completes no
    -- more than once. This identifier is required only if you make a service
    -- request directly using an HTTP client. It is generated automatically if
    -- you use an Amazon Web Services SDK or the Amazon Web Services CLI.
    CreateNetwork -> Text
clientRequestToken :: Prelude.Text,
    -- | The name of the network.
    CreateNetwork -> Text
name :: Prelude.Text,
    -- | The blockchain framework that the network uses.
    CreateNetwork -> Framework
framework :: Framework,
    -- | The version of the blockchain framework that the network uses.
    CreateNetwork -> Text
frameworkVersion :: Prelude.Text,
    -- | The voting rules used by the network to determine if a proposal is
    -- approved.
    CreateNetwork -> VotingPolicy
votingPolicy :: VotingPolicy,
    -- | Configuration properties for the first member within the network.
    CreateNetwork -> MemberConfiguration
memberConfiguration :: MemberConfiguration
  }
  deriving (CreateNetwork -> CreateNetwork -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateNetwork -> CreateNetwork -> Bool
$c/= :: CreateNetwork -> CreateNetwork -> Bool
== :: CreateNetwork -> CreateNetwork -> Bool
$c== :: CreateNetwork -> CreateNetwork -> Bool
Prelude.Eq, Int -> CreateNetwork -> ShowS
[CreateNetwork] -> ShowS
CreateNetwork -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateNetwork] -> ShowS
$cshowList :: [CreateNetwork] -> ShowS
show :: CreateNetwork -> String
$cshow :: CreateNetwork -> String
showsPrec :: Int -> CreateNetwork -> ShowS
$cshowsPrec :: Int -> CreateNetwork -> ShowS
Prelude.Show, forall x. Rep CreateNetwork x -> CreateNetwork
forall x. CreateNetwork -> Rep CreateNetwork x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateNetwork x -> CreateNetwork
$cfrom :: forall x. CreateNetwork -> Rep CreateNetwork x
Prelude.Generic)

-- |
-- Create a value of 'CreateNetwork' 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', 'createNetwork_description' - An optional description for the network.
--
-- 'frameworkConfiguration', 'createNetwork_frameworkConfiguration' - Configuration properties of the blockchain framework relevant to the
-- network configuration.
--
-- 'tags', 'createNetwork_tags' - Tags to assign to the network. 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.
--
-- 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', 'createNetwork_clientRequestToken' - This is a unique, case-sensitive identifier that you provide to ensure
-- the idempotency of the operation. An idempotent operation completes no
-- more than once. This identifier is required only if you make a service
-- request directly using an HTTP client. It is generated automatically if
-- you use an Amazon Web Services SDK or the Amazon Web Services CLI.
--
-- 'name', 'createNetwork_name' - The name of the network.
--
-- 'framework', 'createNetwork_framework' - The blockchain framework that the network uses.
--
-- 'frameworkVersion', 'createNetwork_frameworkVersion' - The version of the blockchain framework that the network uses.
--
-- 'votingPolicy', 'createNetwork_votingPolicy' - The voting rules used by the network to determine if a proposal is
-- approved.
--
-- 'memberConfiguration', 'createNetwork_memberConfiguration' - Configuration properties for the first member within the network.
newCreateNetwork ::
  -- | 'clientRequestToken'
  Prelude.Text ->
  -- | 'name'
  Prelude.Text ->
  -- | 'framework'
  Framework ->
  -- | 'frameworkVersion'
  Prelude.Text ->
  -- | 'votingPolicy'
  VotingPolicy ->
  -- | 'memberConfiguration'
  MemberConfiguration ->
  CreateNetwork
newCreateNetwork :: Text
-> Text
-> Framework
-> Text
-> VotingPolicy
-> MemberConfiguration
-> CreateNetwork
newCreateNetwork
  Text
pClientRequestToken_
  Text
pName_
  Framework
pFramework_
  Text
pFrameworkVersion_
  VotingPolicy
pVotingPolicy_
  MemberConfiguration
pMemberConfiguration_ =
    CreateNetwork'
      { $sel:description:CreateNetwork' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
        $sel:frameworkConfiguration:CreateNetwork' :: Maybe NetworkFrameworkConfiguration
frameworkConfiguration = forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreateNetwork' :: Maybe (HashMap Text Text)
tags = forall a. Maybe a
Prelude.Nothing,
        $sel:clientRequestToken:CreateNetwork' :: Text
clientRequestToken = Text
pClientRequestToken_,
        $sel:name:CreateNetwork' :: Text
name = Text
pName_,
        $sel:framework:CreateNetwork' :: Framework
framework = Framework
pFramework_,
        $sel:frameworkVersion:CreateNetwork' :: Text
frameworkVersion = Text
pFrameworkVersion_,
        $sel:votingPolicy:CreateNetwork' :: VotingPolicy
votingPolicy = VotingPolicy
pVotingPolicy_,
        $sel:memberConfiguration:CreateNetwork' :: MemberConfiguration
memberConfiguration = MemberConfiguration
pMemberConfiguration_
      }

-- | An optional description for the network.
createNetwork_description :: Lens.Lens' CreateNetwork (Prelude.Maybe Prelude.Text)
createNetwork_description :: Lens' CreateNetwork (Maybe Text)
createNetwork_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateNetwork' {Maybe Text
description :: Maybe Text
$sel:description:CreateNetwork' :: CreateNetwork -> Maybe Text
description} -> Maybe Text
description) (\s :: CreateNetwork
s@CreateNetwork' {} Maybe Text
a -> CreateNetwork
s {$sel:description:CreateNetwork' :: Maybe Text
description = Maybe Text
a} :: CreateNetwork)

-- | Configuration properties of the blockchain framework relevant to the
-- network configuration.
createNetwork_frameworkConfiguration :: Lens.Lens' CreateNetwork (Prelude.Maybe NetworkFrameworkConfiguration)
createNetwork_frameworkConfiguration :: Lens' CreateNetwork (Maybe NetworkFrameworkConfiguration)
createNetwork_frameworkConfiguration = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateNetwork' {Maybe NetworkFrameworkConfiguration
frameworkConfiguration :: Maybe NetworkFrameworkConfiguration
$sel:frameworkConfiguration:CreateNetwork' :: CreateNetwork -> Maybe NetworkFrameworkConfiguration
frameworkConfiguration} -> Maybe NetworkFrameworkConfiguration
frameworkConfiguration) (\s :: CreateNetwork
s@CreateNetwork' {} Maybe NetworkFrameworkConfiguration
a -> CreateNetwork
s {$sel:frameworkConfiguration:CreateNetwork' :: Maybe NetworkFrameworkConfiguration
frameworkConfiguration = Maybe NetworkFrameworkConfiguration
a} :: CreateNetwork)

-- | Tags to assign to the network. 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.
--
-- 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/.
createNetwork_tags :: Lens.Lens' CreateNetwork (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createNetwork_tags :: Lens' CreateNetwork (Maybe (HashMap Text Text))
createNetwork_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateNetwork' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:CreateNetwork' :: CreateNetwork -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: CreateNetwork
s@CreateNetwork' {} Maybe (HashMap Text Text)
a -> CreateNetwork
s {$sel:tags:CreateNetwork' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: CreateNetwork) 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

-- | This is a unique, case-sensitive identifier that you provide to ensure
-- the idempotency of the operation. An idempotent operation completes no
-- more than once. This identifier is required only if you make a service
-- request directly using an HTTP client. It is generated automatically if
-- you use an Amazon Web Services SDK or the Amazon Web Services CLI.
createNetwork_clientRequestToken :: Lens.Lens' CreateNetwork Prelude.Text
createNetwork_clientRequestToken :: Lens' CreateNetwork Text
createNetwork_clientRequestToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateNetwork' {Text
clientRequestToken :: Text
$sel:clientRequestToken:CreateNetwork' :: CreateNetwork -> Text
clientRequestToken} -> Text
clientRequestToken) (\s :: CreateNetwork
s@CreateNetwork' {} Text
a -> CreateNetwork
s {$sel:clientRequestToken:CreateNetwork' :: Text
clientRequestToken = Text
a} :: CreateNetwork)

-- | The name of the network.
createNetwork_name :: Lens.Lens' CreateNetwork Prelude.Text
createNetwork_name :: Lens' CreateNetwork Text
createNetwork_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateNetwork' {Text
name :: Text
$sel:name:CreateNetwork' :: CreateNetwork -> Text
name} -> Text
name) (\s :: CreateNetwork
s@CreateNetwork' {} Text
a -> CreateNetwork
s {$sel:name:CreateNetwork' :: Text
name = Text
a} :: CreateNetwork)

-- | The blockchain framework that the network uses.
createNetwork_framework :: Lens.Lens' CreateNetwork Framework
createNetwork_framework :: Lens' CreateNetwork Framework
createNetwork_framework = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateNetwork' {Framework
framework :: Framework
$sel:framework:CreateNetwork' :: CreateNetwork -> Framework
framework} -> Framework
framework) (\s :: CreateNetwork
s@CreateNetwork' {} Framework
a -> CreateNetwork
s {$sel:framework:CreateNetwork' :: Framework
framework = Framework
a} :: CreateNetwork)

-- | The version of the blockchain framework that the network uses.
createNetwork_frameworkVersion :: Lens.Lens' CreateNetwork Prelude.Text
createNetwork_frameworkVersion :: Lens' CreateNetwork Text
createNetwork_frameworkVersion = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateNetwork' {Text
frameworkVersion :: Text
$sel:frameworkVersion:CreateNetwork' :: CreateNetwork -> Text
frameworkVersion} -> Text
frameworkVersion) (\s :: CreateNetwork
s@CreateNetwork' {} Text
a -> CreateNetwork
s {$sel:frameworkVersion:CreateNetwork' :: Text
frameworkVersion = Text
a} :: CreateNetwork)

-- | The voting rules used by the network to determine if a proposal is
-- approved.
createNetwork_votingPolicy :: Lens.Lens' CreateNetwork VotingPolicy
createNetwork_votingPolicy :: Lens' CreateNetwork VotingPolicy
createNetwork_votingPolicy = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateNetwork' {VotingPolicy
votingPolicy :: VotingPolicy
$sel:votingPolicy:CreateNetwork' :: CreateNetwork -> VotingPolicy
votingPolicy} -> VotingPolicy
votingPolicy) (\s :: CreateNetwork
s@CreateNetwork' {} VotingPolicy
a -> CreateNetwork
s {$sel:votingPolicy:CreateNetwork' :: VotingPolicy
votingPolicy = VotingPolicy
a} :: CreateNetwork)

-- | Configuration properties for the first member within the network.
createNetwork_memberConfiguration :: Lens.Lens' CreateNetwork MemberConfiguration
createNetwork_memberConfiguration :: Lens' CreateNetwork MemberConfiguration
createNetwork_memberConfiguration = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateNetwork' {MemberConfiguration
memberConfiguration :: MemberConfiguration
$sel:memberConfiguration:CreateNetwork' :: CreateNetwork -> MemberConfiguration
memberConfiguration} -> MemberConfiguration
memberConfiguration) (\s :: CreateNetwork
s@CreateNetwork' {} MemberConfiguration
a -> CreateNetwork
s {$sel:memberConfiguration:CreateNetwork' :: MemberConfiguration
memberConfiguration = MemberConfiguration
a} :: CreateNetwork)

instance Core.AWSRequest CreateNetwork where
  type
    AWSResponse CreateNetwork =
      CreateNetworkResponse
  request :: (Service -> Service) -> CreateNetwork -> Request CreateNetwork
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 CreateNetwork
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateNetwork)))
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 -> Maybe Text -> Int -> CreateNetworkResponse
CreateNetworkResponse'
            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
"MemberId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"NetworkId")
            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 CreateNetwork where
  hashWithSalt :: Int -> CreateNetwork -> Int
hashWithSalt Int
_salt CreateNetwork' {Maybe Text
Maybe (HashMap Text Text)
Maybe NetworkFrameworkConfiguration
Text
Framework
MemberConfiguration
VotingPolicy
memberConfiguration :: MemberConfiguration
votingPolicy :: VotingPolicy
frameworkVersion :: Text
framework :: Framework
name :: Text
clientRequestToken :: Text
tags :: Maybe (HashMap Text Text)
frameworkConfiguration :: Maybe NetworkFrameworkConfiguration
description :: Maybe Text
$sel:memberConfiguration:CreateNetwork' :: CreateNetwork -> MemberConfiguration
$sel:votingPolicy:CreateNetwork' :: CreateNetwork -> VotingPolicy
$sel:frameworkVersion:CreateNetwork' :: CreateNetwork -> Text
$sel:framework:CreateNetwork' :: CreateNetwork -> Framework
$sel:name:CreateNetwork' :: CreateNetwork -> Text
$sel:clientRequestToken:CreateNetwork' :: CreateNetwork -> Text
$sel:tags:CreateNetwork' :: CreateNetwork -> Maybe (HashMap Text Text)
$sel:frameworkConfiguration:CreateNetwork' :: CreateNetwork -> Maybe NetworkFrameworkConfiguration
$sel:description:CreateNetwork' :: CreateNetwork -> 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 NetworkFrameworkConfiguration
frameworkConfiguration
      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
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Framework
framework
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
frameworkVersion
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` VotingPolicy
votingPolicy
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` MemberConfiguration
memberConfiguration

instance Prelude.NFData CreateNetwork where
  rnf :: CreateNetwork -> ()
rnf CreateNetwork' {Maybe Text
Maybe (HashMap Text Text)
Maybe NetworkFrameworkConfiguration
Text
Framework
MemberConfiguration
VotingPolicy
memberConfiguration :: MemberConfiguration
votingPolicy :: VotingPolicy
frameworkVersion :: Text
framework :: Framework
name :: Text
clientRequestToken :: Text
tags :: Maybe (HashMap Text Text)
frameworkConfiguration :: Maybe NetworkFrameworkConfiguration
description :: Maybe Text
$sel:memberConfiguration:CreateNetwork' :: CreateNetwork -> MemberConfiguration
$sel:votingPolicy:CreateNetwork' :: CreateNetwork -> VotingPolicy
$sel:frameworkVersion:CreateNetwork' :: CreateNetwork -> Text
$sel:framework:CreateNetwork' :: CreateNetwork -> Framework
$sel:name:CreateNetwork' :: CreateNetwork -> Text
$sel:clientRequestToken:CreateNetwork' :: CreateNetwork -> Text
$sel:tags:CreateNetwork' :: CreateNetwork -> Maybe (HashMap Text Text)
$sel:frameworkConfiguration:CreateNetwork' :: CreateNetwork -> Maybe NetworkFrameworkConfiguration
$sel:description:CreateNetwork' :: CreateNetwork -> 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 NetworkFrameworkConfiguration
frameworkConfiguration
      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
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Framework
framework
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
frameworkVersion
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf VotingPolicy
votingPolicy
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf MemberConfiguration
memberConfiguration

instance Data.ToHeaders CreateNetwork where
  toHeaders :: CreateNetwork -> 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 CreateNetwork where
  toJSON :: CreateNetwork -> Value
toJSON CreateNetwork' {Maybe Text
Maybe (HashMap Text Text)
Maybe NetworkFrameworkConfiguration
Text
Framework
MemberConfiguration
VotingPolicy
memberConfiguration :: MemberConfiguration
votingPolicy :: VotingPolicy
frameworkVersion :: Text
framework :: Framework
name :: Text
clientRequestToken :: Text
tags :: Maybe (HashMap Text Text)
frameworkConfiguration :: Maybe NetworkFrameworkConfiguration
description :: Maybe Text
$sel:memberConfiguration:CreateNetwork' :: CreateNetwork -> MemberConfiguration
$sel:votingPolicy:CreateNetwork' :: CreateNetwork -> VotingPolicy
$sel:frameworkVersion:CreateNetwork' :: CreateNetwork -> Text
$sel:framework:CreateNetwork' :: CreateNetwork -> Framework
$sel:name:CreateNetwork' :: CreateNetwork -> Text
$sel:clientRequestToken:CreateNetwork' :: CreateNetwork -> Text
$sel:tags:CreateNetwork' :: CreateNetwork -> Maybe (HashMap Text Text)
$sel:frameworkConfiguration:CreateNetwork' :: CreateNetwork -> Maybe NetworkFrameworkConfiguration
$sel:description:CreateNetwork' :: CreateNetwork -> 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
"FrameworkConfiguration" 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 NetworkFrameworkConfiguration
frameworkConfiguration,
            (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
"Name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
name),
            forall a. a -> Maybe a
Prelude.Just (Key
"Framework" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Framework
framework),
            forall a. a -> Maybe a
Prelude.Just
              (Key
"FrameworkVersion" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
frameworkVersion),
            forall a. a -> Maybe a
Prelude.Just (Key
"VotingPolicy" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= VotingPolicy
votingPolicy),
            forall a. a -> Maybe a
Prelude.Just
              (Key
"MemberConfiguration" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= MemberConfiguration
memberConfiguration)
          ]
      )

instance Data.ToPath CreateNetwork where
  toPath :: CreateNetwork -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/networks"

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

-- | /See:/ 'newCreateNetworkResponse' smart constructor.
data CreateNetworkResponse = CreateNetworkResponse'
  { -- | The unique identifier for the first member within the network.
    CreateNetworkResponse -> Maybe Text
memberId :: Prelude.Maybe Prelude.Text,
    -- | The unique identifier for the network.
    CreateNetworkResponse -> Maybe Text
networkId :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    CreateNetworkResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateNetworkResponse -> CreateNetworkResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateNetworkResponse -> CreateNetworkResponse -> Bool
$c/= :: CreateNetworkResponse -> CreateNetworkResponse -> Bool
== :: CreateNetworkResponse -> CreateNetworkResponse -> Bool
$c== :: CreateNetworkResponse -> CreateNetworkResponse -> Bool
Prelude.Eq, ReadPrec [CreateNetworkResponse]
ReadPrec CreateNetworkResponse
Int -> ReadS CreateNetworkResponse
ReadS [CreateNetworkResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateNetworkResponse]
$creadListPrec :: ReadPrec [CreateNetworkResponse]
readPrec :: ReadPrec CreateNetworkResponse
$creadPrec :: ReadPrec CreateNetworkResponse
readList :: ReadS [CreateNetworkResponse]
$creadList :: ReadS [CreateNetworkResponse]
readsPrec :: Int -> ReadS CreateNetworkResponse
$creadsPrec :: Int -> ReadS CreateNetworkResponse
Prelude.Read, Int -> CreateNetworkResponse -> ShowS
[CreateNetworkResponse] -> ShowS
CreateNetworkResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateNetworkResponse] -> ShowS
$cshowList :: [CreateNetworkResponse] -> ShowS
show :: CreateNetworkResponse -> String
$cshow :: CreateNetworkResponse -> String
showsPrec :: Int -> CreateNetworkResponse -> ShowS
$cshowsPrec :: Int -> CreateNetworkResponse -> ShowS
Prelude.Show, forall x. Rep CreateNetworkResponse x -> CreateNetworkResponse
forall x. CreateNetworkResponse -> Rep CreateNetworkResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateNetworkResponse x -> CreateNetworkResponse
$cfrom :: forall x. CreateNetworkResponse -> Rep CreateNetworkResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateNetworkResponse' 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:
--
-- 'memberId', 'createNetworkResponse_memberId' - The unique identifier for the first member within the network.
--
-- 'networkId', 'createNetworkResponse_networkId' - The unique identifier for the network.
--
-- 'httpStatus', 'createNetworkResponse_httpStatus' - The response's http status code.
newCreateNetworkResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateNetworkResponse
newCreateNetworkResponse :: Int -> CreateNetworkResponse
newCreateNetworkResponse Int
pHttpStatus_ =
  CreateNetworkResponse'
    { $sel:memberId:CreateNetworkResponse' :: Maybe Text
memberId = forall a. Maybe a
Prelude.Nothing,
      $sel:networkId:CreateNetworkResponse' :: Maybe Text
networkId = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateNetworkResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The unique identifier for the first member within the network.
createNetworkResponse_memberId :: Lens.Lens' CreateNetworkResponse (Prelude.Maybe Prelude.Text)
createNetworkResponse_memberId :: Lens' CreateNetworkResponse (Maybe Text)
createNetworkResponse_memberId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateNetworkResponse' {Maybe Text
memberId :: Maybe Text
$sel:memberId:CreateNetworkResponse' :: CreateNetworkResponse -> Maybe Text
memberId} -> Maybe Text
memberId) (\s :: CreateNetworkResponse
s@CreateNetworkResponse' {} Maybe Text
a -> CreateNetworkResponse
s {$sel:memberId:CreateNetworkResponse' :: Maybe Text
memberId = Maybe Text
a} :: CreateNetworkResponse)

-- | The unique identifier for the network.
createNetworkResponse_networkId :: Lens.Lens' CreateNetworkResponse (Prelude.Maybe Prelude.Text)
createNetworkResponse_networkId :: Lens' CreateNetworkResponse (Maybe Text)
createNetworkResponse_networkId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateNetworkResponse' {Maybe Text
networkId :: Maybe Text
$sel:networkId:CreateNetworkResponse' :: CreateNetworkResponse -> Maybe Text
networkId} -> Maybe Text
networkId) (\s :: CreateNetworkResponse
s@CreateNetworkResponse' {} Maybe Text
a -> CreateNetworkResponse
s {$sel:networkId:CreateNetworkResponse' :: Maybe Text
networkId = Maybe Text
a} :: CreateNetworkResponse)

-- | The response's http status code.
createNetworkResponse_httpStatus :: Lens.Lens' CreateNetworkResponse Prelude.Int
createNetworkResponse_httpStatus :: Lens' CreateNetworkResponse Int
createNetworkResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateNetworkResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateNetworkResponse' :: CreateNetworkResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateNetworkResponse
s@CreateNetworkResponse' {} Int
a -> CreateNetworkResponse
s {$sel:httpStatus:CreateNetworkResponse' :: Int
httpStatus = Int
a} :: CreateNetworkResponse)

instance Prelude.NFData CreateNetworkResponse where
  rnf :: CreateNetworkResponse -> ()
rnf CreateNetworkResponse' {Int
Maybe Text
httpStatus :: Int
networkId :: Maybe Text
memberId :: Maybe Text
$sel:httpStatus:CreateNetworkResponse' :: CreateNetworkResponse -> Int
$sel:networkId:CreateNetworkResponse' :: CreateNetworkResponse -> Maybe Text
$sel:memberId:CreateNetworkResponse' :: CreateNetworkResponse -> 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 Maybe Text
networkId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus