{-# 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.KinesisAnalyticsV2.Types.SqlApplicationConfiguration
-- 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.KinesisAnalyticsV2.Types.SqlApplicationConfiguration where

import qualified Amazonka.Core as Core
import Amazonka.KinesisAnalyticsV2.Types.Input
import Amazonka.KinesisAnalyticsV2.Types.Output
import Amazonka.KinesisAnalyticsV2.Types.ReferenceDataSource
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Describes the inputs, outputs, and reference data sources for a
-- SQL-based Kinesis Data Analytics application.
--
-- /See:/ 'newSqlApplicationConfiguration' smart constructor.
data SqlApplicationConfiguration = SqlApplicationConfiguration'
  { -- | The array of Input objects describing the input streams used by the
    -- application.
    SqlApplicationConfiguration -> Maybe [Input]
inputs :: Prelude.Maybe [Input],
    -- | The array of ReferenceDataSource objects describing the reference data
    -- sources used by the application.
    SqlApplicationConfiguration -> Maybe [ReferenceDataSource]
referenceDataSources :: Prelude.Maybe [ReferenceDataSource],
    -- | The array of Output objects describing the destination streams used by
    -- the application.
    SqlApplicationConfiguration -> Maybe [Output]
outputs :: Prelude.Maybe [Output]
  }
  deriving (SqlApplicationConfiguration -> SqlApplicationConfiguration -> Bool
(SqlApplicationConfiguration
 -> SqlApplicationConfiguration -> Bool)
-> (SqlApplicationConfiguration
    -> SqlApplicationConfiguration -> Bool)
-> Eq SqlApplicationConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SqlApplicationConfiguration -> SqlApplicationConfiguration -> Bool
$c/= :: SqlApplicationConfiguration -> SqlApplicationConfiguration -> Bool
== :: SqlApplicationConfiguration -> SqlApplicationConfiguration -> Bool
$c== :: SqlApplicationConfiguration -> SqlApplicationConfiguration -> Bool
Prelude.Eq, ReadPrec [SqlApplicationConfiguration]
ReadPrec SqlApplicationConfiguration
Int -> ReadS SqlApplicationConfiguration
ReadS [SqlApplicationConfiguration]
(Int -> ReadS SqlApplicationConfiguration)
-> ReadS [SqlApplicationConfiguration]
-> ReadPrec SqlApplicationConfiguration
-> ReadPrec [SqlApplicationConfiguration]
-> Read SqlApplicationConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SqlApplicationConfiguration]
$creadListPrec :: ReadPrec [SqlApplicationConfiguration]
readPrec :: ReadPrec SqlApplicationConfiguration
$creadPrec :: ReadPrec SqlApplicationConfiguration
readList :: ReadS [SqlApplicationConfiguration]
$creadList :: ReadS [SqlApplicationConfiguration]
readsPrec :: Int -> ReadS SqlApplicationConfiguration
$creadsPrec :: Int -> ReadS SqlApplicationConfiguration
Prelude.Read, Int -> SqlApplicationConfiguration -> ShowS
[SqlApplicationConfiguration] -> ShowS
SqlApplicationConfiguration -> String
(Int -> SqlApplicationConfiguration -> ShowS)
-> (SqlApplicationConfiguration -> String)
-> ([SqlApplicationConfiguration] -> ShowS)
-> Show SqlApplicationConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SqlApplicationConfiguration] -> ShowS
$cshowList :: [SqlApplicationConfiguration] -> ShowS
show :: SqlApplicationConfiguration -> String
$cshow :: SqlApplicationConfiguration -> String
showsPrec :: Int -> SqlApplicationConfiguration -> ShowS
$cshowsPrec :: Int -> SqlApplicationConfiguration -> ShowS
Prelude.Show, (forall x.
 SqlApplicationConfiguration -> Rep SqlApplicationConfiguration x)
-> (forall x.
    Rep SqlApplicationConfiguration x -> SqlApplicationConfiguration)
-> Generic SqlApplicationConfiguration
forall x.
Rep SqlApplicationConfiguration x -> SqlApplicationConfiguration
forall x.
SqlApplicationConfiguration -> Rep SqlApplicationConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep SqlApplicationConfiguration x -> SqlApplicationConfiguration
$cfrom :: forall x.
SqlApplicationConfiguration -> Rep SqlApplicationConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'SqlApplicationConfiguration' 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:
--
-- 'inputs', 'sqlApplicationConfiguration_inputs' - The array of Input objects describing the input streams used by the
-- application.
--
-- 'referenceDataSources', 'sqlApplicationConfiguration_referenceDataSources' - The array of ReferenceDataSource objects describing the reference data
-- sources used by the application.
--
-- 'outputs', 'sqlApplicationConfiguration_outputs' - The array of Output objects describing the destination streams used by
-- the application.
newSqlApplicationConfiguration ::
  SqlApplicationConfiguration
