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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.ManagedBlockChain.Types.NodeStatus
import qualified Amazonka.Prelude as Prelude

-- | A summary of configuration properties for a node.
--
-- /See:/ 'newNodeSummary' smart constructor.
data NodeSummary = NodeSummary'
  { -- | The status of the node.
    NodeSummary -> Maybe NodeStatus
status :: Prelude.Maybe NodeStatus,
    -- | The Amazon Resource Name (ARN) of the node. For more information about
    -- ARNs and their format, see
    -- <https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html Amazon Resource Names (ARNs)>
    -- in the /AWS General Reference/.
    NodeSummary -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The EC2 instance type for the node.
    NodeSummary -> Maybe Text
instanceType :: Prelude.Maybe Prelude.Text,
    -- | The Availability Zone in which the node exists.
    NodeSummary -> Maybe Text
availabilityZone :: Prelude.Maybe Prelude.Text,
    -- | The unique identifier of the node.
    NodeSummary -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
    -- | The date and time that the node was created.
    NodeSummary -> Maybe POSIX
creationDate :: Prelude.Maybe Core.POSIX
  }
  deriving (NodeSummary -> NodeSummary -> Bool
(NodeSummary -> NodeSummary -> Bool)
-> (NodeSummary -> NodeSummary -> Bool) -> Eq NodeSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NodeSummary -> NodeSummary -> Bool
$c/= :: NodeSummary -> NodeSummary -> Bool
== :: NodeSummary -> NodeSummary -> Bool
$c== :: NodeSummary -> NodeSummary -> Bool
Prelude.Eq, ReadPrec [NodeSummary]
ReadPrec NodeSummary
Int -> ReadS NodeSummary
ReadS [NodeSummary]
(Int -> ReadS NodeSummary)
-> ReadS [NodeSummary]
-> ReadPrec NodeSummary
-> ReadPrec [NodeSummary]
-> Read NodeSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NodeSummary]
$creadListPrec :: ReadPrec [NodeSummary]
readPrec :: ReadPrec NodeSummary
$creadPrec :: ReadPrec NodeSummary
readList :: ReadS [NodeSummary]
$creadList :: ReadS [NodeSummary]
readsPrec :: Int -> ReadS NodeSummary
$creadsPrec :: Int -> ReadS NodeSummary
Prelude.Read, Int -> NodeSummary -> ShowS
[NodeSummary] -> ShowS
NodeSummary -> String
(Int -> NodeSummary -> ShowS)
-> (NodeSummary -> String)
-> ([NodeSummary] -> ShowS)
-> Show NodeSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NodeSummary] -> ShowS
$cshowList :: [NodeSummary] -> ShowS
show :: NodeSummary -> String
$cshow :: NodeSummary -> String
showsPrec :: Int -> NodeSummary -> ShowS
$cshowsPrec :: Int -> NodeSummary -> ShowS
Prelude.Show, (forall x. NodeSummary -> Rep NodeSummary x)
-> (forall x. Rep NodeSummary x -> NodeSummary)
-> Generic NodeSummary
forall x. Rep NodeSummary x -> NodeSummary
forall x. NodeSummary -> Rep NodeSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep NodeSummary x -> NodeSummary
$cfrom :: forall x. NodeSummary -> Rep NodeSummary x
Prelude.Generic)

-- |
-- Create a value of 'NodeSummary' 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:
--
-- 'status', 'nodeSummary_status' - The status of the node.
--
-- 'arn', 'nodeSummary_arn' - The Amazon Resource Name (ARN) of the node. For more information about
-- ARNs and their format, see
-- <https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html Amazon Resource Names (ARNs)>
-- in the /AWS General Reference/.
--
-- 'instanceType', 'nodeSummary_instanceType' - The EC2 instance type for the node.
--
-- 'availabilityZone', 'nodeSummary_availabilityZone' - The Availability Zone in which the node exists.
--
-- 'id', 'nodeSummary_id' - The unique identifier of the node.
--
-- 'creationDate', 'nodeSummary_creationDate' - The date and time that the node was created.
newNodeSummary ::
  NodeSummary
