{-# 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.GroundStation.Types.DataflowEndpointConfig
-- 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.GroundStation.Types.DataflowEndpointConfig where

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

-- | Information about the dataflow endpoint @Config@.
--
-- /See:/ 'newDataflowEndpointConfig' smart constructor.
data DataflowEndpointConfig = DataflowEndpointConfig'
  { -- | Region of a dataflow endpoint.
    DataflowEndpointConfig -> Maybe Text
dataflowEndpointRegion :: Prelude.Maybe Prelude.Text,
    -- | Name of a dataflow endpoint.
    DataflowEndpointConfig -> Text
dataflowEndpointName :: Prelude.Text
  }
  deriving (DataflowEndpointConfig -> DataflowEndpointConfig -> Bool
(DataflowEndpointConfig -> DataflowEndpointConfig -> Bool)
-> (DataflowEndpointConfig -> DataflowEndpointConfig -> Bool)
-> Eq DataflowEndpointConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DataflowEndpointConfig -> DataflowEndpointConfig -> Bool
$c/= :: DataflowEndpointConfig -> DataflowEndpointConfig -> Bool
== :: DataflowEndpointConfig -> DataflowEndpointConfig -> Bool
$c== :: DataflowEndpointConfig -> DataflowEndpointConfig -> Bool
Prelude.Eq, ReadPrec [DataflowEndpointConfig]
ReadPrec DataflowEndpointConfig
Int -> ReadS DataflowEndpointConfig
ReadS [DataflowEndpointConfig]
(Int -> ReadS DataflowEndpointConfig)
-> ReadS [DataflowEndpointConfig]
-> ReadPrec DataflowEndpointConfig
-> ReadPrec [DataflowEndpointConfig]
-> Read DataflowEndpointConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DataflowEndpointConfig]
$creadListPrec :: ReadPrec [DataflowEndpointConfig]
readPrec :: ReadPrec DataflowEndpointConfig
$creadPrec :: ReadPrec DataflowEndpointConfig
readList :: ReadS [DataflowEndpointConfig]
$creadList :: ReadS [DataflowEndpointConfig]
readsPrec :: Int -> ReadS DataflowEndpointConfig
$creadsPrec :: Int -> ReadS DataflowEndpointConfig
Prelude.Read, Int -> DataflowEndpointConfig -> ShowS
[DataflowEndpointConfig] -> ShowS
DataflowEndpointConfig -> String
(Int -> DataflowEndpointConfig -> ShowS)
-> (DataflowEndpointConfig -> String)
-> ([DataflowEndpointConfig] -> ShowS)
-> Show DataflowEndpointConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DataflowEndpointConfig] -> ShowS
$cshowList :: [DataflowEndpointConfig] -> ShowS
show :: DataflowEndpointConfig -> String
$cshow :: DataflowEndpointConfig -> String
showsPrec :: Int -> DataflowEndpointConfig -> ShowS
$cshowsPrec :: Int -> DataflowEndpointConfig -> ShowS
Prelude.Show, (forall x. DataflowEndpointConfig -> Rep DataflowEndpointConfig x)
-> (forall x.
    Rep DataflowEndpointConfig x -> DataflowEndpointConfig)
-> Generic DataflowEndpointConfig
forall x. Rep DataflowEndpointConfig x -> DataflowEndpointConfig
forall x. DataflowEndpointConfig -> Rep DataflowEndpointConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DataflowEndpointConfig x -> DataflowEndpointConfig
$cfrom :: forall x. DataflowEndpointConfig -> Rep DataflowEndpointConfig x
Prelude.Generic)

-- |
-- Create a value of 'DataflowEndpointConfig' 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:
--
-- 'dataflowEndpointRegion', 'dataflowEndpointConfig_dataflowEndpointRegion' - Region of a dataflow endpoint.
--
-- 'dataflowEndpointName', 'dataflowEndpointConfig_dataflowEndpointName' - Name of a dataflow endpoint.
newDataflowEndpointConfig ::
  -- | 'dataflowEndpointName'
  Prelude.Text ->
  DataflowEndpointConfig
newDataflowEndpointConfig :: Text -> DataflowEndpointConfig
newDataflowEndpointConfig Text
pDataflowEndpointName_ =
  DataflowEndpointConfig' :: Maybe Text -> Text -> DataflowEndpointConfig
