{-# 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.Source
-- 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.Source where

import qualified Amazonka.Core as Core
import Amazonka.GroundStation.Types.ConfigCapabilityType
import Amazonka.GroundStation.Types.ConfigDetails
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Dataflow details for the source side.
--
-- /See:/ 'newSource' smart constructor.
data Source = Source'
  { -- | Region of a dataflow source.
    Source -> Maybe Text
dataflowSourceRegion :: Prelude.Maybe Prelude.Text,
    -- | UUID of a @Config@.
    Source -> Maybe Text
configId :: Prelude.Maybe Prelude.Text,
    -- | Type of a @Config@.
    Source -> Maybe ConfigCapabilityType
configType :: Prelude.Maybe ConfigCapabilityType,
    -- | Additional details for a @Config@, if type is dataflow endpoint or
    -- antenna demod decode.
    Source -> Maybe ConfigDetails
configDetails :: Prelude.Maybe ConfigDetails
  }
  deriving (Source -> Source -> Bool
(Source -> Source -> Bool)
-> (Source -> Source -> Bool) -> Eq Source
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Source -> Source -> Bool
$c/= :: Source -> Source -> Bool
== :: Source -> Source -> Bool
$c== :: Source -> Source -> Bool
Prelude.Eq, ReadPrec [Source]
ReadPrec Source
Int -> ReadS Source
ReadS [Source]
(Int -> ReadS Source)
-> ReadS [Source]
-> ReadPrec Source
-> ReadPrec [Source]
-> Read Source
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Source]
$creadListPrec :: ReadPrec [Source]
readPrec :: ReadPrec Source
$creadPrec :: ReadPrec Source
readList :: ReadS [Source]
$creadList :: ReadS [Source]
readsPrec :: Int -> ReadS Source
$creadsPrec :: Int -> ReadS Source
Prelude.Read, Int -> Source -> ShowS
[Source] -> ShowS
Source -> String
(Int -> Source -> ShowS)
-> (Source -> String) -> ([Source] -> ShowS) -> Show Source
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Source] -> ShowS
$cshowList :: [Source] -> ShowS
show :: Source -> String
$cshow :: Source -> String
showsPrec :: Int -> Source -> ShowS
$cshowsPrec :: Int -> Source -> ShowS
Prelude.Show, (forall x. Source -> Rep Source x)
-> (forall x. Rep Source x -> Source) -> Generic Source
forall x. Rep Source x -> Source
forall x. Source -> Rep Source x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Source x -> Source
$cfrom :: forall x. Source -> Rep Source x
Prelude.Generic)

-- |
-- Create a value of 'Source' 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:
--
-- 'dataflowSourceRegion', 'source_dataflowSourceRegion' - Region of a dataflow source.
--
-- 'configId', 'source_configId' - UUID of a @Config@.
--
-- 'configType', 'source_configType' - Type of a @Config@.
--
-- 'configDetails', 'source_configDetails' - Additional details for a @Config@, if type is dataflow endpoint or
-- antenna demod decode.
newSource ::
  Source
newSource :: Source
newSource =
  Source' :: Maybe Text
-> Maybe Text
-> Maybe ConfigCapabilityType
-> Maybe ConfigDetails
-> Source
Source'
    { $sel:dataflowSourceRegion:Source' :: Maybe Text
dataflowSourceRegion = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:configId:Source' :: Maybe Text
configId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:configType:Source' :: Maybe ConfigCapabilityType
configType = Maybe ConfigCapabilityType
forall a. Maybe a
Prelude.Nothing,
      $sel:configDetails:Source' :: Maybe ConfigDetails
configDetails = Maybe ConfigDetails
forall a. Maybe a
Prelude.Nothing
    }

-- | Region of a dataflow source.
source_dataflowSourceRegion :: Lens.Lens' Source (Prelude.Maybe Prelude.Text)
source_dataflowSourceRegion :: (Maybe Text -> f (Maybe Text)) -> Source -> f Source
source_dataflowSourceRegion = (Source -> Maybe Text)
-> (Source -> Maybe Text -> Source)
-> Lens Source Source (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Source' {Maybe Text
dataflowSourceRegion :: Maybe Text
$sel:dataflowSourceRegion:Source' :: Source -> Maybe Text
dataflowSourceRegion} -> Maybe Text
dataflowSourceRegion) (\s :: Source
s@Source' {} Maybe Text
a -> Source
s {$sel:dataflowSourceRegion:Source' :: Maybe Text
dataflowSourceRegion = Maybe Text
a} :: Source)

