{-# 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.IoTEvents.Types.InputIdentifier
-- 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.IoTEvents.Types.InputIdentifier where

import qualified Amazonka.Core as Core
import Amazonka.IoTEvents.Types.IotEventsInputIdentifier
import Amazonka.IoTEvents.Types.IotSiteWiseInputIdentifier
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The identifer of the input.
--
-- /See:/ 'newInputIdentifier' smart constructor.
data InputIdentifier = InputIdentifier'
  { -- | The identifer of the input routed from AWS IoT SiteWise.
    InputIdentifier -> Maybe IotSiteWiseInputIdentifier
iotSiteWiseInputIdentifier :: Prelude.Maybe IotSiteWiseInputIdentifier,
    -- | The identifier of the input routed to AWS IoT Events.
    InputIdentifier -> Maybe IotEventsInputIdentifier
iotEventsInputIdentifier :: Prelude.Maybe IotEventsInputIdentifier
  }
  deriving (InputIdentifier -> InputIdentifier -> Bool
(InputIdentifier -> InputIdentifier -> Bool)
-> (InputIdentifier -> InputIdentifier -> Bool)
-> Eq InputIdentifier
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InputIdentifier -> InputIdentifier -> Bool
$c/= :: InputIdentifier -> InputIdentifier -> Bool
== :: InputIdentifier -> InputIdentifier -> Bool
$c== :: InputIdentifier -> InputIdentifier -> Bool
Prelude.Eq, ReadPrec [InputIdentifier]
ReadPrec InputIdentifier
Int -> ReadS InputIdentifier
ReadS [InputIdentifier]
(Int -> ReadS InputIdentifier)
-> ReadS [InputIdentifier]
-> ReadPrec InputIdentifier
-> ReadPrec [InputIdentifier]
-> Read InputIdentifier
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InputIdentifier]
$creadListPrec :: ReadPrec [InputIdentifier]
readPrec :: ReadPrec InputIdentifier
$creadPrec :: ReadPrec InputIdentifier
readList :: ReadS [InputIdentifier]
$creadList :: ReadS [InputIdentifier]
readsPrec :: Int -> ReadS InputIdentifier
$creadsPrec :: Int -> ReadS InputIdentifier
Prelude.Read, Int -> InputIdentifier -> ShowS
[InputIdentifier] -> ShowS
InputIdentifier -> String
(Int -> InputIdentifier -> ShowS)
-> (InputIdentifier -> String)
-> ([InputIdentifier] -> ShowS)
-> Show InputIdentifier
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InputIdentifier] -> ShowS
$cshowList :: [InputIdentifier] -> ShowS
show :: InputIdentifier -> String
$cshow :: InputIdentifier -> String
showsPrec :: Int -> InputIdentifier -> ShowS
$cshowsPrec :: Int -> InputIdentifier -> ShowS
Prelude.Show, (forall x. InputIdentifier -> Rep InputIdentifier x)
-> (forall x. Rep InputIdentifier x -> InputIdentifier)
-> Generic InputIdentifier
forall x. Rep InputIdentifier x -> InputIdentifier
forall x. InputIdentifier -> Rep InputIdentifier x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep InputIdentifier x -> InputIdentifier
$cfrom :: forall x. InputIdentifier -> Rep InputIdentifier x
Prelude.Generic)

-- |
-- Create a value of 'InputIdentifier' 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:
--
-- 'iotSiteWiseInputIdentifier', 'inputIdentifier_iotSiteWiseInputIdentifier' - The identifer of the input routed from AWS IoT SiteWise.
--
-- 'iotEventsInputIdentifier', 'inputIdentifier_iotEventsInputIdentifier' - The identifier of the input routed to AWS IoT Events.
newInputIdentifier ::
  InputIdentifier
newInputIdentifier :: InputIdentifier
newInputIdentifier =
  InputIdentifier' :: Maybe IotSiteWiseInputIdentifier
-> Maybe IotEventsInputIdentifier -> InputIdentifier
InputIdentifier'
    { $sel:iotSiteWiseInputIdentifier:InputIdentifier' :: Maybe IotSiteWiseInputIdentifier
iotSiteWiseInputIdentifier =
        Maybe IotSiteWiseInputIdentifier
forall a. Maybe a
Prelude.Nothing,
      $sel:iotEventsInputIdentifier:InputIdentifier' :: Maybe IotEventsInputIdentifier
iotEventsInputIdentifier = Maybe IotEventsInputIdentifier
forall a. Maybe a
Prelude.Nothing
    }

