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

import qualified Amazonka.Core as Core
import Amazonka.KinesisAnalyticsV2.Types.InputDescription
import Amazonka.KinesisAnalyticsV2.Types.OutputDescription
import Amazonka.KinesisAnalyticsV2.Types.ReferenceDataSourceDescription
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:/ 'newSqlApplicationConfigurationDescription' smart constructor.
data SqlApplicationConfigurationDescription = SqlApplicationConfigurationDescription'
  { -- | The array of OutputDescription objects describing the destination
    -- streams used by the application.
    SqlApplicationConfigurationDescription -> Maybe [OutputDescription]
outputDescriptions :: Prelude.Maybe [OutputDescription],
    -- | The array of ReferenceDataSourceDescription objects describing the
    -- reference data sources used by the application.
    SqlApplicationConfigurationDescription
-> Maybe [ReferenceDataSourceDescription]
referenceDataSourceDescriptions :: Prelude.Maybe [ReferenceDataSourceDescription],
    -- | The array of InputDescription objects describing the input streams used
    -- by the application.
    SqlApplicationConfigurationDescription -> Maybe [InputDescription]
inputDescriptions :: Prelude.Maybe [InputDescription]
  }
  deriving (SqlApplicationConfigurationDescription
-> SqlApplicationConfigurationDescription -> Bool
(SqlApplicationConfigurationDescription
 -> SqlApplicationConfigurationDescription -> Bool)
-> (SqlApplicationConfigurationDescription
    -> SqlApplicationConfigurationDescription -> Bool)
-> Eq SqlApplicationConfigurationDescription
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SqlApplicationConfigurationDescription
-> SqlApplicationConfigurationDescription -> Bool
$c/= :: SqlApplicationConfigurationDescription
-> SqlApplicationConfigurationDescription -> Bool
== :: SqlApplicationConfigurationDescription
-> SqlApplicationConfigurationDescription -> Bool
$c== :: SqlApplicationConfigurationDescription
-> SqlApplicationConfigurationDescription -> Bool
Prelude.Eq, ReadPrec [SqlApplicationConfigurationDescription]
ReadPrec SqlApplicationConfigurationDescription
Int -> ReadS SqlApplicationConfigurationDescription
ReadS [SqlApplicationConfigurationDescription]
(Int -> ReadS SqlApplicationConfigurationDescription)
-> ReadS [SqlApplicationConfigurationDescription]
-> ReadPrec SqlApplicationConfigurationDescription
-> ReadPrec [SqlApplicationConfigurationDescription]
-> Read SqlApplicationConfigurationDescription
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SqlApplicationConfigurationDescription]
$creadListPrec :: ReadPrec [SqlApplicationConfigurationDescription]
readPrec :: ReadPrec SqlApplicationConfigurationDescription
$creadPrec :: ReadPrec SqlApplicationConfigurationDescription
readList :: ReadS [SqlApplicationConfigurationDescription]
$creadList :: ReadS [SqlApplicationConfigurationDescription]
readsPrec :: Int -> ReadS SqlApplicationConfigurationDescription
$creadsPrec :: Int -> ReadS SqlApplicationConfigurationDescription
Prelude.Read, Int -> SqlApplicationConfigurationDescription -> ShowS
[SqlApplicationConfigurationDescription] -> ShowS
SqlApplicationConfigurationDescription -> String
(Int -> SqlApplicationConfigurationDescription -> ShowS)
-> (SqlApplicationConfigurationDescription -> String)
-> ([SqlApplicationConfigurationDescription] -> ShowS)
-> Show SqlApplicationConfigurationDescription
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SqlApplicationConfigurationDescription] -> ShowS
$cshowList :: [SqlApplicationConfigurationDescription] -> ShowS
show :: SqlApplicationConfigurationDescription -> String
$cshow :: SqlApplicationConfigurationDescription -> String
showsPrec :: Int -> SqlApplicationConfigurationDescription -> ShowS
$cshowsPrec :: Int -> SqlApplicationConfigurationDescription -> ShowS
Prelude.Show, (forall x.
 SqlApplicationConfigurationDescription
 -> Rep SqlApplicationConfigurationDescription x)
-> (forall x.
    Rep SqlApplicationConfigurationDescription x
    -> SqlApplicationConfigurationDescription)
