{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.GroundStation.Types.DataflowEndpointConfig 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

-- | 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
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]
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
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. 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'
    { $sel:dataflowEndpointRegion:DataflowEndpointConfig' :: Maybe Text
dataflowEndpointRegion =
        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 :: Lens' DataflowEndpointConfig (Maybe Text)
dataflowEndpointConfig_dataflowEndpointRegion = 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 :: Lens' DataflowEndpointConfig Text
dataflowEndpointConfig_dataflowEndpointName = 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 Data.FromJSON DataflowEndpointConfig where
  parseJSON :: Value -> Parser DataflowEndpointConfig
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"DataflowEndpointConfig"
      ( \Object
x ->
          Maybe Text -> Text -> DataflowEndpointConfig
DataflowEndpointConfig'
            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
"dataflowEndpointRegion")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"dataflowEndpointName")
      )

instance Prelude.Hashable DataflowEndpointConfig where
  hashWithSalt :: Int -> DataflowEndpointConfig -> Int
hashWithSalt Int
_salt DataflowEndpointConfig' {Maybe Text
Text
dataflowEndpointName :: Text
dataflowEndpointRegion :: Maybe Text
$sel:dataflowEndpointName:DataflowEndpointConfig' :: DataflowEndpointConfig -> Text
$sel:dataflowEndpointRegion:DataflowEndpointConfig' :: DataflowEndpointConfig -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
dataflowEndpointRegion
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
dataflowEndpointName

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

instance Data.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
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"dataflowEndpointRegion" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
dataflowEndpointRegion,
            forall a. a -> Maybe a
Prelude.Just
              ( Key
"dataflowEndpointName"
                  forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
dataflowEndpointName
              )
          ]
      )