{-# 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.Route53RecoveryControlConfig.Types.ClusterEndpoint
-- 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.Route53RecoveryControlConfig.Types.ClusterEndpoint 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

-- | A cluster endpoint. Specify an endpoint when you want to set or retrieve
-- a routing control state in the cluster.
--
-- /See:/ 'newClusterEndpoint' smart constructor.
data ClusterEndpoint = ClusterEndpoint'
  { -- | A cluster endpoint. Specify an endpoint and Amazon Web Services Region
    -- when you want to set or retrieve a routing control state in the cluster.
    --
    -- To get or update the routing control state, see the Amazon Route 53
    -- Application Recovery Controller Routing Control Actions.
    ClusterEndpoint -> Maybe Text
endpoint :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Web Services Region for a cluster endpoint.
    ClusterEndpoint -> Maybe Text
region :: Prelude.Maybe Prelude.Text
  }
  deriving (ClusterEndpoint -> ClusterEndpoint -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ClusterEndpoint -> ClusterEndpoint -> Bool
$c/= :: ClusterEndpoint -> ClusterEndpoint -> Bool
== :: ClusterEndpoint -> ClusterEndpoint -> Bool
$c== :: ClusterEndpoint -> ClusterEndpoint -> Bool
Prelude.Eq, ReadPrec [ClusterEndpoint]
ReadPrec ClusterEndpoint
Int -> ReadS ClusterEndpoint
ReadS [ClusterEndpoint]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ClusterEndpoint]
$creadListPrec :: ReadPrec [ClusterEndpoint]
readPrec :: ReadPrec ClusterEndpoint
$creadPrec :: ReadPrec ClusterEndpoint
readList :: ReadS [ClusterEndpoint]
$creadList :: ReadS [ClusterEndpoint]
readsPrec :: Int -> ReadS ClusterEndpoint
$creadsPrec :: Int -> ReadS ClusterEndpoint
Prelude.Read, Int -> ClusterEndpoint -> ShowS
[ClusterEndpoint] -> ShowS
ClusterEndpoint -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ClusterEndpoint] -> ShowS
$cshowList :: [ClusterEndpoint] -> ShowS
show :: ClusterEndpoint -> String
$cshow :: ClusterEndpoint -> String
showsPrec :: Int -> ClusterEndpoint -> ShowS
$cshowsPrec :: Int -> ClusterEndpoint -> ShowS
Prelude.Show, forall x. Rep ClusterEndpoint x -> ClusterEndpoint
forall x. ClusterEndpoint -> Rep ClusterEndpoint x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ClusterEndpoint x -> ClusterEndpoint
$cfrom :: forall x. ClusterEndpoint -> Rep ClusterEndpoint x
Prelude.Generic)

-- |
-- Create a value of 'ClusterEndpoint' 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:
--
-- 'endpoint', 'clusterEndpoint_endpoint' - A cluster endpoint. Specify an endpoint and Amazon Web Services Region
-- when you want to set or retrieve a routing control state in the cluster.
--
-- To get or update the routing control state, see the Amazon Route 53
-- Application Recovery Controller Routing Control Actions.
--
-- 'region', 'clusterEndpoint_region' - The Amazon Web Services Region for a cluster endpoint.
newClusterEndpoint ::
  ClusterEndpoint
newClusterEndpoint :: ClusterEndpoint
newClusterEndpoint =
  ClusterEndpoint'
    { $sel:endpoint:ClusterEndpoint' :: Maybe Text
endpoint = forall a. Maybe a
Prelude.Nothing,
      $sel:region:ClusterEndpoint' :: Maybe Text
region = forall a. Maybe a
Prelude.Nothing
    }

-- | A cluster endpoint. Specify an endpoint and Amazon Web Services Region
-- when you want to set or retrieve a routing control state in the cluster.
--
-- To get or update the routing control state, see the Amazon Route 53
-- Application Recovery Controller Routing Control Actions.
clusterEndpoint_endpoint :: Lens.Lens' ClusterEndpoint (Prelude.Maybe Prelude.Text)
clusterEndpoint_endpoint :: Lens' ClusterEndpoint (Maybe Text)
clusterEndpoint_endpoint = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ClusterEndpoint' {Maybe Text
endpoint :: Maybe Text
$sel:endpoint:ClusterEndpoint' :: ClusterEndpoint -> Maybe Text
endpoint} -> Maybe Text
endpoint) (\s :: ClusterEndpoint
s@ClusterEndpoint' {} Maybe Text
a -> ClusterEndpoint
s {$sel:endpoint:ClusterEndpoint' :: Maybe Text
endpoint = Maybe Text
a} :: ClusterEndpoint)

-- | The Amazon Web Services Region for a cluster endpoint.
clusterEndpoint_region :: Lens.Lens' ClusterEndpoint (Prelude.Maybe Prelude.Text)
clusterEndpoint_region :: Lens' ClusterEndpoint (Maybe Text)
clusterEndpoint_region = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ClusterEndpoint' {Maybe Text
region :: Maybe Text
$sel:region:ClusterEndpoint' :: ClusterEndpoint -> Maybe Text
region} -> Maybe Text
region) (\s :: ClusterEndpoint
s@ClusterEndpoint' {} Maybe Text
a -> ClusterEndpoint
s {$sel:region:ClusterEndpoint' :: Maybe Text
region = Maybe Text
a} :: ClusterEndpoint)

instance Data.FromJSON ClusterEndpoint where
  parseJSON :: Value -> Parser ClusterEndpoint
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ClusterEndpoint"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> ClusterEndpoint
ClusterEndpoint'
            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
"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
"Region")
      )

instance Prelude.Hashable ClusterEndpoint where
  hashWithSalt :: Int -> ClusterEndpoint -> Int
hashWithSalt Int
_salt ClusterEndpoint' {Maybe Text
region :: Maybe Text
endpoint :: Maybe Text
$sel:region:ClusterEndpoint' :: ClusterEndpoint -> Maybe Text
$sel:endpoint:ClusterEndpoint' :: ClusterEndpoint -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
endpoint
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
region

instance Prelude.NFData ClusterEndpoint where
  rnf :: ClusterEndpoint -> ()
rnf ClusterEndpoint' {Maybe Text
region :: Maybe Text
endpoint :: Maybe Text
$sel:region:ClusterEndpoint' :: ClusterEndpoint -> Maybe Text
$sel:endpoint:ClusterEndpoint' :: ClusterEndpoint -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
endpoint
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
region