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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(CustomerNodeEndpoint -> CustomerNodeEndpoint -> Bool)
-> (CustomerNodeEndpoint -> CustomerNodeEndpoint -> Bool)
-> Eq CustomerNodeEndpoint
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]
(Int -> ReadS CustomerNodeEndpoint)
-> ReadS [CustomerNodeEndpoint]
-> ReadPrec CustomerNodeEndpoint
-> ReadPrec [CustomerNodeEndpoint]
-> Read 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
(Int -> CustomerNodeEndpoint -> ShowS)
-> (CustomerNodeEndpoint -> String)
-> ([CustomerNodeEndpoint] -> ShowS)
-> Show CustomerNodeEndpoint
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. CustomerNodeEndpoint -> Rep CustomerNodeEndpoint x)
-> (forall x. Rep CustomerNodeEndpoint x -> CustomerNodeEndpoint)
-> Generic CustomerNodeEndpoint
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' :: Maybe Text -> Maybe Int -> CustomerNodeEndpoint
CustomerNodeEndpoint'
    { $sel:address:CustomerNodeEndpoint' :: Maybe Text
address = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:port:CustomerNodeEndpoint' :: Maybe Int
port = Maybe Int
forall a. Maybe a
Prelude.Nothing
    }

-- | The address of the node endpoint
customerNodeEndpoint_address :: Lens.Lens' CustomerNodeEndpoint (Prelude.Maybe Prelude.Text)
customerNodeEndpoint_address :: (Maybe Text -> f (Maybe Text))
-> CustomerNodeEndpoint -> f CustomerNodeEndpoint
customerNodeEndpoint_address = (CustomerNodeEndpoint -> Maybe Text)
-> (CustomerNodeEndpoint -> Maybe Text -> CustomerNodeEndpoint)
-> Lens
     CustomerNodeEndpoint CustomerNodeEndpoint (Maybe Text) (Maybe Text)
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 :: (Maybe Int -> f (Maybe Int))
-> CustomerNodeEndpoint -> f CustomerNodeEndpoint
customerNodeEndpoint_port = (CustomerNodeEndpoint -> Maybe Int)
-> (CustomerNodeEndpoint -> Maybe Int -> CustomerNodeEndpoint)
-> Lens
     CustomerNodeEndpoint CustomerNodeEndpoint (Maybe Int) (Maybe Int)
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

instance Prelude.NFData CustomerNodeEndpoint

instance Core.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
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"Address" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
address, ByteString
"Port" ByteString -> Maybe Int -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Int
port]