{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# 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.Types.NetworkEthereumAttributes
-- 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)
module Amazonka.ManagedBlockChain.Types.NetworkEthereumAttributes where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Attributes of Ethereum for a network.
--
-- /See:/ 'newNetworkEthereumAttributes' smart constructor.
data NetworkEthereumAttributes = NetworkEthereumAttributes'
  { -- | The Ethereum @CHAIN_ID@ associated with the Ethereum network. Chain IDs
    -- are as follows:
    --
    -- -   mainnet = @1@
    --
    -- -   rinkeby = @4@
    --
    -- -   ropsten = @3@
    NetworkEthereumAttributes -> Maybe Text
chainId :: Prelude.Maybe Prelude.Text
  }
  deriving (NetworkEthereumAttributes -> NetworkEthereumAttributes -> Bool
(NetworkEthereumAttributes -> NetworkEthereumAttributes -> Bool)
-> (NetworkEthereumAttributes -> NetworkEthereumAttributes -> Bool)
-> Eq NetworkEthereumAttributes
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NetworkEthereumAttributes -> NetworkEthereumAttributes -> Bool
$c/= :: NetworkEthereumAttributes -> NetworkEthereumAttributes -> Bool
== :: NetworkEthereumAttributes -> NetworkEthereumAttributes -> Bool
$c== :: NetworkEthereumAttributes -> NetworkEthereumAttributes -> Bool
Prelude.Eq, ReadPrec [NetworkEthereumAttributes]
ReadPrec NetworkEthereumAttributes
Int -> ReadS NetworkEthereumAttributes
ReadS [NetworkEthereumAttributes]
(Int -> ReadS NetworkEthereumAttributes)
-> ReadS [NetworkEthereumAttributes]
-> ReadPrec NetworkEthereumAttributes
-> ReadPrec [NetworkEthereumAttributes]
-> Read NetworkEthereumAttributes
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NetworkEthereumAttributes]
$creadListPrec :: ReadPrec [NetworkEthereumAttributes]
readPrec :: ReadPrec NetworkEthereumAttributes
$creadPrec :: ReadPrec NetworkEthereumAttributes
readList :: ReadS [NetworkEthereumAttributes]
$creadList :: ReadS [NetworkEthereumAttributes]
readsPrec :: Int -> ReadS NetworkEthereumAttributes
$creadsPrec :: Int -> ReadS NetworkEthereumAttributes
Prelude.Read, Int -> NetworkEthereumAttributes -> ShowS
[NetworkEthereumAttributes] -> ShowS
NetworkEthereumAttributes -> String
(Int -> NetworkEthereumAttributes -> ShowS)
-> (NetworkEthereumAttributes -> String)
-> ([NetworkEthereumAttributes] -> ShowS)
-> Show NetworkEthereumAttributes
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NetworkEthereumAttributes] -> ShowS
$cshowList :: [NetworkEthereumAttributes] -> ShowS
show :: NetworkEthereumAttributes -> String
$cshow :: NetworkEthereumAttributes -> String
showsPrec :: Int -> NetworkEthereumAttributes -> ShowS
$cshowsPrec :: Int -> NetworkEthereumAttributes -> ShowS
Prelude.Show, (forall x.
 NetworkEthereumAttributes -> Rep NetworkEthereumAttributes x)
-> (forall x.
    Rep NetworkEthereumAttributes x -> NetworkEthereumAttributes)
-> Generic NetworkEthereumAttributes
forall x.
Rep NetworkEthereumAttributes x -> NetworkEthereumAttributes
forall x.
NetworkEthereumAttributes -> Rep NetworkEthereumAttributes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep NetworkEthereumAttributes x -> NetworkEthereumAttributes
$cfrom :: forall x.
NetworkEthereumAttributes -> Rep NetworkEthereumAttributes x
Prelude.Generic)

-- |
-- Create a value of 'NetworkEthereumAttributes' 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:
--
-- 'chainId', 'networkEthereumAttributes_chainId' - The Ethereum @CHAIN_ID@ associated with the Ethereum network. Chain IDs
-- are as follows:
--
-- -   mainnet = @1@
--
-- -   rinkeby = @4@
--
-- -   ropsten = @3@
newNetworkEthereumAttributes ::
  NetworkEthereumAttributes
newNetworkEthereumAttributes :: NetworkEthereumAttributes
newNetworkEthereumAttributes =
  NetworkEthereumAttributes' :: Maybe Text -> NetworkEthereumAttributes
NetworkEthereumAttributes'
    { $sel:chainId:NetworkEthereumAttributes' :: Maybe Text
chainId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The Ethereum @CHAIN_ID@ associated with the Ethereum network. Chain IDs
-- are as follows:
--
-- -   mainnet = @1@
--
-- -   rinkeby = @4@
--
-- -   ropsten = @3@
networkEthereumAttributes_chainId :: Lens.Lens' NetworkEthereumAttributes (Prelude.Maybe Prelude.Text)
networkEthereumAttributes_chainId :: (Maybe Text -> f (Maybe Text))
-> NetworkEthereumAttributes -> f NetworkEthereumAttributes
networkEthereumAttributes_chainId = (NetworkEthereumAttributes -> Maybe Text)
-> (NetworkEthereumAttributes
    -> Maybe Text -> NetworkEthereumAttributes)
-> Lens
     NetworkEthereumAttributes
     NetworkEthereumAttributes
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NetworkEthereumAttributes' {Maybe Text
chainId :: Maybe Text
$sel:chainId:NetworkEthereumAttributes' :: NetworkEthereumAttributes -> Maybe Text
chainId} -> Maybe Text
chainId) (\s :: NetworkEthereumAttributes
s@NetworkEthereumAttributes' {} Maybe Text
a -> NetworkEthereumAttributes
s {$sel:chainId:NetworkEthereumAttributes' :: Maybe Text
chainId = Maybe Text
a} :: NetworkEthereumAttributes)

instance Core.FromJSON NetworkEthereumAttributes where
  parseJSON :: Value -> Parser NetworkEthereumAttributes
parseJSON =
    String
-> (Object -> Parser NetworkEthereumAttributes)
-> Value
-> Parser NetworkEthereumAttributes
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"NetworkEthereumAttributes"
      ( \Object
x ->
          Maybe Text -> NetworkEthereumAttributes
NetworkEthereumAttributes'
            (Maybe Text -> NetworkEthereumAttributes)
-> Parser (Maybe Text) -> Parser NetworkEthereumAttributes
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ChainId")
      )

instance Prelude.Hashable NetworkEthereumAttributes

instance Prelude.NFData NetworkEthereumAttributes