{-# 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.SecurityHub.Types.AwsRedshiftClusterClusterNode
-- 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.SecurityHub.Types.AwsRedshiftClusterClusterNode where

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

-- | A node in an Amazon Redshift cluster.
--
-- /See:/ 'newAwsRedshiftClusterClusterNode' smart constructor.
data AwsRedshiftClusterClusterNode = AwsRedshiftClusterClusterNode'
  { -- | The role of the node. A node might be a leader node or a compute node.
    AwsRedshiftClusterClusterNode -> Maybe Text
nodeRole :: Prelude.Maybe Prelude.Text,
    -- | The private IP address of the node.
    AwsRedshiftClusterClusterNode -> Maybe Text
privateIpAddress :: Prelude.Maybe Prelude.Text,
    -- | The public IP address of the node.
    AwsRedshiftClusterClusterNode -> Maybe Text
publicIpAddress :: Prelude.Maybe Prelude.Text
  }
  deriving (AwsRedshiftClusterClusterNode
-> AwsRedshiftClusterClusterNode -> Bool
(AwsRedshiftClusterClusterNode
 -> AwsRedshiftClusterClusterNode -> Bool)
-> (AwsRedshiftClusterClusterNode
    -> AwsRedshiftClusterClusterNode -> Bool)
-> Eq AwsRedshiftClusterClusterNode
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AwsRedshiftClusterClusterNode
-> AwsRedshiftClusterClusterNode -> Bool
$c/= :: AwsRedshiftClusterClusterNode
-> AwsRedshiftClusterClusterNode -> Bool
== :: AwsRedshiftClusterClusterNode
-> AwsRedshiftClusterClusterNode -> Bool
$c== :: AwsRedshiftClusterClusterNode
-> AwsRedshiftClusterClusterNode -> Bool
Prelude.Eq, ReadPrec [AwsRedshiftClusterClusterNode]
ReadPrec AwsRedshiftClusterClusterNode
Int -> ReadS AwsRedshiftClusterClusterNode
ReadS [AwsRedshiftClusterClusterNode]
(Int -> ReadS AwsRedshiftClusterClusterNode)
-> ReadS [AwsRedshiftClusterClusterNode]
-> ReadPrec AwsRedshiftClusterClusterNode
-> ReadPrec [AwsRedshiftClusterClusterNode]
-> Read AwsRedshiftClusterClusterNode
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AwsRedshiftClusterClusterNode]
$creadListPrec :: ReadPrec [AwsRedshiftClusterClusterNode]
readPrec :: ReadPrec AwsRedshiftClusterClusterNode
$creadPrec :: ReadPrec AwsRedshiftClusterClusterNode
readList :: ReadS [AwsRedshiftClusterClusterNode]
$creadList :: ReadS [AwsRedshiftClusterClusterNode]
readsPrec :: Int -> ReadS AwsRedshiftClusterClusterNode
$creadsPrec :: Int -> ReadS AwsRedshiftClusterClusterNode
Prelude.Read, Int -> AwsRedshiftClusterClusterNode -> ShowS
[AwsRedshiftClusterClusterNode] -> ShowS
AwsRedshiftClusterClusterNode -> String
(Int -> AwsRedshiftClusterClusterNode -> ShowS)
-> (AwsRedshiftClusterClusterNode -> String)
-> ([AwsRedshiftClusterClusterNode] -> ShowS)
-> Show AwsRedshiftClusterClusterNode
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AwsRedshiftClusterClusterNode] -> ShowS
$cshowList :: [AwsRedshiftClusterClusterNode] -> ShowS
show :: AwsRedshiftClusterClusterNode -> String
$cshow :: AwsRedshiftClusterClusterNode -> String
showsPrec :: Int -> AwsRedshiftClusterClusterNode -> ShowS
$cshowsPrec :: Int -> AwsRedshiftClusterClusterNode -> ShowS
Prelude.Show, (forall x.
 AwsRedshiftClusterClusterNode
 -> Rep AwsRedshiftClusterClusterNode x)
-> (forall x.
    Rep AwsRedshiftClusterClusterNode x
    -> AwsRedshiftClusterClusterNode)
