{-# 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.CodeContentUpdate
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.KinesisAnalyticsV2.Types.CodeContentUpdate where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.KinesisAnalyticsV2.Types.S3ContentLocationUpdate
import qualified Amazonka.Prelude as Prelude

-- | Describes an update to the code of an application. Not supported for
-- Apache Zeppelin.
--
-- /See:/ 'newCodeContentUpdate' smart constructor.
data CodeContentUpdate = CodeContentUpdate'
  { -- | Describes an update to the location of code for an application.
    CodeContentUpdate -> Maybe S3ContentLocationUpdate
s3ContentLocationUpdate :: Prelude.Maybe S3ContentLocationUpdate,
    -- | Describes an update to the text code for an application.
    CodeContentUpdate -> Maybe Text
textContentUpdate :: Prelude.Maybe Prelude.Text,
    -- | Describes an update to the zipped code for an application.
    CodeContentUpdate -> Maybe Base64
zipFileContentUpdate :: Prelude.Maybe Data.Base64
  }
  deriving (CodeContentUpdate -> CodeContentUpdate -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CodeContentUpdate -> CodeContentUpdate -> Bool
$c/= :: CodeContentUpdate -> CodeContentUpdate -> Bool
== :: CodeContentUpdate -> CodeContentUpdate -> Bool
$c== :: CodeContentUpdate -> CodeContentUpdate -> Bool
Prelude.Eq, ReadPrec [CodeContentUpdate]
ReadPrec CodeContentUpdate
Int -> ReadS CodeContentUpdate
ReadS [CodeContentUpdate]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CodeContentUpdate]
$creadListPrec :: ReadPrec [CodeContentUpdate]
readPrec :: ReadPrec CodeContentUpdate
$creadPrec :: ReadPrec CodeContentUpdate
readList :: ReadS [CodeContentUpdate]
$creadList :: ReadS [CodeContentUpdate]
readsPrec :: Int -> ReadS CodeContentUpdate
$creadsPrec :: Int -> ReadS CodeContentUpdate
Prelude.Read, Int -> CodeContentUpdate -> ShowS
[CodeContentUpdate] -> ShowS
CodeContentUpdate -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CodeContentUpdate] -> ShowS
$cshowList :: [CodeContentUpdate] -> ShowS
show :: CodeContentUpdate -> String
$cshow :: CodeContentUpdate -> String
showsPrec :: Int -> CodeContentUpdate -> ShowS
$cshowsPrec :: Int -> CodeContentUpdate -> ShowS
Prelude.Show, forall x. Rep CodeContentUpdate x -> CodeContentUpdate
forall x. CodeContentUpdate -> Rep CodeContentUpdate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CodeContentUpdate x -> CodeContentUpdate
$cfrom :: forall x. CodeContentUpdate -> Rep CodeContentUpdate x
Prelude.Generic)

-- |
-- Create a value of 'CodeContentUpdate' 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:
--
-- 's3ContentLocationUpdate', 'codeContentUpdate_s3ContentLocationUpdate' - Describes an update to the location of code for an application.
--
-- 'textContentUpdate', 'codeContentUpdate_textContentUpdate' - Describes an update to the text code for an application.
--
-- 'zipFileContentUpdate', 'codeContentUpdate_zipFileContentUpdate' - Describes an update to the zipped code for an application.--
-- -- /Note:/ This 'Lens' automatically encodes and decodes Base64 data.
-- -- The underlying isomorphism will encode to Base64 representation during
-- -- serialisation, and decode from Base64 representation during deserialisation.
-- -- This 'Lens' accepts and returns only raw unencoded data.
newCodeContentUpdate ::
  CodeContentUpdate
newCodeContentUpdate :: CodeContentUpdate
newCodeContentUpdate =
  CodeContentUpdate'
    { $sel:s3ContentLocationUpdate:CodeContentUpdate' :: Maybe S3ContentLocationUpdate
s3ContentLocationUpdate =
        forall a. Maybe a
Prelude.Nothing,
      $sel:textContentUpdate:CodeContentUpdate' :: Maybe Text
textContentUpdate = forall a. Maybe a
Prelude.Nothing,
      $sel:zipFileContentUpdate:CodeContentUpdate' :: Maybe Base64
zipFileContentUpdate = forall a. Maybe a
Prelude.Nothing
    }

-- | Describes an update to the location of code for an application.
codeContentUpdate_s3ContentLocationUpdate :: Lens.Lens' CodeContentUpdate (Prelude.Maybe S3ContentLocationUpdate)
codeContentUpdate_s3ContentLocationUpdate :: Lens' CodeContentUpdate (Maybe S3ContentLocationUpdate)
codeContentUpdate_s3ContentLocationUpdate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CodeContentUpdate' {Maybe S3ContentLocationUpdate
s3ContentLocationUpdate :: Maybe S3ContentLocationUpdate
$sel:s3ContentLocationUpdate:CodeContentUpdate' :: CodeContentUpdate -> Maybe S3ContentLocationUpdate
s3ContentLocationUpdate} -> Maybe S3ContentLocationUpdate
s3ContentLocationUpdate) (\s :: CodeContentUpdate
s@CodeContentUpdate' {} Maybe S3ContentLocationUpdate
a -> CodeContentUpdate
s {$sel:s3ContentLocationUpdate:CodeContentUpdate' :: Maybe S3ContentLocationUpdate
s3ContentLocationUpdate = Maybe S3ContentLocationUpdate
a} :: CodeContentUpdate)