-- | UUID of a @Config@.
source_configId :: Lens.Lens' Source (Prelude.Maybe Prelude.Text)
source_configId :: (Maybe Text -> f (Maybe Text)) -> Source -> f Source
source_configId = (Source -> Maybe Text)
-> (Source -> Maybe Text -> Source)
-> Lens Source Source (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Source' {Maybe Text
configId :: Maybe Text
$sel:configId:Source' :: Source -> Maybe Text
configId} -> Maybe Text
configId) (\s :: Source
s@Source' {} Maybe Text
a -> Source
s {$sel:configId:Source' :: Maybe Text
configId = Maybe Text
a} :: Source)

-- | Type of a @Config@.
source_configType :: Lens.Lens' Source (Prelude.Maybe ConfigCapabilityType)
source_configType :: (Maybe ConfigCapabilityType -> f (Maybe ConfigCapabilityType))
-> Source -> f Source
source_configType = (Source -> Maybe ConfigCapabilityType)
-> (Source -> Maybe ConfigCapabilityType -> Source)
-> Lens
     Source
     Source
     (Maybe ConfigCapabilityType)
     (Maybe ConfigCapabilityType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Source' {Maybe ConfigCapabilityType
configType :: Maybe ConfigCapabilityType
$sel:configType:Source' :: Source -> Maybe ConfigCapabilityType
configType} -> Maybe ConfigCapabilityType
configType) (\s :: Source
s@Source' {} Maybe ConfigCapabilityType
a -> Source
s {$sel:configType:Source' :: Maybe ConfigCapabilityType
configType = Maybe ConfigCapabilityType
a} :: Source)

-- | Additional details for a @Config@, if type is dataflow endpoint or
-- antenna demod decode.
source_configDetails :: Lens.Lens' Source (Prelude.Maybe ConfigDetails)
source_configDetails :: (Maybe ConfigDetails -> f (Maybe ConfigDetails))
-> Source -> f Source
source_configDetails = (Source -> Maybe ConfigDetails)
-> (Source -> Maybe ConfigDetails -> Source)
-> Lens Source Source (Maybe ConfigDetails) (Maybe ConfigDetails)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Source' {Maybe ConfigDetails
configDetails :: Maybe ConfigDetails
$sel:configDetails:Source' :: Source -> Maybe ConfigDetails
configDetails} -> Maybe ConfigDetails
configDetails) (\s :: Source
s@Source' {} Maybe ConfigDetails
a -> Source
s {$sel:configDetails:Source' :: Maybe ConfigDetails
configDetails = Maybe ConfigDetails
a} :: Source)

instance Core.FromJSON Source where
  parseJSON :: Value -> Parser Source
parseJSON =
    String -> (Object -> Parser Source) -> Value -> Parser Source
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Source"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe ConfigCapabilityType
-> Maybe ConfigDetails
-> Source
Source'
            (Maybe Text
 -> Maybe Text
 -> Maybe ConfigCapabilityType
 -> Maybe ConfigDetails
 -> Source)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe ConfigCapabilityType -> Maybe ConfigDetails -> Source)
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
"dataflowSourceRegion")
            Parser
  (Maybe Text
   -> Maybe ConfigCapabilityType -> Maybe ConfigDetails -> Source)
-> Parser (Maybe Text)
-> Parser
     (Maybe ConfigCapabilityType -> Maybe ConfigDetails -> Source)
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
"configId")
            Parser
  (Maybe ConfigCapabilityType -> Maybe ConfigDetails -> Source)
-> Parser (Maybe ConfigCapabilityType)
-> Parser (Maybe ConfigDetails -> Source)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ConfigCapabilityType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"configType")
            Parser (Maybe ConfigDetails -> Source)
-> Parser (Maybe ConfigDetails) -> Parser Source
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ConfigDetails)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"configDetails")
      )

instance Prelude.Hashable Source

instance Prelude.NFData Source