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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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'
  { -- | The Amazon Web Services Region for a cluster endpoint.
    ClusterEndpoint -> Maybe Text
region :: Prelude.Maybe Prelude.Text,
    -- | 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 Cluster (Data Plane) Actions.
    ClusterEndpoint -> Maybe Text
endpoint :: Prelude.Maybe Prelude.Text
  }
  deriving (ClusterEndpoint -> ClusterEndpoint -> Bool
(ClusterEndpoint -> ClusterEndpoint -> Bool)
-> (ClusterEndpoint -> ClusterEndpoint -> Bool)
-> Eq ClusterEndpoint
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]
(Int -> ReadS ClusterEndpoint)
-> ReadS [ClusterEndpoint]
-> ReadPrec ClusterEndpoint
-> ReadPrec [ClusterEndpoint]
-> Read 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
(Int -> ClusterEndpoint -> ShowS)
-> (ClusterEndpoint -> String)
-> ([ClusterEndpoint] -> ShowS)
-> Show ClusterEndpoint
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. ClusterEndpoint -> Rep ClusterEndpoint x)
-> (forall x. Rep ClusterEndpoint x -> ClusterEndpoint)
-> Generic ClusterEndpoint
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:
--
-- 'region', 'clusterEndpoint_region' - The Amazon Web Services Region for a cluster endpoint.
--
-- '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 Cluster (Data Plane) Actions.
newClusterEndpoint ::
  ClusterEndpoint
newClusterEndpoint :: ClusterEndpoint
newClusterEndpoint =
  ClusterEndpoint' :: Maybe Text -> Maybe Text -> ClusterEndpoint
ClusterEndpoint'
    { $sel:region:ClusterEndpoint' :: Maybe Text
region = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:endpoint:ClusterEndpoint' :: Maybe Text
endpoint = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon Web Services Region for a cluster endpoint.
clusterEndpoint_region :: Lens.Lens' ClusterEndpoint (Prelude.Maybe Prelude.Text)
clusterEndpoint_region :: (Maybe Text -> f (Maybe Text))
-> ClusterEndpoint -> f ClusterEndpoint
clusterEndpoint_region = (ClusterEndpoint -> Maybe Text)
-> (ClusterEndpoint -> Maybe Text -> ClusterEndpoint)
-> Lens ClusterEndpoint ClusterEndpoint (Maybe Text) (Maybe Text)
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)

-- | 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 Cluster (Data Plane) Actions.
clusterEndpoint_endpoint :: Lens.Lens' ClusterEndpoint (Prelude.Maybe Prelude.Text)
clusterEndpoint_endpoint :: (Maybe Text -> f (Maybe Text))
-> ClusterEndpoint -> f ClusterEndpoint
clusterEndpoint_endpoint = (ClusterEndpoint -> Maybe Text)
-> (ClusterEndpoint -> Maybe Text -> ClusterEndpoint)
-> Lens ClusterEndpoint ClusterEndpoint (Maybe Text) (Maybe Text)
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)

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

instance Prelude.Hashable ClusterEndpoint

instance Prelude.NFData ClusterEndpoint