-> Generic SqlApplicationConfigurationDescription
forall x.
Rep SqlApplicationConfigurationDescription x
-> SqlApplicationConfigurationDescription
forall x.
SqlApplicationConfigurationDescription
-> Rep SqlApplicationConfigurationDescription x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep SqlApplicationConfigurationDescription x
-> SqlApplicationConfigurationDescription
$cfrom :: forall x.
SqlApplicationConfigurationDescription
-> Rep SqlApplicationConfigurationDescription x
Prelude.Generic)

-- |
-- Create a value of 'SqlApplicationConfigurationDescription' 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:
--
-- 'outputDescriptions', 'sqlApplicationConfigurationDescription_outputDescriptions' - The array of OutputDescription objects describing the destination
-- streams used by the application.
--
-- 'referenceDataSourceDescriptions', 'sqlApplicationConfigurationDescription_referenceDataSourceDescriptions' - The array of ReferenceDataSourceDescription objects describing the
-- reference data sources used by the application.
--
-- 'inputDescriptions', 'sqlApplicationConfigurationDescription_inputDescriptions' - The array of InputDescription objects describing the input streams used
-- by the application.
newSqlApplicationConfigurationDescription ::
  SqlApplicationConfigurationDescription
newSqlApplicationConfigurationDescription :: SqlApplicationConfigurationDescription
newSqlApplicationConfigurationDescription =
  SqlApplicationConfigurationDescription' :: Maybe [OutputDescription]
-> Maybe [ReferenceDataSourceDescription]
-> Maybe [InputDescription]
-> SqlApplicationConfigurationDescription
SqlApplicationConfigurationDescription'
    { $sel:outputDescriptions:SqlApplicationConfigurationDescription' :: Maybe [OutputDescription]
outputDescriptions =
        Maybe [OutputDescription]
forall a. Maybe a
Prelude.Nothing,
      $sel:referenceDataSourceDescriptions:SqlApplicationConfigurationDescription' :: Maybe [ReferenceDataSourceDescription]
referenceDataSourceDescriptions =
        Maybe [ReferenceDataSourceDescription]
forall a. Maybe a
Prelude.Nothing,
      $sel:inputDescriptions:SqlApplicationConfigurationDescription' :: Maybe [InputDescription]
inputDescriptions = Maybe [InputDescription]
forall a. Maybe a
Prelude.Nothing
    }

-- | The array of OutputDescription objects describing the destination
-- streams used by the application.
sqlApplicationConfigurationDescription_outputDescriptions :: Lens.Lens' SqlApplicationConfigurationDescription (Prelude.Maybe [OutputDescription])
sqlApplicationConfigurationDescription_outputDescriptions :: (Maybe [OutputDescription] -> f (Maybe [OutputDescription]))
-> SqlApplicationConfigurationDescription
-> f SqlApplicationConfigurationDescription
sqlApplicationConfigurationDescription_outputDescriptions = (SqlApplicationConfigurationDescription
 -> Maybe [OutputDescription])
-> (SqlApplicationConfigurationDescription
    -> Maybe [OutputDescription]
    -> SqlApplicationConfigurationDescription)
-> Lens
     SqlApplicationConfigurationDescription
     SqlApplicationConfigurationDescription
     (Maybe [OutputDescription])
     (Maybe [OutputDescription])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SqlApplicationConfigurationDescription' {Maybe [OutputDescription]
outputDescriptions :: Maybe [OutputDescription]
$sel:outputDescriptions:SqlApplicationConfigurationDescription' :: SqlApplicationConfigurationDescription -> Maybe [OutputDescription]
outputDescriptions} -> Maybe [OutputDescription]
outputDescriptions) (\s :: SqlApplicationConfigurationDescription
s@SqlApplicationConfigurationDescription' {} Maybe [OutputDescription]
a -> SqlApplicationConfigurationDescription
s {$sel:outputDescriptions:SqlApplicationConfigurationDescription' :: Maybe [OutputDescription]
outputDescriptions = Maybe [OutputDescription]
a} :: SqlApplicationConfigurationDescription) ((Maybe [OutputDescription] -> f (Maybe [OutputDescription]))
 -> SqlApplicationConfigurationDescription
 -> f SqlApplicationConfigurationDescription)
-> ((Maybe [OutputDescription] -> f (Maybe [OutputDescription]))
    -> Maybe [OutputDescription] -> f (Maybe [OutputDescription]))