newSqlApplicationConfiguration :: SqlApplicationConfiguration
newSqlApplicationConfiguration =
  SqlApplicationConfiguration' :: Maybe [Input]
-> Maybe [ReferenceDataSource]
-> Maybe [Output]
-> SqlApplicationConfiguration
SqlApplicationConfiguration'
    { $sel:inputs:SqlApplicationConfiguration' :: Maybe [Input]
inputs =
        Maybe [Input]
forall a. Maybe a
Prelude.Nothing,
      $sel:referenceDataSources:SqlApplicationConfiguration' :: Maybe [ReferenceDataSource]
referenceDataSources = Maybe [ReferenceDataSource]
forall a. Maybe a
Prelude.Nothing,
      $sel:outputs:SqlApplicationConfiguration' :: Maybe [Output]
outputs = Maybe [Output]
forall a. Maybe a
Prelude.Nothing
    }

-- | The array of Input objects describing the input streams used by the
-- application.
sqlApplicationConfiguration_inputs :: Lens.Lens' SqlApplicationConfiguration (Prelude.Maybe [Input])
sqlApplicationConfiguration_inputs :: (Maybe [Input] -> f (Maybe [Input]))
-> SqlApplicationConfiguration -> f SqlApplicationConfiguration
sqlApplicationConfiguration_inputs = (SqlApplicationConfiguration -> Maybe [Input])
-> (SqlApplicationConfiguration
    -> Maybe [Input] -> SqlApplicationConfiguration)
-> Lens
     SqlApplicationConfiguration
     SqlApplicationConfiguration
     (Maybe [Input])
     (Maybe [Input])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SqlApplicationConfiguration' {Maybe [Input]
inputs :: Maybe [Input]
$sel:inputs:SqlApplicationConfiguration' :: SqlApplicationConfiguration -> Maybe [Input]
inputs} -> Maybe [Input]
inputs) (\s :: SqlApplicationConfiguration
s@SqlApplicationConfiguration' {} Maybe [Input]
a -> SqlApplicationConfiguration
s {$sel:inputs:SqlApplicationConfiguration' :: Maybe [Input]
inputs = Maybe [Input]
a} :: SqlApplicationConfiguration) ((Maybe [Input] -> f (Maybe [Input]))
 -> SqlApplicationConfiguration -> f SqlApplicationConfiguration)
-> ((Maybe [Input] -> f (Maybe [Input]))
    -> Maybe [Input] -> f (Maybe [Input]))
-> (Maybe [Input] -> f (Maybe [Input]))
-> SqlApplicationConfiguration
-> f SqlApplicationConfiguration
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Input] [Input] [Input] [Input]
-> Iso
     (Maybe [Input]) (Maybe [Input]) (Maybe [Input]) (Maybe [Input])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Input] [Input] [Input] [Input]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The array of ReferenceDataSource objects describing the reference data
-- sources used by the application.
sqlApplicationConfiguration_referenceDataSources :: Lens.Lens' SqlApplicationConfiguration (Prelude.Maybe [ReferenceDataSource])
sqlApplicationConfiguration_referenceDataSources :: (Maybe [ReferenceDataSource] -> f (Maybe [ReferenceDataSource]))
-> SqlApplicationConfiguration -> f SqlApplicationConfiguration
sqlApplicationConfiguration_referenceDataSources = (SqlApplicationConfiguration -> Maybe [ReferenceDataSource])
-> (SqlApplicationConfiguration
    -> Maybe [ReferenceDataSource] -> SqlApplicationConfiguration)
-> Lens
     SqlApplicationConfiguration
     SqlApplicationConfiguration
     (Maybe [ReferenceDataSource])
     (Maybe [ReferenceDataSource])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SqlApplicationConfiguration' {Maybe [ReferenceDataSource]