-- | The identifer of the input routed from AWS IoT SiteWise.
inputIdentifier_iotSiteWiseInputIdentifier :: Lens.Lens' InputIdentifier (Prelude.Maybe IotSiteWiseInputIdentifier)
inputIdentifier_iotSiteWiseInputIdentifier :: (Maybe IotSiteWiseInputIdentifier
 -> f (Maybe IotSiteWiseInputIdentifier))
-> InputIdentifier -> f InputIdentifier
inputIdentifier_iotSiteWiseInputIdentifier = (InputIdentifier -> Maybe IotSiteWiseInputIdentifier)
-> (InputIdentifier
    -> Maybe IotSiteWiseInputIdentifier -> InputIdentifier)
-> Lens
     InputIdentifier
     InputIdentifier
     (Maybe IotSiteWiseInputIdentifier)
     (Maybe IotSiteWiseInputIdentifier)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InputIdentifier' {Maybe IotSiteWiseInputIdentifier
iotSiteWiseInputIdentifier :: Maybe IotSiteWiseInputIdentifier
$sel:iotSiteWiseInputIdentifier:InputIdentifier' :: InputIdentifier -> Maybe IotSiteWiseInputIdentifier
iotSiteWiseInputIdentifier} -> Maybe IotSiteWiseInputIdentifier
iotSiteWiseInputIdentifier) (\s :: InputIdentifier
s@InputIdentifier' {} Maybe IotSiteWiseInputIdentifier
a -> InputIdentifier
s {$sel:iotSiteWiseInputIdentifier:InputIdentifier' :: Maybe IotSiteWiseInputIdentifier
iotSiteWiseInputIdentifier = Maybe IotSiteWiseInputIdentifier
a} :: InputIdentifier)

-- | The identifier of the input routed to AWS IoT Events.
inputIdentifier_iotEventsInputIdentifier :: Lens.Lens' InputIdentifier (Prelude.Maybe IotEventsInputIdentifier)
inputIdentifier_iotEventsInputIdentifier :: (Maybe IotEventsInputIdentifier
 -> f (Maybe IotEventsInputIdentifier))
-> InputIdentifier -> f InputIdentifier
inputIdentifier_iotEventsInputIdentifier = (InputIdentifier -> Maybe IotEventsInputIdentifier)
-> (InputIdentifier
    -> Maybe IotEventsInputIdentifier -> InputIdentifier)
-> Lens
     InputIdentifier
     InputIdentifier
     (Maybe IotEventsInputIdentifier)
     (Maybe IotEventsInputIdentifier)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InputIdentifier' {Maybe IotEventsInputIdentifier
iotEventsInputIdentifier :: Maybe IotEventsInputIdentifier
$sel:iotEventsInputIdentifier:InputIdentifier' :: InputIdentifier -> Maybe IotEventsInputIdentifier
iotEventsInputIdentifier} -> Maybe IotEventsInputIdentifier
iotEventsInputIdentifier) (\s :: InputIdentifier
s@InputIdentifier' {} Maybe IotEventsInputIdentifier
a -> InputIdentifier
s {$sel:iotEventsInputIdentifier:InputIdentifier' :: Maybe IotEventsInputIdentifier
iotEventsInputIdentifier = Maybe IotEventsInputIdentifier
a} :: InputIdentifier)

instance Prelude.Hashable InputIdentifier

instance Prelude.NFData InputIdentifier

instance Core.ToJSON InputIdentifier where
  toJSON :: InputIdentifier -> Value
toJSON InputIdentifier' {Maybe IotEventsInputIdentifier
Maybe IotSiteWiseInputIdentifier
iotEventsInputIdentifier :: Maybe IotEventsInputIdentifier
iotSiteWiseInputIdentifier :: Maybe IotSiteWiseInputIdentifier
$sel:iotEventsInputIdentifier:InputIdentifier' :: InputIdentifier -> Maybe IotEventsInputIdentifier
$sel:iotSiteWiseInputIdentifier:InputIdentifier' :: InputIdentifier -> Maybe IotSiteWiseInputIdentifier
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"iotSiteWiseInputIdentifier" Text -> IotSiteWiseInputIdentifier -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (IotSiteWiseInputIdentifier -> Pair)
-> Maybe IotSiteWiseInputIdentifier -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe IotSiteWiseInputIdentifier
iotSiteWiseInputIdentifier,
            (Text
"iotEventsInputIdentifier" Text -> IotEventsInputIdentifier -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (IotEventsInputIdentifier -> Pair)
-> Maybe IotEventsInputIdentifier -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe IotEventsInputIdentifier
iotEventsInputIdentifier
          ]
      )