{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.ManagedBlockChain.Types.NodeEthereumAttributes where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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 API
    -- 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 WebSocket connections from a client. Use this endpoint in
    -- client code for smart contracts when using a WebSocket 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
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]
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
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. 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 API
-- 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 WebSocket connections from a client. Use this endpoint in
-- client code for smart contracts when using a WebSocket 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'
    { $sel:httpEndpoint:NodeEthereumAttributes' :: Maybe Text
httpEndpoint =
        forall a. Maybe a
Prelude.Nothing,
      $sel:webSocketEndpoint:NodeEthereumAttributes' :: Maybe Text
webSocketEndpoint = forall a. Maybe a
Prelude.Nothing
    }

-- | The endpoint on which the Ethereum node listens to run Ethereum API
-- 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 :: Lens' NodeEthereumAttributes (Maybe Text)
nodeEthereumAttributes_httpEndpoint = 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 WebSocket connections from a client. Use this endpoint in
-- client code for smart contracts when using a WebSocket 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 :: Lens' NodeEthereumAttributes (Maybe Text)
nodeEthereumAttributes_webSocketEndpoint = 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 Data.FromJSON NodeEthereumAttributes where
  parseJSON :: Value -> Parser NodeEthereumAttributes
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"NodeEthereumAttributes"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> NodeEthereumAttributes
NodeEthereumAttributes'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"HttpEndpoint")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"WebSocketEndpoint")
      )

instance Prelude.Hashable NodeEthereumAttributes where
  hashWithSalt :: Int -> NodeEthereumAttributes -> Int
hashWithSalt Int
_salt NodeEthereumAttributes' {Maybe Text
webSocketEndpoint :: Maybe Text
httpEndpoint :: Maybe Text
$sel:webSocketEndpoint:NodeEthereumAttributes' :: NodeEthereumAttributes -> Maybe Text
$sel:httpEndpoint:NodeEthereumAttributes' :: NodeEthereumAttributes -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
httpEndpoint
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
webSocketEndpoint

instance Prelude.NFData NodeEthereumAttributes where
  rnf :: NodeEthereumAttributes -> ()
rnf NodeEthereumAttributes' {Maybe Text
webSocketEndpoint :: Maybe Text
httpEndpoint :: Maybe Text
$sel:webSocketEndpoint:NodeEthereumAttributes' :: NodeEthereumAttributes -> Maybe Text
$sel:httpEndpoint:NodeEthereumAttributes' :: NodeEthereumAttributes -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
httpEndpoint
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
webSocketEndpoint