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

import qualified Amazonka.Core as Core
import Amazonka.KinesisAnalyticsV2.Types.CodeContentType
import Amazonka.KinesisAnalyticsV2.Types.CodeContentUpdate
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Describes code configuration updates for an application. This is
-- supported for a Flink-based Kinesis Data Analytics application or a
-- SQL-based Kinesis Data Analytics application.
--
-- /See:/ 'newApplicationCodeConfigurationUpdate' smart constructor.
data ApplicationCodeConfigurationUpdate = ApplicationCodeConfigurationUpdate'
  { -- | Describes updates to the code content type.
    ApplicationCodeConfigurationUpdate -> Maybe CodeContentType
codeContentTypeUpdate :: Prelude.Maybe CodeContentType,
    -- | Describes updates to the code content of an application.
    ApplicationCodeConfigurationUpdate -> Maybe CodeContentUpdate
codeContentUpdate :: Prelude.Maybe CodeContentUpdate
  }
  deriving (ApplicationCodeConfigurationUpdate
-> ApplicationCodeConfigurationUpdate -> Bool
(ApplicationCodeConfigurationUpdate
 -> ApplicationCodeConfigurationUpdate -> Bool)
-> (ApplicationCodeConfigurationUpdate
    -> ApplicationCodeConfigurationUpdate -> Bool)
-> Eq ApplicationCodeConfigurationUpdate
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ApplicationCodeConfigurationUpdate
-> ApplicationCodeConfigurationUpdate -> Bool
$c/= :: ApplicationCodeConfigurationUpdate
-> ApplicationCodeConfigurationUpdate -> Bool
== :: ApplicationCodeConfigurationUpdate
-> ApplicationCodeConfigurationUpdate -> Bool
$c== :: ApplicationCodeConfigurationUpdate
-> ApplicationCodeConfigurationUpdate -> Bool
Prelude.Eq, ReadPrec [ApplicationCodeConfigurationUpdate]
ReadPrec ApplicationCodeConfigurationUpdate
Int -> ReadS ApplicationCodeConfigurationUpdate
ReadS [ApplicationCodeConfigurationUpdate]
(Int -> ReadS ApplicationCodeConfigurationUpdate)
-> ReadS [ApplicationCodeConfigurationUpdate]
-> ReadPrec ApplicationCodeConfigurationUpdate
-> ReadPrec [ApplicationCodeConfigurationUpdate]
-> Read ApplicationCodeConfigurationUpdate
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ApplicationCodeConfigurationUpdate]
$creadListPrec :: ReadPrec [ApplicationCodeConfigurationUpdate]
readPrec :: ReadPrec ApplicationCodeConfigurationUpdate
$creadPrec :: ReadPrec ApplicationCodeConfigurationUpdate
readList :: ReadS [ApplicationCodeConfigurationUpdate]
$creadList :: ReadS [ApplicationCodeConfigurationUpdate]
readsPrec :: Int -> ReadS ApplicationCodeConfigurationUpdate
$creadsPrec :: Int -> ReadS ApplicationCodeConfigurationUpdate
Prelude.Read, Int -> ApplicationCodeConfigurationUpdate -> ShowS
[ApplicationCodeConfigurationUpdate] -> ShowS
ApplicationCodeConfigurationUpdate -> String
(Int -> ApplicationCodeConfigurationUpdate -> ShowS)
-> (ApplicationCodeConfigurationUpdate -> String)
-> ([ApplicationCodeConfigurationUpdate] -> ShowS)
-> Show ApplicationCodeConfigurationUpdate
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ApplicationCodeConfigurationUpdate] -> ShowS
$cshowList :: [ApplicationCodeConfigurationUpdate] -> ShowS
show :: ApplicationCodeConfigurationUpdate -> String
$cshow :: ApplicationCodeConfigurationUpdate -> String
showsPrec :: Int -> ApplicationCodeConfigurationUpdate -> ShowS
$cshowsPrec :: Int -> ApplicationCodeConfigurationUpdate -> ShowS
Prelude.Show, (forall x.
 ApplicationCodeConfigurationUpdate
 -> Rep ApplicationCodeConfigurationUpdate x)
-> (forall x.
    Rep ApplicationCodeConfigurationUpdate x
    -> ApplicationCodeConfigurationUpdate)
-> Generic ApplicationCodeConfigurationUpdate
forall x.
Rep ApplicationCodeConfigurationUpdate x
-> ApplicationCodeConfigurationUpdate
forall x.
ApplicationCodeConfigurationUpdate
-> Rep ApplicationCodeConfigurationUpdate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ApplicationCodeConfigurationUpdate x
-> ApplicationCodeConfigurationUpdate
$cfrom :: forall x.
ApplicationCodeConfigurationUpdate
-> Rep ApplicationCodeConfigurationUpdate x
Prelude.Generic)

-- |
-- Create a value of 'ApplicationCodeConfigurationUpdate' 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:
--
-- 'codeContentTypeUpdate', 'applicationCodeConfigurationUpdate_codeContentTypeUpdate' - Describes updates to the code content type.
--
-- 'codeContentUpdate', 'applicationCodeConfigurationUpdate_codeContentUpdate' - Describes updates to the code content of an application.
newApplicationCodeConfigurationUpdate ::
  ApplicationCodeConfigurationUpdate
newApplicationCodeConfigurationUpdate :: ApplicationCodeConfigurationUpdate
newApplicationCodeConfigurationUpdate =
  ApplicationCodeConfigurationUpdate' :: Maybe CodeContentType