-> Generic AwsRedshiftClusterClusterNode
forall x.
Rep AwsRedshiftClusterClusterNode x
-> AwsRedshiftClusterClusterNode
forall x.
AwsRedshiftClusterClusterNode
-> Rep AwsRedshiftClusterClusterNode x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AwsRedshiftClusterClusterNode x
-> AwsRedshiftClusterClusterNode
$cfrom :: forall x.
AwsRedshiftClusterClusterNode
-> Rep AwsRedshiftClusterClusterNode x
Prelude.Generic)

-- |
-- Create a value of 'AwsRedshiftClusterClusterNode' 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:
--
-- 'nodeRole', 'awsRedshiftClusterClusterNode_nodeRole' - The role of the node. A node might be a leader node or a compute node.
--
-- 'privateIpAddress', 'awsRedshiftClusterClusterNode_privateIpAddress' - The private IP address of the node.
--
-- 'publicIpAddress', 'awsRedshiftClusterClusterNode_publicIpAddress' - The public IP address of the node.
newAwsRedshiftClusterClusterNode ::
  AwsRedshiftClusterClusterNode
newAwsRedshiftClusterClusterNode :: AwsRedshiftClusterClusterNode
newAwsRedshiftClusterClusterNode =
  AwsRedshiftClusterClusterNode' :: Maybe Text
-> Maybe Text -> Maybe Text -> AwsRedshiftClusterClusterNode
AwsRedshiftClusterClusterNode'
    { $sel:nodeRole:AwsRedshiftClusterClusterNode' :: Maybe Text
nodeRole =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:privateIpAddress:AwsRedshiftClusterClusterNode' :: Maybe Text
privateIpAddress = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:publicIpAddress:AwsRedshiftClusterClusterNode' :: Maybe Text
publicIpAddress = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The role of the node. A node might be a leader node or a compute node.
awsRedshiftClusterClusterNode_nodeRole :: Lens.Lens' AwsRedshiftClusterClusterNode (Prelude.Maybe Prelude.Text)
awsRedshiftClusterClusterNode_nodeRole :: (Maybe Text -> f (Maybe Text))
-> AwsRedshiftClusterClusterNode -> f AwsRedshiftClusterClusterNode
awsRedshiftClusterClusterNode_nodeRole = (AwsRedshiftClusterClusterNode -> Maybe Text)
-> (AwsRedshiftClusterClusterNode
    -> Maybe Text -> AwsRedshiftClusterClusterNode)
-> Lens
     AwsRedshiftClusterClusterNode
     AwsRedshiftClusterClusterNode
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsRedshiftClusterClusterNode' {Maybe Text
nodeRole :: Maybe Text
$sel:nodeRole:AwsRedshiftClusterClusterNode' :: AwsRedshiftClusterClusterNode -> Maybe Text
nodeRole} -> Maybe Text
nodeRole) (\s :: AwsRedshiftClusterClusterNode
s@AwsRedshiftClusterClusterNode' {} Maybe Text
a -> AwsRedshiftClusterClusterNode
s {$sel:nodeRole:AwsRedshiftClusterClusterNode' :: Maybe Text
nodeRole = Maybe Text
a} :: AwsRedshiftClusterClusterNode)

-- | The private IP address of the node.
awsRedshiftClusterClusterNode_privateIpAddress :: Lens.Lens' AwsRedshiftClusterClusterNode (Prelude.Maybe Prelude.Text)
awsRedshiftClusterClusterNode_privateIpAddress :: (Maybe Text -> f (Maybe Text))
-> AwsRedshiftClusterClusterNode -> f AwsRedshiftClusterClusterNode
awsRedshiftClusterClusterNode_privateIpAddress = (AwsRedshiftClusterClusterNode -> Maybe Text)
-> (AwsRedshiftClusterClusterNode
    -> Maybe Text -> AwsRedshiftClusterClusterNode)