referenceDataSources :: Maybe [ReferenceDataSource]
$sel:referenceDataSources:SqlApplicationConfiguration' :: SqlApplicationConfiguration -> Maybe [ReferenceDataSource]
referenceDataSources} -> Maybe [ReferenceDataSource]
referenceDataSources) (\s :: SqlApplicationConfiguration
s@SqlApplicationConfiguration' {} Maybe [ReferenceDataSource]
a -> SqlApplicationConfiguration
s {$sel:referenceDataSources:SqlApplicationConfiguration' :: Maybe [ReferenceDataSource]
referenceDataSources = Maybe [ReferenceDataSource]
a} :: SqlApplicationConfiguration) ((Maybe [ReferenceDataSource] -> f (Maybe [ReferenceDataSource]))
 -> SqlApplicationConfiguration -> f SqlApplicationConfiguration)
-> ((Maybe [ReferenceDataSource]
     -> f (Maybe [ReferenceDataSource]))
    -> Maybe [ReferenceDataSource] -> f (Maybe [ReferenceDataSource]))
-> (Maybe [ReferenceDataSource] -> f (Maybe [ReferenceDataSource]))
-> SqlApplicationConfiguration
-> f SqlApplicationConfiguration
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ReferenceDataSource]
  [ReferenceDataSource]
  [ReferenceDataSource]
  [ReferenceDataSource]
-> Iso
     (Maybe [ReferenceDataSource])
     (Maybe [ReferenceDataSource])
     (Maybe [ReferenceDataSource])
     (Maybe [ReferenceDataSource])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  [ReferenceDataSource]
  [ReferenceDataSource]
  [ReferenceDataSource]
  [ReferenceDataSource]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The array of Output objects describing the destination streams used by
-- the application.
sqlApplicationConfiguration_outputs :: Lens.Lens' SqlApplicationConfiguration (Prelude.Maybe [Output])
sqlApplicationConfiguration_outputs :: (Maybe [Output] -> f (Maybe [Output]))
-> SqlApplicationConfiguration -> f SqlApplicationConfiguration
sqlApplicationConfiguration_outputs = (SqlApplicationConfiguration -> Maybe [Output])
-> (SqlApplicationConfiguration
    -> Maybe [Output] -> SqlApplicationConfiguration)
-> Lens
     SqlApplicationConfiguration
     SqlApplicationConfiguration
     (Maybe [Output])
     (Maybe [Output])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SqlApplicationConfiguration' {Maybe [Output]
outputs :: Maybe [Output]
$sel:outputs:SqlApplicationConfiguration' :: SqlApplicationConfiguration -> Maybe [Output]
outputs} -> Maybe [Output]
outputs) (\s :: SqlApplicationConfiguration
s@SqlApplicationConfiguration' {} Maybe [Output]
a -> SqlApplicationConfiguration
s {$sel:outputs:SqlApplicationConfiguration' :: Maybe [Output]
outputs = Maybe [Output]
a} :: SqlApplicationConfiguration) ((Maybe [Output] -> f (Maybe [Output]))
 -> SqlApplicationConfiguration -> f SqlApplicationConfiguration)
-> ((Maybe [Output] -> f (Maybe [Output]))
    -> Maybe [Output] -> f (Maybe [Output]))
-> (Maybe [Output] -> f (Maybe [Output]))
-> SqlApplicationConfiguration
-> f SqlApplicationConfiguration
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Output] [Output] [Output] [Output]
-> Iso
     (Maybe [Output]) (Maybe [Output]) (Maybe [Output]) (Maybe [Output])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Output] [Output] [Output] [Output]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Prelude.Hashable SqlApplicationConfiguration

instance Prelude.NFData SqlApplicationConfiguration

instance Core.ToJSON SqlApplicationConfiguration where
  toJSON :: SqlApplicationConfiguration -> Value
toJSON SqlApplicationConfiguration' {Maybe [Output]
Maybe [ReferenceDataSource]
Maybe [Input]
outputs :: Maybe [Output]
referenceDataSources :: Maybe [ReferenceDataSource]
inputs :: Maybe [Input]
$sel:outputs:SqlApplicationConfiguration' :: SqlApplicationConfiguration -> Maybe [Output]
$sel:referenceDataSources:SqlApplicationConfiguration' :: SqlApplicationConfiguration -> Maybe [ReferenceDataSource]
$sel:inputs:SqlApplicationConfiguration' :: SqlApplicationConfiguration -> Maybe [Input]
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"Inputs" Text -> [Input] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Input] -> Pair) -> Maybe [Input] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Input]
inputs,
            (Text
"ReferenceDataSources" Text -> [ReferenceDataSource] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              ([ReferenceDataSource] -> Pair)
-> Maybe [ReferenceDataSource] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [ReferenceDataSource]
referenceDataSources,
            (Text
"Outputs" Text -> [Output] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Output] -> Pair) -> Maybe [Output] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Output]
outputs
          ]
      )