DataflowEndpointConfig'
    { $sel:dataflowEndpointRegion:DataflowEndpointConfig' :: Maybe Text
dataflowEndpointRegion =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:dataflowEndpointName:DataflowEndpointConfig' :: Text
dataflowEndpointName = Text
pDataflowEndpointName_
    }

-- | Region of a dataflow endpoint.
dataflowEndpointConfig_dataflowEndpointRegion :: Lens.Lens' DataflowEndpointConfig (Prelude.Maybe Prelude.Text)
dataflowEndpointConfig_dataflowEndpointRegion :: (Maybe Text -> f (Maybe Text))
-> DataflowEndpointConfig -> f DataflowEndpointConfig
dataflowEndpointConfig_dataflowEndpointRegion = (DataflowEndpointConfig -> Maybe Text)
-> (DataflowEndpointConfig -> Maybe Text -> DataflowEndpointConfig)
-> Lens
     DataflowEndpointConfig
     DataflowEndpointConfig
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataflowEndpointConfig' {Maybe Text
dataflowEndpointRegion :: Maybe Text
$sel:dataflowEndpointRegion:DataflowEndpointConfig' :: DataflowEndpointConfig -> Maybe Text
dataflowEndpointRegion} -> Maybe Text
dataflowEndpointRegion) (\s :: DataflowEndpointConfig
s@DataflowEndpointConfig' {} Maybe Text
a -> DataflowEndpointConfig
s {$sel:dataflowEndpointRegion:DataflowEndpointConfig' :: Maybe Text
dataflowEndpointRegion = Maybe Text
a} :: DataflowEndpointConfig)

-- | Name of a dataflow endpoint.
dataflowEndpointConfig_dataflowEndpointName :: Lens.Lens' DataflowEndpointConfig Prelude.Text
dataflowEndpointConfig_dataflowEndpointName :: (Text -> f Text)
-> DataflowEndpointConfig -> f DataflowEndpointConfig
dataflowEndpointConfig_dataflowEndpointName = (DataflowEndpointConfig -> Text)
-> (DataflowEndpointConfig -> Text -> DataflowEndpointConfig)
-> Lens DataflowEndpointConfig DataflowEndpointConfig Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataflowEndpointConfig' {Text
dataflowEndpointName :: Text
$sel:dataflowEndpointName:DataflowEndpointConfig' :: DataflowEndpointConfig -> Text
dataflowEndpointName} -> Text
dataflowEndpointName) (\s :: DataflowEndpointConfig
s@DataflowEndpointConfig' {} Text
a -> DataflowEndpointConfig
s {$sel:dataflowEndpointName:DataflowEndpointConfig' :: Text
dataflowEndpointName = Text
a} :: DataflowEndpointConfig)

instance Core.FromJSON DataflowEndpointConfig where
  parseJSON :: Value -> Parser DataflowEndpointConfig
parseJSON =
    String
-> (Object -> Parser DataflowEndpointConfig)
-> Value
-> Parser DataflowEndpointConfig
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"DataflowEndpointConfig"
      ( \Object
x ->
          Maybe Text -> Text -> DataflowEndpointConfig
DataflowEndpointConfig'
            (Maybe Text -> Text -> DataflowEndpointConfig)
-> Parser (Maybe Text) -> Parser (Text -> DataflowEndpointConfig)
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
"dataflowEndpointRegion")
            Parser (Text -> DataflowEndpointConfig)
-> Parser Text -> Parser DataflowEndpointConfig
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"dataflowEndpointName")
      )

instance Prelude.Hashable DataflowEndpointConfig

instance Prelude.NFData DataflowEndpointConfig

instance Core.ToJSON DataflowEndpointConfig where
  toJSON :: DataflowEndpointConfig -> Value
toJSON DataflowEndpointConfig' {Maybe Text
Text
dataflowEndpointName :: Text
dataflowEndpointRegion :: Maybe Text
$sel:dataflowEndpointName:DataflowEndpointConfig' :: DataflowEndpointConfig -> Text
$sel:dataflowEndpointRegion:DataflowEndpointConfig' :: DataflowEndpointConfig -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"dataflowEndpointRegion" 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
dataflowEndpointRegion,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"dataflowEndpointName"
                  Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
dataflowEndpointName
              )
          ]
      )