-> (Maybe [OutputDescription] -> f (Maybe [OutputDescription]))
-> SqlApplicationConfigurationDescription
-> f SqlApplicationConfigurationDescription
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [OutputDescription]
  [OutputDescription]
  [OutputDescription]
  [OutputDescription]
-> Iso
     (Maybe [OutputDescription])
     (Maybe [OutputDescription])
     (Maybe [OutputDescription])
     (Maybe [OutputDescription])
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
  [OutputDescription]
  [OutputDescription]
  [OutputDescription]
  [OutputDescription]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The array of ReferenceDataSourceDescription objects describing the
-- reference data sources used by the application.
sqlApplicationConfigurationDescription_referenceDataSourceDescriptions :: Lens.Lens' SqlApplicationConfigurationDescription (Prelude.Maybe [ReferenceDataSourceDescription])
sqlApplicationConfigurationDescription_referenceDataSourceDescriptions :: (Maybe [ReferenceDataSourceDescription]
 -> f (Maybe [ReferenceDataSourceDescription]))
-> SqlApplicationConfigurationDescription
-> f SqlApplicationConfigurationDescription
sqlApplicationConfigurationDescription_referenceDataSourceDescriptions = (SqlApplicationConfigurationDescription
 -> Maybe [ReferenceDataSourceDescription])
-> (SqlApplicationConfigurationDescription
    -> Maybe [ReferenceDataSourceDescription]
    -> SqlApplicationConfigurationDescription)
-> Lens
     SqlApplicationConfigurationDescription
     SqlApplicationConfigurationDescription
     (Maybe [ReferenceDataSourceDescription])
     (Maybe [ReferenceDataSourceDescription])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SqlApplicationConfigurationDescription' {Maybe [ReferenceDataSourceDescription]
referenceDataSourceDescriptions :: Maybe [ReferenceDataSourceDescription]
$sel:referenceDataSourceDescriptions:SqlApplicationConfigurationDescription' :: SqlApplicationConfigurationDescription
-> Maybe [ReferenceDataSourceDescription]
referenceDataSourceDescriptions} -> Maybe [ReferenceDataSourceDescription]
referenceDataSourceDescriptions) (\s :: SqlApplicationConfigurationDescription
s@SqlApplicationConfigurationDescription' {} Maybe [ReferenceDataSourceDescription]
a -> SqlApplicationConfigurationDescription
s {$sel:referenceDataSourceDescriptions:SqlApplicationConfigurationDescription' :: Maybe [ReferenceDataSourceDescription]
referenceDataSourceDescriptions = Maybe [ReferenceDataSourceDescription]
a} :: SqlApplicationConfigurationDescription) ((Maybe [ReferenceDataSourceDescription]
  -> f (Maybe [ReferenceDataSourceDescription]))
 -> SqlApplicationConfigurationDescription
 -> f SqlApplicationConfigurationDescription)
-> ((Maybe [ReferenceDataSourceDescription]
     -> f (Maybe [ReferenceDataSourceDescription]))
    -> Maybe [ReferenceDataSourceDescription]
    -> f (Maybe [ReferenceDataSourceDescription]))
-> (Maybe [ReferenceDataSourceDescription]
    -> f (Maybe [ReferenceDataSourceDescription]))
-> SqlApplicationConfigurationDescription
-> f SqlApplicationConfigurationDescription
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ReferenceDataSourceDescription]
  [ReferenceDataSourceDescription]
  [ReferenceDataSourceDescription]
  [ReferenceDataSourceDescription]
-> Iso
     (Maybe [ReferenceDataSourceDescription])
     (Maybe [ReferenceDataSourceDescription])
     (Maybe [ReferenceDataSourceDescription])
     (Maybe [ReferenceDataSourceDescription])
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
  [ReferenceDataSourceDescription]
  [ReferenceDataSourceDescription]
  [ReferenceDataSourceDescription]
  [ReferenceDataSourceDescription]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The array of InputDescription objects describing the input streams used
-- by the application.
sqlApplicationConfigurationDescription_inputDescriptions :: Lens.Lens' SqlApplicationConfigurationDescription (Prelude.Maybe [InputDescription])
sqlApplicationConfigurationDescription_inputDescriptions :: (Maybe [InputDescription] -> f (Maybe [InputDescription]))
-> SqlApplicationConfigurationDescription
-> f SqlApplicationConfigurationDescription
sqlApplicationConfigurationDescription_inputDescriptions = (SqlApplicationConfigurationDescription
 -> Maybe [InputDescription])
