{-# 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.NodeEthereumAttributes
-- 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.NodeEthereumAttributes where

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

-- | Attributes of an Ethereum node.
--
-- /See:/ 'newNodeEthereumAttributes' smart constructor.
data NodeEthereumAttributes = NodeEthereumAttributes'
  { -- | The endpoint on which the Ethereum node listens to run Ethereum JSON-RPC
    -- methods over HTTP connections from a client. Use this endpoint in client
    -- code for smart contracts when using an HTTP connection. Connections to
    -- this endpoint are authenticated using
    -- <https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html Signature Version 4>.
    NodeEthereumAttributes -> Maybe Text
httpEndpoint :: Prelude.Maybe Prelude.Text,
    -- | The endpoint on which the Ethereum node listens to run Ethereum JSON-RPC
    -- methods over WebSockets connections from a client. Use this endpoint in
    -- client code for smart contracts when using a WebSockets connection.
    -- Connections to this endpoint are authenticated using
    -- <https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html Signature Version 4>.
    NodeEthereumAttributes -> Maybe Text
webSocketEndpoint :: Prelude.Maybe Prelude.Text
  }
  deriving (NodeEthereumAttributes -> NodeEthereumAttributes -> Bool
(NodeEthereumAttributes -> NodeEthereumAttributes -> Bool)
-> (NodeEthereumAttributes -> NodeEthereumAttributes -> Bool)
-> Eq NodeEthereumAttributes
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NodeEthereumAttributes -> NodeEthereumAttributes -> Bool
$c/= :: NodeEthereumAttributes -> NodeEthereumAttributes -> Bool
== :: NodeEthereumAttributes -> NodeEthereumAttributes -> Bool
$c== :: NodeEthereumAttributes -> NodeEthereumAttributes -> Bool
Prelude.Eq, ReadPrec [NodeEthereumAttributes]
ReadPrec NodeEthereumAttributes
Int -> ReadS NodeEthereumAttributes
ReadS [NodeEthereumAttributes]
(Int -> ReadS NodeEthereumAttributes)
-> ReadS [NodeEthereumAttributes]
-> ReadPrec NodeEthereumAttributes
-> ReadPrec [NodeEthereumAttributes]
-> Read NodeEthereumAttributes
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NodeEthereumAttributes]
$creadListPrec :: ReadPrec [NodeEthereumAttributes]
readPrec :: ReadPrec NodeEthereumAttributes
$creadPrec :: ReadPrec NodeEthereumAttributes
readList :: ReadS [NodeEthereumAttributes]
$creadList :: ReadS [NodeEthereumAttributes]
readsPrec :: Int -> ReadS NodeEthereumAttributes
$creadsPrec :: Int -> ReadS NodeEthereumAttributes
Prelude.Read, Int -> NodeEthereumAttributes -> ShowS
[NodeEthereumAttributes] -> ShowS
NodeEthereumAttributes -> String
(Int -> NodeEthereumAttributes -> ShowS)
-> (NodeEthereumAttributes -> String)
-> ([NodeEthereumAttributes] -> ShowS)
-> Show NodeEthereumAttributes
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NodeEthereumAttributes] -> ShowS
$cshowList :: [NodeEthereumAttributes] -> ShowS
show :: NodeEthereumAttributes -> String
$cshow :: NodeEthereumAttributes -> String
showsPrec :: Int -> NodeEthereumAttributes -> ShowS
$cshowsPrec :: Int -> NodeEthereumAttributes -> ShowS
Prelude.Show, (forall x. NodeEthereumAttributes -> Rep NodeEthereumAttributes x)
-> (forall x.
    Rep NodeEthereumAttributes x -> NodeEthereumAttributes)
-> Generic NodeEthereumAttributes
forall x. Rep NodeEthereumAttributes x -> NodeEthereumAttributes
forall x. NodeEthereumAttributes -> Rep NodeEthereumAttributes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep NodeEthereumAttributes x -> NodeEthereumAttributes
$cfrom :: forall x. NodeEthereumAttributes -> Rep NodeEthereumAttributes x
Prelude.Generic)

-- |
-- Create a value of 'NodeEthereumAttributes' 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:
--
-- 'httpEndpoint', 'nodeEthereumAttributes_httpEndpoint' - The endpoint on which the Ethereum node listens to run Ethereum JSON-RPC
-- methods over HTTP connections from a client. Use this endpoint in client
-- code for smart contracts when using an HTTP connection. Connections to
-- this endpoint are authenticated using
-- <https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html Signature Version 4>.
--
-- 'webSocketEndpoint', 'nodeEthereumAttributes_webSocketEndpoint' - The endpoint on which the Ethereum node listens to run Ethereum JSON-RPC
-- methods over WebSockets connections from a client. Use this endpoint in
-- client code for smart contracts when using a WebSockets connection.
-- Connections to this endpoint are authenticated using
-- <https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html Signature Version 4>.
newNodeEthereumAttributes ::
  NodeEthereumAttributes
