{-# 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.ElastiCache.Types.CustomerNodeEndpoint
-- 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.ElastiCache.Types.CustomerNodeEndpoint 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

-- | The endpoint from which data should be migrated.
--
-- /See:/ 'newCustomerNodeEndpoint' smart constructor.
data CustomerNodeEndpoint = CustomerNodeEndpoint'
  { -- | The address of the node endpoint
    CustomerNodeEndpoint -> Maybe Text
address :: Prelude.Maybe Prelude.Text,
    -- | The port of the node endpoint
    CustomerNodeEndpoint -> Maybe Int
port :: Prelude.Maybe Prelude.Int
  }
  deriving (CustomerNodeEndpoint -> CustomerNodeEndpoint -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CustomerNodeEndpoint -> CustomerNodeEndpoint -> Bool
$c/= :: CustomerNodeEndpoint -> CustomerNodeEndpoint -> Bool
== :: CustomerNodeEndpoint -> CustomerNodeEndpoint -> Bool
$c== :: CustomerNodeEndpoint -> CustomerNodeEndpoint -> Bool
Prelude.Eq, ReadPrec [CustomerNodeEndpoint]
ReadPrec CustomerNodeEndpoint
Int -> ReadS CustomerNodeEndpoint
ReadS [CustomerNodeEndpoint]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CustomerNodeEndpoint]
$creadListPrec :: ReadPrec [CustomerNodeEndpoint]
readPrec :: ReadPrec CustomerNodeEndpoint
$creadPrec :: ReadPrec CustomerNodeEndpoint
readList :: ReadS [CustomerNodeEndpoint]
$creadList :: ReadS [CustomerNodeEndpoint]
readsPrec :: Int -> ReadS CustomerNodeEndpoint
$creadsPrec :: Int -> ReadS CustomerNodeEndpoint
Prelude.Read, Int -> CustomerNodeEndpoint -> ShowS
[CustomerNodeEndpoint] -> ShowS
CustomerNodeEndpoint -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CustomerNodeEndpoint] -> ShowS
$cshowList :: [CustomerNodeEndpoint] -> ShowS
show :: CustomerNodeEndpoint -> String
$cshow :: CustomerNodeEndpoint -> String
showsPrec :: Int -> CustomerNodeEndpoint -> ShowS
$cshowsPrec :: Int -> CustomerNodeEndpoint -> ShowS
Prelude.Show, forall x. Rep CustomerNodeEndpoint x -> CustomerNodeEndpoint
forall x. CustomerNodeEndpoint -> Rep CustomerNodeEndpoint x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CustomerNodeEndpoint x -> CustomerNodeEndpoint
$cfrom :: forall x. CustomerNodeEndpoint -> Rep CustomerNodeEndpoint x
Prelude.Generic)

-- |
-- Create a value of 'CustomerNodeEndpoint' 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:
--
-- 'address', 'customerNodeEndpoint_address' - The address of the node endpoint
--
-- 'port', 'customerNodeEndpoint_port' - The port of the node endpoint
newCustomerNodeEndpoint ::
  CustomerNodeEndpoint
newCustomerNodeEndpoint :: CustomerNodeEndpoint
newCustomerNodeEndpoint =
  CustomerNodeEndpoint'
    { $sel:address:CustomerNodeEndpoint' :: Maybe Text
address = forall a. Maybe a
Prelude.Nothing,
      $sel:port:CustomerNodeEndpoint' :: Maybe Int
port = forall a. Maybe a
Prelude.Nothing
    }

-- | The address of the node endpoint
customerNodeEndpoint_address :: Lens.Lens' CustomerNodeEndpoint (Prelude.Maybe Prelude.Text)
customerNodeEndpoint_address :: Lens' CustomerNodeEndpoint (Maybe Text)
customerNodeEndpoint_address = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomerNodeEndpoint' {Maybe Text
address :: Maybe Text
$sel:address:CustomerNodeEndpoint' :: CustomerNodeEndpoint -> Maybe Text
address} -> Maybe Text
address) (\s :: CustomerNodeEndpoint
s@CustomerNodeEndpoint' {} Maybe Text
a -> CustomerNodeEndpoint
s {$sel:address:CustomerNodeEndpoint' :: Maybe Text
address = Maybe Text
a} :: CustomerNodeEndpoint)

-- | The port of the node endpoint
customerNodeEndpoint_port :: Lens.Lens' CustomerNodeEndpoint (Prelude.Maybe Prelude.Int)
customerNodeEndpoint_port :: Lens' CustomerNodeEndpoint (Maybe Int)
customerNodeEndpoint_port = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomerNodeEndpoint' {Maybe Int
port :: Maybe Int
$sel:port:CustomerNodeEndpoint' :: CustomerNodeEndpoint -> Maybe Int
port} -> Maybe Int
port) (\s :: CustomerNodeEndpoint
s@CustomerNodeEndpoint' {} Maybe Int
a -> CustomerNodeEndpoint
s {$sel:port:CustomerNodeEndpoint' :: Maybe Int
port = Maybe Int
a} :: CustomerNodeEndpoint)

instance Prelude.Hashable CustomerNodeEndpoint where
  hashWithSalt :: Int -> CustomerNodeEndpoint -> Int
hashWithSalt Int
_salt CustomerNodeEndpoint' {Maybe Int
Maybe Text
port :: Maybe Int
address :: Maybe Text
$sel:port:CustomerNodeEndpoint' :: CustomerNodeEndpoint -> Maybe Int
$sel:address:CustomerNodeEndpoint' :: CustomerNodeEndpoint -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
address
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
port

instance Prelude.NFData CustomerNodeEndpoint where
  rnf :: CustomerNodeEndpoint -> ()
rnf CustomerNodeEndpoint' {Maybe Int
Maybe Text
port :: Maybe Int
address :: Maybe Text
$sel:port:CustomerNodeEndpoint' :: CustomerNodeEndpoint -> Maybe Int
$sel:address:CustomerNodeEndpoint' :: CustomerNodeEndpoint -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
address seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
port

instance Data.ToQuery CustomerNodeEndpoint where
  toQuery :: CustomerNodeEndpoint -> QueryString
toQuery CustomerNodeEndpoint' {Maybe Int
Maybe Text
port :: Maybe Int
address :: Maybe Text
$sel:port:CustomerNodeEndpoint' :: CustomerNodeEndpoint -> Maybe Int
$sel:address:CustomerNodeEndpoint' :: CustomerNodeEndpoint -> Maybe Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"Address" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
address, ByteString
"Port" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Int
port]