{-# 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.DAX.Types.Node
-- 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.DAX.Types.Node where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import Amazonka.DAX.Types.Endpoint
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | Represents an individual node within a DAX cluster.
--
-- /See:/ 'newNode' smart constructor.
data Node = Node'
  { -- | The Availability Zone (AZ) in which the node has been deployed.
    Node -> Maybe Text
availabilityZone :: Prelude.Maybe Prelude.Text,
    -- | The endpoint for the node, consisting of a DNS name and a port number.
    -- Client applications can connect directly to a node endpoint, if desired
    -- (as an alternative to allowing DAX client software to intelligently
    -- route requests and responses to nodes in the DAX cluster.
    Node -> Maybe Endpoint
endpoint :: Prelude.Maybe Endpoint,
    -- | The date and time (in UNIX epoch format) when the node was launched.
    Node -> Maybe POSIX
nodeCreateTime :: Prelude.Maybe Data.POSIX,
    -- | A system-generated identifier for the node.
    Node -> Maybe Text
nodeId :: Prelude.Maybe Prelude.Text,
    -- | The current status of the node. For example: @available@.
    Node -> Maybe Text
nodeStatus :: Prelude.Maybe Prelude.Text,
    -- | The status of the parameter group associated with this node. For
    -- example, @in-sync@.
    Node -> Maybe Text
parameterGroupStatus :: Prelude.Maybe Prelude.Text
  }
  deriving (Node -> Node -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Node -> Node -> Bool
$c/= :: Node -> Node -> Bool
== :: Node -> Node -> Bool
$c== :: Node -> Node -> Bool
Prelude.Eq, ReadPrec [Node]
ReadPrec Node
Int -> ReadS Node
ReadS [Node]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Node]
$creadListPrec :: ReadPrec [Node]
readPrec :: ReadPrec Node
$creadPrec :: ReadPrec Node
readList :: ReadS [Node]
$creadList :: ReadS [Node]
readsPrec :: Int -> ReadS Node
$creadsPrec :: Int -> ReadS Node
Prelude.Read, Int -> Node -> ShowS
[Node] -> ShowS
Node -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Node] -> ShowS
$cshowList :: [Node] -> ShowS
show :: Node -> String
$cshow :: Node -> String
showsPrec :: Int -> Node -> ShowS
$cshowsPrec :: Int -> Node -> ShowS
Prelude.Show, forall x. Rep Node x -> Node
forall x. Node -> Rep Node x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Node x -> Node
$cfrom :: forall x. Node -> Rep Node x
Prelude.Generic)

-- |
-- Create a value of 'Node' 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:
--
-- 'availabilityZone', 'node_availabilityZone' - The Availability Zone (AZ) in which the node has been deployed.
--
-- 'endpoint', 'node_endpoint' - The endpoint for the node, consisting of a DNS name and a port number.
-- Client applications can connect directly to a node endpoint, if desired
-- (as an alternative to allowing DAX client software to intelligently
-- route requests and responses to nodes in the DAX cluster.
--
-- 'nodeCreateTime', 'node_nodeCreateTime' - The date and time (in UNIX epoch format) when the node was launched.
--
-- 'nodeId', 'node_nodeId' - A system-generated identifier for the node.
--
-- 'nodeStatus', 'node_nodeStatus' - The current status of the node. For example: @available@.
--
-- 'parameterGroupStatus', 'node_parameterGroupStatus' - The status of the parameter group associated with this node. For
-- example, @in-sync@.
newNode ::
  Node
newNode :: Node
newNode =
  Node'
    { $sel:availabilityZone:Node' :: Maybe Text
availabilityZone = forall a. Maybe a
Prelude.Nothing,
      $sel:endpoint:Node' :: Maybe Endpoint
endpoint = forall a. Maybe a
Prelude.Nothing,
      $sel:nodeCreateTime:Node' :: Maybe POSIX
nodeCreateTime = forall a. Maybe a
Prelude.Nothing,
      $sel:nodeId:Node' :: Maybe Text
nodeId = forall a. Maybe a
Prelude.Nothing,
      $sel:nodeStatus:Node' :: Maybe Text
nodeStatus = forall a. Maybe a
Prelude.Nothing,
      $sel:parameterGroupStatus:Node' :: Maybe Text
parameterGroupStatus = forall a. Maybe a
Prelude.Nothing
    }

-- | The Availability Zone (AZ) in which the node has been deployed.
node_availabilityZone :: Lens.Lens' Node (Prelude.Maybe Prelude.Text)
node_availabilityZone :: Lens' Node (Maybe Text)
node_availabilityZone = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Node' {Maybe Text
availabilityZone :: Maybe Text
$sel:availabilityZone:Node' :: Node -> Maybe Text
availabilityZone} -> Maybe Text
availabilityZone) (\s :: Node
s@Node' {} Maybe Text
a -> Node
s {$sel:availabilityZone:Node' :: Maybe Text
availabilityZone = Maybe Text
a} :: Node)