-- | Describes an update to the text code for an application.
codeContentUpdate_textContentUpdate :: Lens.Lens' CodeContentUpdate (Prelude.Maybe Prelude.Text)
codeContentUpdate_textContentUpdate :: Lens' CodeContentUpdate (Maybe Text)
codeContentUpdate_textContentUpdate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CodeContentUpdate' {Maybe Text
textContentUpdate :: Maybe Text
$sel:textContentUpdate:CodeContentUpdate' :: CodeContentUpdate -> Maybe Text
textContentUpdate} -> Maybe Text
textContentUpdate) (\s :: CodeContentUpdate
s@CodeContentUpdate' {} Maybe Text
a -> CodeContentUpdate
s {$sel:textContentUpdate:CodeContentUpdate' :: Maybe Text
textContentUpdate = Maybe Text
a} :: CodeContentUpdate)

-- | Describes an update to the zipped code for an application.--
-- -- /Note:/ This 'Lens' automatically encodes and decodes Base64 data.
-- -- The underlying isomorphism will encode to Base64 representation during
-- -- serialisation, and decode from Base64 representation during deserialisation.
-- -- This 'Lens' accepts and returns only raw unencoded data.
codeContentUpdate_zipFileContentUpdate :: Lens.Lens' CodeContentUpdate (Prelude.Maybe Prelude.ByteString)
codeContentUpdate_zipFileContentUpdate :: Lens' CodeContentUpdate (Maybe ByteString)
codeContentUpdate_zipFileContentUpdate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CodeContentUpdate' {Maybe Base64
zipFileContentUpdate :: Maybe Base64
$sel:zipFileContentUpdate:CodeContentUpdate' :: CodeContentUpdate -> Maybe Base64
zipFileContentUpdate} -> Maybe Base64
zipFileContentUpdate) (\s :: CodeContentUpdate
s@CodeContentUpdate' {} Maybe Base64
a -> CodeContentUpdate
s {$sel:zipFileContentUpdate:CodeContentUpdate' :: Maybe Base64
zipFileContentUpdate = Maybe Base64
a} :: CodeContentUpdate) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 Iso' Base64 ByteString
Data._Base64

instance Prelude.Hashable CodeContentUpdate where
  hashWithSalt :: Int -> CodeContentUpdate -> Int
hashWithSalt Int
_salt CodeContentUpdate' {Maybe Text
Maybe Base64
Maybe S3ContentLocationUpdate
zipFileContentUpdate :: Maybe Base64
textContentUpdate :: Maybe Text
s3ContentLocationUpdate :: Maybe S3ContentLocationUpdate
$sel:zipFileContentUpdate:CodeContentUpdate' :: CodeContentUpdate -> Maybe Base64
$sel:textContentUpdate:CodeContentUpdate' :: CodeContentUpdate -> Maybe Text
$sel:s3ContentLocationUpdate:CodeContentUpdate' :: CodeContentUpdate -> Maybe S3ContentLocationUpdate
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe S3ContentLocationUpdate
s3ContentLocationUpdate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
textContentUpdate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Base64
zipFileContentUpdate

instance Prelude.NFData CodeContentUpdate where
  rnf :: CodeContentUpdate -> ()
rnf CodeContentUpdate' {Maybe Text
Maybe Base64
Maybe S3ContentLocationUpdate
zipFileContentUpdate :: Maybe Base64
textContentUpdate :: Maybe Text
s3ContentLocationUpdate :: Maybe S3ContentLocationUpdate
$sel:zipFileContentUpdate:CodeContentUpdate' :: CodeContentUpdate -> Maybe Base64
$sel:textContentUpdate:CodeContentUpdate' :: CodeContentUpdate -> Maybe Text
$sel:s3ContentLocationUpdate:CodeContentUpdate' :: CodeContentUpdate -> Maybe S3ContentLocationUpdate
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe S3ContentLocationUpdate
s3ContentLocationUpdate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
textContentUpdate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Base64
zipFileContentUpdate

instance Data.ToJSON CodeContentUpdate where
  toJSON :: CodeContentUpdate -> Value
toJSON CodeContentUpdate' {Maybe Text
Maybe Base64
Maybe S3ContentLocationUpdate
zipFileContentUpdate :: Maybe Base64
textContentUpdate :: Maybe Text
s3ContentLocationUpdate :: Maybe S3ContentLocationUpdate
$sel:zipFileContentUpdate:CodeContentUpdate' :: CodeContentUpdate -> Maybe Base64
$sel:textContentUpdate:CodeContentUpdate' :: CodeContentUpdate -> Maybe Text
$sel:s3ContentLocationUpdate:CodeContentUpdate' :: CodeContentUpdate -> Maybe S3ContentLocationUpdate
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"S3ContentLocationUpdate" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe S3ContentLocationUpdate
s3ContentLocationUpdate,
            (Key
"TextContentUpdate" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
textContentUpdate,
            (Key
"ZipFileContentUpdate" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Base64
zipFileContentUpdate
          ]
      )