-> (SqlApplicationConfigurationDescription
    -> Maybe [InputDescription]
    -> SqlApplicationConfigurationDescription)
-> Lens
     SqlApplicationConfigurationDescription
     SqlApplicationConfigurationDescription
     (Maybe [InputDescription])
     (Maybe [InputDescription])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SqlApplicationConfigurationDescription' {Maybe [InputDescription]
inputDescriptions :: Maybe [InputDescription]
$sel:inputDescriptions:SqlApplicationConfigurationDescription' :: SqlApplicationConfigurationDescription -> Maybe [InputDescription]
inputDescriptions} -> Maybe [InputDescription]
inputDescriptions) (\s :: SqlApplicationConfigurationDescription
s@SqlApplicationConfigurationDescription' {} Maybe [InputDescription]
a -> SqlApplicationConfigurationDescription
s {$sel:inputDescriptions:SqlApplicationConfigurationDescription' :: Maybe [InputDescription]
inputDescriptions = Maybe [InputDescription]
a} :: SqlApplicationConfigurationDescription) ((Maybe [InputDescription] -> f (Maybe [InputDescription]))
 -> SqlApplicationConfigurationDescription
 -> f SqlApplicationConfigurationDescription)
-> ((Maybe [InputDescription] -> f (Maybe [InputDescription]))
    -> Maybe [InputDescription] -> f (Maybe [InputDescription]))
-> (Maybe [InputDescription] -> f (Maybe [InputDescription]))
-> SqlApplicationConfigurationDescription
-> f SqlApplicationConfigurationDescription
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [InputDescription]
  [InputDescription]
  [InputDescription]
  [InputDescription]
-> Iso
     (Maybe [InputDescription])
     (Maybe [InputDescription])
     (Maybe [InputDescription])
     (Maybe [InputDescription])
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
  [InputDescription]
  [InputDescription]
  [InputDescription]
  [InputDescription]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance
  Core.FromJSON
    SqlApplicationConfigurationDescription
  where
  parseJSON :: Value -> Parser SqlApplicationConfigurationDescription
parseJSON =
    String
-> (Object -> Parser SqlApplicationConfigurationDescription)
-> Value
-> Parser SqlApplicationConfigurationDescription
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"SqlApplicationConfigurationDescription"
      ( \Object
x ->
          Maybe [OutputDescription]
-> Maybe [ReferenceDataSourceDescription]
-> Maybe [InputDescription]
-> SqlApplicationConfigurationDescription
SqlApplicationConfigurationDescription'
            (Maybe [OutputDescription]
 -> Maybe [ReferenceDataSourceDescription]
 -> Maybe [InputDescription]
 -> SqlApplicationConfigurationDescription)
-> Parser (Maybe [OutputDescription])
-> Parser
     (Maybe [ReferenceDataSourceDescription]
      -> Maybe [InputDescription]
      -> SqlApplicationConfigurationDescription)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object -> Text -> Parser (Maybe (Maybe [OutputDescription]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"OutputDescriptions"
                            Parser (Maybe (Maybe [OutputDescription]))
-> Maybe [OutputDescription] -> Parser (Maybe [OutputDescription])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [OutputDescription]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser
  (Maybe [ReferenceDataSourceDescription]
   -> Maybe [InputDescription]
   -> SqlApplicationConfigurationDescription)
-> Parser (Maybe [ReferenceDataSourceDescription])
-> Parser
     (Maybe [InputDescription]
      -> SqlApplicationConfigurationDescription)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object
-> Text -> Parser (Maybe (Maybe [ReferenceDataSourceDescription]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ReferenceDataSourceDescriptions"
                            Parser (Maybe (Maybe [ReferenceDataSourceDescription]))
-> Maybe [ReferenceDataSourceDescription]
-> Parser (Maybe [ReferenceDataSourceDescription])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [ReferenceDataSourceDescription]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser
  (Maybe [InputDescription]
   -> SqlApplicationConfigurationDescription)
-> Parser (Maybe [InputDescription])
-> Parser SqlApplicationConfigurationDescription
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe [InputDescription]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"InputDescriptions"
                            Parser (Maybe (Maybe [InputDescription]))
-> Maybe [InputDescription] -> Parser (Maybe [InputDescription])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [InputDescription]
forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance
  Prelude.Hashable
    SqlApplicationConfigurationDescription

instance
  Prelude.NFData
    SqlApplicationConfigurationDescription