newNodeSummary :: NodeSummary
newNodeSummary =
  NodeSummary' :: Maybe NodeStatus
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> NodeSummary
NodeSummary'
    { $sel:status:NodeSummary' :: Maybe NodeStatus
status = Maybe NodeStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:arn:NodeSummary' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:instanceType:NodeSummary' :: Maybe Text
instanceType = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:availabilityZone:NodeSummary' :: Maybe Text
availabilityZone = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:id:NodeSummary' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:creationDate:NodeSummary' :: Maybe POSIX
creationDate = Maybe POSIX
forall a. Maybe a
Prelude.Nothing
    }

-- | The status of the node.
nodeSummary_status :: Lens.Lens' NodeSummary (Prelude.Maybe NodeStatus)
nodeSummary_status :: (Maybe NodeStatus -> f (Maybe NodeStatus))
-> NodeSummary -> f NodeSummary
nodeSummary_status = (NodeSummary -> Maybe NodeStatus)
-> (NodeSummary -> Maybe NodeStatus -> NodeSummary)
-> Lens
     NodeSummary NodeSummary (Maybe NodeStatus) (Maybe NodeStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NodeSummary' {Maybe NodeStatus
status :: Maybe NodeStatus
$sel:status:NodeSummary' :: NodeSummary -> Maybe NodeStatus
status} -> Maybe NodeStatus
status) (\s :: NodeSummary
s@NodeSummary' {} Maybe NodeStatus
a -> NodeSummary
s {$sel:status:NodeSummary' :: Maybe NodeStatus
status = Maybe NodeStatus
a} :: NodeSummary)

-- | The Amazon Resource Name (ARN) of the node. For more information about
-- ARNs and their format, see
-- <https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html Amazon Resource Names (ARNs)>
-- in the /AWS General Reference/.
nodeSummary_arn :: Lens.Lens' NodeSummary (Prelude.Maybe Prelude.Text)
nodeSummary_arn :: (Maybe Text -> f (Maybe Text)) -> NodeSummary -> f NodeSummary
nodeSummary_arn = (NodeSummary -> Maybe Text)
-> (NodeSummary -> Maybe Text -> NodeSummary)
-> Lens NodeSummary NodeSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NodeSummary' {Maybe Text
arn :: Maybe Text
$sel:arn:NodeSummary' :: NodeSummary -> Maybe Text
arn} -> Maybe Text
arn) (\s :: NodeSummary
s@NodeSummary' {} Maybe Text
a -> NodeSummary
s {$sel:arn:NodeSummary' :: Maybe Text
arn = Maybe Text
a} :: NodeSummary)

-- | The EC2 instance type for the node.
nodeSummary_instanceType :: Lens.Lens' NodeSummary (Prelude.Maybe Prelude.Text)
nodeSummary_instanceType :: (Maybe Text -> f (Maybe Text)) -> NodeSummary -> f NodeSummary
nodeSummary_instanceType = (NodeSummary -> Maybe Text)
-> (NodeSummary -> Maybe Text -> NodeSummary)
-> Lens NodeSummary NodeSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NodeSummary' {Maybe Text
instanceType :: Maybe Text
$sel:instanceType:NodeSummary' :: NodeSummary -> Maybe Text
instanceType} -> Maybe Text
instanceType) (\s :: NodeSummary
s@NodeSummary' {} Maybe Text
a -> NodeSummary
s {$sel:instanceType:NodeSummary' :: Maybe Text
instanceType = Maybe Text
a} :: NodeSummary)