newNodeEthereumAttributes :: NodeEthereumAttributes
newNodeEthereumAttributes =
  NodeEthereumAttributes' :: Maybe Text -> Maybe Text -> NodeEthereumAttributes
NodeEthereumAttributes'
    { $sel:httpEndpoint:NodeEthereumAttributes' :: Maybe Text
httpEndpoint =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:webSocketEndpoint:NodeEthereumAttributes' :: Maybe Text
webSocketEndpoint = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The endpoint on which the Ethereum node listens to run Ethereum JSON-RPC
-- methods over HTTP connections from a client. Use this endpoint in client
-- code for smart contracts when using an HTTP connection. Connections to
-- this endpoint are authenticated using
-- <https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html Signature Version 4>.
nodeEthereumAttributes_httpEndpoint :: Lens.Lens' NodeEthereumAttributes (Prelude.Maybe Prelude.Text)
nodeEthereumAttributes_httpEndpoint :: (Maybe Text -> f (Maybe Text))
-> NodeEthereumAttributes -> f NodeEthereumAttributes
nodeEthereumAttributes_httpEndpoint = (NodeEthereumAttributes -> Maybe Text)
-> (NodeEthereumAttributes -> Maybe Text -> NodeEthereumAttributes)
-> Lens
     NodeEthereumAttributes
     NodeEthereumAttributes
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NodeEthereumAttributes' {Maybe Text
httpEndpoint :: Maybe Text
$sel:httpEndpoint:NodeEthereumAttributes' :: NodeEthereumAttributes -> Maybe Text
httpEndpoint} -> Maybe Text
httpEndpoint) (\s :: NodeEthereumAttributes
s@NodeEthereumAttributes' {} Maybe Text
a -> NodeEthereumAttributes
s {$sel:httpEndpoint:NodeEthereumAttributes' :: Maybe Text
httpEndpoint = Maybe Text
a} :: NodeEthereumAttributes)

-- | The endpoint on which the Ethereum node listens to run Ethereum JSON-RPC
-- methods over WebSockets connections from a client. Use this endpoint in
-- client code for smart contracts when using a WebSockets connection.
-- Connections to this endpoint are authenticated using
-- <https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html Signature Version 4>.
nodeEthereumAttributes_webSocketEndpoint :: Lens.Lens' NodeEthereumAttributes (Prelude.Maybe Prelude.Text)
nodeEthereumAttributes_webSocketEndpoint :: (Maybe Text -> f (Maybe Text))
-> NodeEthereumAttributes -> f NodeEthereumAttributes
nodeEthereumAttributes_webSocketEndpoint = (NodeEthereumAttributes -> Maybe Text)
-> (NodeEthereumAttributes -> Maybe Text -> NodeEthereumAttributes)
-> Lens
     NodeEthereumAttributes
     NodeEthereumAttributes
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NodeEthereumAttributes' {Maybe Text
webSocketEndpoint :: Maybe Text
$sel:webSocketEndpoint:NodeEthereumAttributes' :: NodeEthereumAttributes -> Maybe Text
webSocketEndpoint} -> Maybe Text
webSocketEndpoint) (\s :: NodeEthereumAttributes
s@NodeEthereumAttributes' {} Maybe Text
a -> NodeEthereumAttributes
s {$sel:webSocketEndpoint:NodeEthereumAttributes' :: Maybe Text
webSocketEndpoint = Maybe Text
a} :: NodeEthereumAttributes)

instance Core.FromJSON NodeEthereumAttributes where
  parseJSON :: Value -> Parser NodeEthereumAttributes
parseJSON =
    String
-> (Object -> Parser NodeEthereumAttributes)
-> Value
-> Parser NodeEthereumAttributes
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"NodeEthereumAttributes"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> NodeEthereumAttributes
NodeEthereumAttributes'
            (Maybe Text -> Maybe Text -> NodeEthereumAttributes)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> NodeEthereumAttributes)
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
"HttpEndpoint")
            Parser (Maybe Text -> NodeEthereumAttributes)
-> Parser (Maybe Text) -> Parser NodeEthereumAttributes
forall (f :: * -> *) a b. Applicative f => 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
"WebSocketEndpoint")
      )

instance Prelude.Hashable NodeEthereumAttributes

instance Prelude.NFData NodeEthereumAttributes