-> Lens
     AwsRedshiftClusterClusterNode
     AwsRedshiftClusterClusterNode
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsRedshiftClusterClusterNode' {Maybe Text
privateIpAddress :: Maybe Text
$sel:privateIpAddress:AwsRedshiftClusterClusterNode' :: AwsRedshiftClusterClusterNode -> Maybe Text
privateIpAddress} -> Maybe Text
privateIpAddress) (\s :: AwsRedshiftClusterClusterNode
s@AwsRedshiftClusterClusterNode' {} Maybe Text
a -> AwsRedshiftClusterClusterNode
s {$sel:privateIpAddress:AwsRedshiftClusterClusterNode' :: Maybe Text
privateIpAddress = Maybe Text
a} :: AwsRedshiftClusterClusterNode)

-- | The public IP address of the node.
awsRedshiftClusterClusterNode_publicIpAddress :: Lens.Lens' AwsRedshiftClusterClusterNode (Prelude.Maybe Prelude.Text)
awsRedshiftClusterClusterNode_publicIpAddress :: (Maybe Text -> f (Maybe Text))
-> AwsRedshiftClusterClusterNode -> f AwsRedshiftClusterClusterNode
awsRedshiftClusterClusterNode_publicIpAddress = (AwsRedshiftClusterClusterNode -> Maybe Text)
-> (AwsRedshiftClusterClusterNode
    -> Maybe Text -> AwsRedshiftClusterClusterNode)
-> Lens
     AwsRedshiftClusterClusterNode
     AwsRedshiftClusterClusterNode
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsRedshiftClusterClusterNode' {Maybe Text
publicIpAddress :: Maybe Text
$sel:publicIpAddress:AwsRedshiftClusterClusterNode' :: AwsRedshiftClusterClusterNode -> Maybe Text
publicIpAddress} -> Maybe Text
publicIpAddress) (\s :: AwsRedshiftClusterClusterNode
s@AwsRedshiftClusterClusterNode' {} Maybe Text
a -> AwsRedshiftClusterClusterNode
s {$sel:publicIpAddress:AwsRedshiftClusterClusterNode' :: Maybe Text
publicIpAddress = Maybe Text
a} :: AwsRedshiftClusterClusterNode)

instance Core.FromJSON AwsRedshiftClusterClusterNode where
  parseJSON :: Value -> Parser AwsRedshiftClusterClusterNode
parseJSON =
    String
-> (Object -> Parser AwsRedshiftClusterClusterNode)
-> Value
-> Parser AwsRedshiftClusterClusterNode
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AwsRedshiftClusterClusterNode"
      ( \Object
x ->
          Maybe Text
-> Maybe Text -> Maybe Text -> AwsRedshiftClusterClusterNode
AwsRedshiftClusterClusterNode'
            (Maybe Text
 -> Maybe Text -> Maybe Text -> AwsRedshiftClusterClusterNode)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> Maybe Text -> AwsRedshiftClusterClusterNode)
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
"NodeRole")
            Parser (Maybe Text -> Maybe Text -> AwsRedshiftClusterClusterNode)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> AwsRedshiftClusterClusterNode)
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
"PrivateIpAddress")
            Parser (Maybe Text -> AwsRedshiftClusterClusterNode)
-> Parser (Maybe Text) -> Parser AwsRedshiftClusterClusterNode
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
"PublicIpAddress")
      )

instance
  Prelude.Hashable
    AwsRedshiftClusterClusterNode

instance Prelude.NFData AwsRedshiftClusterClusterNode

instance Core.ToJSON AwsRedshiftClusterClusterNode where
  toJSON :: AwsRedshiftClusterClusterNode -> Value
toJSON AwsRedshiftClusterClusterNode' {Maybe Text
publicIpAddress :: Maybe Text
privateIpAddress :: Maybe Text
nodeRole :: Maybe Text
$sel:publicIpAddress:AwsRedshiftClusterClusterNode' :: AwsRedshiftClusterClusterNode -> Maybe Text
$sel:privateIpAddress:AwsRedshiftClusterClusterNode' :: AwsRedshiftClusterClusterNode -> Maybe Text
$sel:nodeRole:AwsRedshiftClusterClusterNode' :: AwsRedshiftClusterClusterNode -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"NodeRole" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nodeRole,
            (Text
"PrivateIpAddress" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
privateIpAddress,
            (Text
"PublicIpAddress" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
publicIpAddress
          ]
      )