{-# 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.KinesisAnalytics.Types.InputConfiguration
-- 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.KinesisAnalytics.Types.InputConfiguration where

import qualified Amazonka.Core as Core
import Amazonka.KinesisAnalytics.Types.InputStartingPositionConfiguration
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | When you start your application, you provide this configuration, which
-- identifies the input source and the point in the input source at which
-- you want the application to start processing records.
--
-- /See:/ 'newInputConfiguration' smart constructor.
data InputConfiguration = InputConfiguration'
  { -- | Input source ID. You can get this ID by calling the
    -- <https://docs.aws.amazon.com/kinesisanalytics/latest/dev/API_DescribeApplication.html DescribeApplication>
    -- operation.
    InputConfiguration -> Text
id :: Prelude.Text,
    -- | Point at which you want the application to start processing records from
    -- the streaming source.
    InputConfiguration -> InputStartingPositionConfiguration
inputStartingPositionConfiguration :: InputStartingPositionConfiguration
  }
  deriving (InputConfiguration -> InputConfiguration -> Bool
(InputConfiguration -> InputConfiguration -> Bool)
-> (InputConfiguration -> InputConfiguration -> Bool)
-> Eq InputConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InputConfiguration -> InputConfiguration -> Bool
$c/= :: InputConfiguration -> InputConfiguration -> Bool
== :: InputConfiguration -> InputConfiguration -> Bool
$c== :: InputConfiguration -> InputConfiguration -> Bool
Prelude.Eq, ReadPrec [InputConfiguration]
ReadPrec InputConfiguration
Int -> ReadS InputConfiguration
ReadS [InputConfiguration]
(Int -> ReadS InputConfiguration)
-> ReadS [InputConfiguration]
-> ReadPrec InputConfiguration
-> ReadPrec [InputConfiguration]
-> Read InputConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InputConfiguration]
$creadListPrec :: ReadPrec [InputConfiguration]
readPrec :: ReadPrec InputConfiguration
$creadPrec :: ReadPrec InputConfiguration
readList :: ReadS [InputConfiguration]
$creadList :: ReadS [InputConfiguration]
readsPrec :: Int -> ReadS InputConfiguration
$creadsPrec :: Int -> ReadS InputConfiguration
Prelude.Read, Int -> InputConfiguration -> ShowS
[InputConfiguration] -> ShowS
InputConfiguration -> String
(Int -> InputConfiguration -> ShowS)
-> (InputConfiguration -> String)
-> ([InputConfiguration] -> ShowS)
-> Show InputConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InputConfiguration] -> ShowS
$cshowList :: [InputConfiguration] -> ShowS
show :: InputConfiguration -> String
$cshow :: InputConfiguration -> String
showsPrec :: Int -> InputConfiguration -> ShowS
$cshowsPrec :: Int -> InputConfiguration -> ShowS
Prelude.Show, (forall x. InputConfiguration -> Rep InputConfiguration x)
-> (forall x. Rep InputConfiguration x -> InputConfiguration)
-> Generic InputConfiguration
forall x. Rep InputConfiguration x -> InputConfiguration
forall x. InputConfiguration -> Rep InputConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep InputConfiguration x -> InputConfiguration
$cfrom :: forall x. InputConfiguration -> Rep InputConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'InputConfiguration' 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:
--
-- 'id', 'inputConfiguration_id' - Input source ID. You can get this ID by calling the
-- <https://docs.aws.amazon.com/kinesisanalytics/latest/dev/API_DescribeApplication.html DescribeApplication>
-- operation.
--
-- 'inputStartingPositionConfiguration', 'inputConfiguration_inputStartingPositionConfiguration' - Point at which you want the application to start processing records from
-- the streaming source.
newInputConfiguration ::
  -- | 'id'
  Prelude.Text ->
  -- | 'inputStartingPositionConfiguration'
  InputStartingPositionConfiguration ->
  InputConfiguration
newInputConfiguration :: Text -> InputStartingPositionConfiguration -> InputConfiguration
newInputConfiguration
  Text
pId_
  InputStartingPositionConfiguration
pInputStartingPositionConfiguration_ =
    InputConfiguration' :: Text -> InputStartingPositionConfiguration -> InputConfiguration
InputConfiguration'
      { $sel:id:InputConfiguration' :: Text
id = Text
pId_,
        $sel:inputStartingPositionConfiguration:InputConfiguration' :: InputStartingPositionConfiguration
inputStartingPositionConfiguration =
          InputStartingPositionConfiguration
pInputStartingPositionConfiguration_
      }

-- | Input source ID. You can get this ID by calling the
-- <https://docs.aws.amazon.com/kinesisanalytics/latest/dev/API_DescribeApplication.html DescribeApplication>
-- operation.
inputConfiguration_id :: Lens.Lens' InputConfiguration Prelude.Text
inputConfiguration_id :: (Text -> f Text) -> InputConfiguration -> f InputConfiguration
inputConfiguration_id = (InputConfiguration -> Text)
-> (InputConfiguration -> Text -> InputConfiguration)
-> Lens InputConfiguration InputConfiguration Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InputConfiguration' {Text
id :: Text
$sel:id:InputConfiguration' :: InputConfiguration -> Text
id} -> Text
id) (\s :: InputConfiguration
s@InputConfiguration' {} Text
a -> InputConfiguration
s {$sel:id:InputConfiguration' :: Text
id = Text
a} :: InputConfiguration)

-- | Point at which you want the application to start processing records from
-- the streaming source.
inputConfiguration_inputStartingPositionConfiguration :: Lens.Lens' InputConfiguration InputStartingPositionConfiguration
inputConfiguration_inputStartingPositionConfiguration :: (InputStartingPositionConfiguration
 -> f InputStartingPositionConfiguration)
-> InputConfiguration -> f InputConfiguration
inputConfiguration_inputStartingPositionConfiguration = (InputConfiguration -> InputStartingPositionConfiguration)
-> (InputConfiguration
    -> InputStartingPositionConfiguration -> InputConfiguration)
-> Lens
     InputConfiguration
     InputConfiguration
     InputStartingPositionConfiguration
     InputStartingPositionConfiguration
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InputConfiguration' {InputStartingPositionConfiguration
inputStartingPositionConfiguration :: InputStartingPositionConfiguration
$sel:inputStartingPositionConfiguration:InputConfiguration' :: InputConfiguration -> InputStartingPositionConfiguration
inputStartingPositionConfiguration} -> InputStartingPositionConfiguration
inputStartingPositionConfiguration) (\s :: InputConfiguration
s@InputConfiguration' {} InputStartingPositionConfiguration
a -> InputConfiguration
s {$sel:inputStartingPositionConfiguration:InputConfiguration' :: InputStartingPositionConfiguration
inputStartingPositionConfiguration = InputStartingPositionConfiguration
a} :: InputConfiguration)

instance Prelude.Hashable InputConfiguration

instance Prelude.NFData InputConfiguration

instance Core.ToJSON InputConfiguration where
  toJSON :: InputConfiguration -> Value
toJSON InputConfiguration' {Text
InputStartingPositionConfiguration
inputStartingPositionConfiguration :: InputStartingPositionConfiguration
id :: Text
$sel:inputStartingPositionConfiguration:InputConfiguration' :: InputConfiguration -> InputStartingPositionConfiguration
$sel:id:InputConfiguration' :: InputConfiguration -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Id" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
id),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"InputStartingPositionConfiguration"
                  Text -> InputStartingPositionConfiguration -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= InputStartingPositionConfiguration
inputStartingPositionConfiguration
              )
          ]
      )