-- | The endpoint for the node, consisting of a DNS name and a port number.
-- Client applications can connect directly to a node endpoint, if desired
-- (as an alternative to allowing DAX client software to intelligently
-- route requests and responses to nodes in the DAX cluster.
node_endpoint :: Lens.Lens' Node (Prelude.Maybe Endpoint)
node_endpoint :: Lens' Node (Maybe Endpoint)
node_endpoint = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Node' {Maybe Endpoint
endpoint :: Maybe Endpoint
$sel:endpoint:Node' :: Node -> Maybe Endpoint
endpoint} -> Maybe Endpoint
endpoint) (\s :: Node
s@Node' {} Maybe Endpoint
a -> Node
s {$sel:endpoint:Node' :: Maybe Endpoint
endpoint = Maybe Endpoint
a} :: Node)

-- | The date and time (in UNIX epoch format) when the node was launched.
node_nodeCreateTime :: Lens.Lens' Node (Prelude.Maybe Prelude.UTCTime)
node_nodeCreateTime :: Lens' Node (Maybe UTCTime)
node_nodeCreateTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Node' {Maybe POSIX
nodeCreateTime :: Maybe POSIX
$sel:nodeCreateTime:Node' :: Node -> Maybe POSIX
nodeCreateTime} -> Maybe POSIX
nodeCreateTime) (\s :: Node
s@Node' {} Maybe POSIX
a -> Node
s {$sel:nodeCreateTime:Node' :: Maybe POSIX
nodeCreateTime = Maybe POSIX
a} :: Node) 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 (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | A system-generated identifier for the node.
node_nodeId :: Lens.Lens' Node (Prelude.Maybe Prelude.Text)
node_nodeId :: Lens' Node (Maybe Text)
node_nodeId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Node' {Maybe Text
nodeId :: Maybe Text
$sel:nodeId:Node' :: Node -> Maybe Text
nodeId} -> Maybe Text
nodeId) (\s :: Node
s@Node' {} Maybe Text
a -> Node
s {$sel:nodeId:Node' :: Maybe Text
nodeId = Maybe Text
a} :: Node)

-- | The current status of the node. For example: @available@.
node_nodeStatus :: Lens.Lens' Node (Prelude.Maybe Prelude.Text)
node_nodeStatus :: Lens' Node (Maybe Text)
node_nodeStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Node' {Maybe Text
nodeStatus :: Maybe Text
$sel:nodeStatus:Node' :: Node -> Maybe Text
nodeStatus} -> Maybe Text
nodeStatus) (\s :: Node
s@Node' {} Maybe Text
a -> Node
s {$sel:nodeStatus:Node' :: Maybe Text
nodeStatus = Maybe Text
a} :: Node)

-- | The status of the parameter group associated with this node. For
-- example, @in-sync@.
node_parameterGroupStatus :: Lens.Lens' Node (Prelude.Maybe Prelude.Text)
node_parameterGroupStatus :: Lens' Node (Maybe Text)
node_parameterGroupStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Node' {Maybe Text
parameterGroupStatus :: Maybe Text
$sel:parameterGroupStatus:Node' :: Node -> Maybe Text
parameterGroupStatus} -> Maybe Text
parameterGroupStatus) (\s :: Node
s@Node' {} Maybe Text
a -> Node
s {$sel:parameterGroupStatus:Node' :: Maybe Text
parameterGroupStatus = Maybe Text
a} :: Node)

instance Data.FromJSON Node where
  parseJSON :: Value -> Parser Node
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Node"
      ( \Object
x ->
          Maybe Text
-> Maybe Endpoint
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Node
Node'
            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
"AvailabilityZone")
            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
"Endpoint")
            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
"NodeCreateTime")
            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
"NodeId")
            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
"NodeStatus")
            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
"ParameterGroupStatus")
      )

instance Prelude.Hashable Node where
  hashWithSalt :: Int -> Node -> Int
hashWithSalt Int
_salt Node' {Maybe Text
Maybe POSIX
Maybe Endpoint
parameterGroupStatus :: Maybe Text
nodeStatus :: Maybe Text
nodeId :: Maybe Text
nodeCreateTime :: Maybe POSIX
endpoint :: Maybe Endpoint
availabilityZone :: Maybe Text
$sel:parameterGroupStatus:Node' :: Node -> Maybe Text
$sel:nodeStatus:Node' :: Node -> Maybe Text
$sel:nodeId:Node' :: Node -> Maybe Text
$sel:nodeCreateTime:Node' :: Node -> Maybe POSIX
$sel:endpoint:Node' :: Node -> Maybe Endpoint
$sel:availabilityZone:Node' :: Node -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
availabilityZone
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Endpoint
endpoint
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
nodeCreateTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nodeId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nodeStatus
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
parameterGroupStatus

instance Prelude.NFData Node where
  rnf :: Node -> ()
rnf Node' {Maybe Text
Maybe POSIX
Maybe Endpoint
parameterGroupStatus :: Maybe Text
nodeStatus :: Maybe Text
nodeId :: Maybe Text
nodeCreateTime :: Maybe POSIX
endpoint :: Maybe Endpoint
availabilityZone :: Maybe Text
$sel:parameterGroupStatus:Node' :: Node -> Maybe Text
$sel:nodeStatus:Node' :: Node -> Maybe Text
$sel:nodeId:Node' :: Node -> Maybe Text
$sel:nodeCreateTime:Node' :: Node -> Maybe POSIX
$sel:endpoint:Node' :: Node -> Maybe Endpoint
$sel:availabilityZone:Node' :: Node -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
availabilityZone
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Endpoint
endpoint
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
nodeCreateTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nodeId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nodeStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
parameterGroupStatus