-> Maybe CodeContentUpdate -> ApplicationCodeConfigurationUpdate
ApplicationCodeConfigurationUpdate'
    { $sel:codeContentTypeUpdate:ApplicationCodeConfigurationUpdate' :: Maybe CodeContentType
codeContentTypeUpdate =
        Maybe CodeContentType
forall a. Maybe a
Prelude.Nothing,
      $sel:codeContentUpdate:ApplicationCodeConfigurationUpdate' :: Maybe CodeContentUpdate
codeContentUpdate = Maybe CodeContentUpdate
forall a. Maybe a
Prelude.Nothing
    }

-- | Describes updates to the code content type.
applicationCodeConfigurationUpdate_codeContentTypeUpdate :: Lens.Lens' ApplicationCodeConfigurationUpdate (Prelude.Maybe CodeContentType)
applicationCodeConfigurationUpdate_codeContentTypeUpdate :: (Maybe CodeContentType -> f (Maybe CodeContentType))
-> ApplicationCodeConfigurationUpdate
-> f ApplicationCodeConfigurationUpdate
applicationCodeConfigurationUpdate_codeContentTypeUpdate = (ApplicationCodeConfigurationUpdate -> Maybe CodeContentType)
-> (ApplicationCodeConfigurationUpdate
    -> Maybe CodeContentType -> ApplicationCodeConfigurationUpdate)
-> Lens
     ApplicationCodeConfigurationUpdate
     ApplicationCodeConfigurationUpdate
     (Maybe CodeContentType)
     (Maybe CodeContentType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ApplicationCodeConfigurationUpdate' {Maybe CodeContentType
codeContentTypeUpdate :: Maybe CodeContentType
$sel:codeContentTypeUpdate:ApplicationCodeConfigurationUpdate' :: ApplicationCodeConfigurationUpdate -> Maybe CodeContentType
codeContentTypeUpdate} -> Maybe CodeContentType
codeContentTypeUpdate) (\s :: ApplicationCodeConfigurationUpdate
s@ApplicationCodeConfigurationUpdate' {} Maybe CodeContentType
a -> ApplicationCodeConfigurationUpdate
s {$sel:codeContentTypeUpdate:ApplicationCodeConfigurationUpdate' :: Maybe CodeContentType
codeContentTypeUpdate = Maybe CodeContentType
a} :: ApplicationCodeConfigurationUpdate)

-- | Describes updates to the code content of an application.
applicationCodeConfigurationUpdate_codeContentUpdate :: Lens.Lens' ApplicationCodeConfigurationUpdate (Prelude.Maybe CodeContentUpdate)
applicationCodeConfigurationUpdate_codeContentUpdate :: (Maybe CodeContentUpdate -> f (Maybe CodeContentUpdate))
-> ApplicationCodeConfigurationUpdate
-> f ApplicationCodeConfigurationUpdate
applicationCodeConfigurationUpdate_codeContentUpdate = (ApplicationCodeConfigurationUpdate -> Maybe CodeContentUpdate)
-> (ApplicationCodeConfigurationUpdate
    -> Maybe CodeContentUpdate -> ApplicationCodeConfigurationUpdate)
-> Lens
     ApplicationCodeConfigurationUpdate
     ApplicationCodeConfigurationUpdate
     (Maybe CodeContentUpdate)
     (Maybe CodeContentUpdate)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ApplicationCodeConfigurationUpdate' {Maybe CodeContentUpdate
codeContentUpdate :: Maybe CodeContentUpdate
$sel:codeContentUpdate:ApplicationCodeConfigurationUpdate' :: ApplicationCodeConfigurationUpdate -> Maybe CodeContentUpdate
codeContentUpdate} -> Maybe CodeContentUpdate
codeContentUpdate) (\s :: ApplicationCodeConfigurationUpdate
s@ApplicationCodeConfigurationUpdate' {} Maybe CodeContentUpdate
a -> ApplicationCodeConfigurationUpdate
s {$sel:codeContentUpdate:ApplicationCodeConfigurationUpdate' :: Maybe CodeContentUpdate
codeContentUpdate = Maybe CodeContentUpdate
a} :: ApplicationCodeConfigurationUpdate)

instance
  Prelude.Hashable
    ApplicationCodeConfigurationUpdate

instance
  Prelude.NFData
    ApplicationCodeConfigurationUpdate

instance
  Core.ToJSON
    ApplicationCodeConfigurationUpdate
  where
  toJSON :: ApplicationCodeConfigurationUpdate -> Value
toJSON ApplicationCodeConfigurationUpdate' {Maybe CodeContentType
Maybe CodeContentUpdate
codeContentUpdate :: Maybe CodeContentUpdate
codeContentTypeUpdate :: Maybe CodeContentType
$sel:codeContentUpdate:ApplicationCodeConfigurationUpdate' :: ApplicationCodeConfigurationUpdate -> Maybe CodeContentUpdate
$sel:codeContentTypeUpdate:ApplicationCodeConfigurationUpdate' :: ApplicationCodeConfigurationUpdate -> Maybe CodeContentType
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"CodeContentTypeUpdate" Text -> CodeContentType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (CodeContentType -> Pair) -> Maybe CodeContentType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe CodeContentType
codeContentTypeUpdate,
            (Text
"CodeContentUpdate" Text -> CodeContentUpdate -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (CodeContentUpdate -> Pair)
-> Maybe CodeContentUpdate -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe CodeContentUpdate
codeContentUpdate
          ]
      )