-- | The Availability Zone in which the node exists.
nodeSummary_availabilityZone :: Lens.Lens' NodeSummary (Prelude.Maybe Prelude.Text)
nodeSummary_availabilityZone :: (Maybe Text -> f (Maybe Text)) -> NodeSummary -> f NodeSummary
nodeSummary_availabilityZone = (NodeSummary -> Maybe Text)
-> (NodeSummary -> Maybe Text -> NodeSummary)
-> Lens NodeSummary NodeSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NodeSummary' {Maybe Text
availabilityZone :: Maybe Text
$sel:availabilityZone:NodeSummary' :: NodeSummary -> Maybe Text
availabilityZone} -> Maybe Text
availabilityZone) (\s :: NodeSummary
s@NodeSummary' {} Maybe Text
a -> NodeSummary
s {$sel:availabilityZone:NodeSummary' :: Maybe Text
availabilityZone = Maybe Text
a} :: NodeSummary)

-- | The unique identifier of the node.
nodeSummary_id :: Lens.Lens' NodeSummary (Prelude.Maybe Prelude.Text)
nodeSummary_id :: (Maybe Text -> f (Maybe Text)) -> NodeSummary -> f NodeSummary
nodeSummary_id = (NodeSummary -> Maybe Text)
-> (NodeSummary -> Maybe Text -> NodeSummary)
-> Lens NodeSummary NodeSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NodeSummary' {Maybe Text
id :: Maybe Text
$sel:id:NodeSummary' :: NodeSummary -> Maybe Text
id} -> Maybe Text
id) (\s :: NodeSummary
s@NodeSummary' {} Maybe Text
a -> NodeSummary
s {$sel:id:NodeSummary' :: Maybe Text
id = Maybe Text
a} :: NodeSummary)

-- | The date and time that the node was created.
nodeSummary_creationDate :: Lens.Lens' NodeSummary (Prelude.Maybe Prelude.UTCTime)
nodeSummary_creationDate :: (Maybe UTCTime -> f (Maybe UTCTime))
-> NodeSummary -> f NodeSummary
nodeSummary_creationDate = (NodeSummary -> Maybe POSIX)
-> (NodeSummary -> Maybe POSIX -> NodeSummary)
-> Lens NodeSummary NodeSummary (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NodeSummary' {Maybe POSIX
creationDate :: Maybe POSIX
$sel:creationDate:NodeSummary' :: NodeSummary -> Maybe POSIX
creationDate} -> Maybe POSIX
creationDate) (\s :: NodeSummary
s@NodeSummary' {} Maybe POSIX
a -> NodeSummary
s {$sel:creationDate:NodeSummary' :: Maybe POSIX
creationDate = Maybe POSIX
a} :: NodeSummary) ((Maybe POSIX -> f (Maybe POSIX)) -> NodeSummary -> f NodeSummary)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> NodeSummary
-> f NodeSummary
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

instance Core.FromJSON NodeSummary where
  parseJSON :: Value -> Parser NodeSummary
parseJSON =
    String
-> (Object -> Parser NodeSummary) -> Value -> Parser NodeSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"NodeSummary"
      ( \Object
x ->
          Maybe NodeStatus
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> NodeSummary
NodeSummary'
            (Maybe NodeStatus
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe POSIX
 -> NodeSummary)
-> Parser (Maybe NodeStatus)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe POSIX
      -> NodeSummary)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe NodeStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Status")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe POSIX
   -> NodeSummary)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text -> Maybe Text -> Maybe POSIX -> NodeSummary)
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
"Arn")
            Parser
  (Maybe Text
   -> Maybe Text -> Maybe Text -> Maybe POSIX -> NodeSummary)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> Maybe POSIX -> NodeSummary)
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
"InstanceType")
            Parser (Maybe Text -> Maybe Text -> Maybe POSIX -> NodeSummary)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe POSIX -> NodeSummary)
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
"AvailabilityZone")
            Parser (Maybe Text -> Maybe POSIX -> NodeSummary)
-> Parser (Maybe Text) -> Parser (Maybe POSIX -> NodeSummary)
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
"Id")
            Parser (Maybe POSIX -> NodeSummary)
-> Parser (Maybe POSIX) -> Parser NodeSummary
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CreationDate")
      )

instance Prelude.Hashable NodeSummary

instance Prelude.NFData NodeSummary