{-# 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.ApplicationCodeConfigurationDescription
-- 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.ApplicationCodeConfigurationDescription 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.CodeContentDescription
import Amazonka.KinesisAnalyticsV2.Types.CodeContentType
import qualified Amazonka.Prelude as Prelude

-- | Describes code configuration for an application.
--
-- /See:/ 'newApplicationCodeConfigurationDescription' smart constructor.
data ApplicationCodeConfigurationDescription = ApplicationCodeConfigurationDescription'
  { -- | Describes details about the location and format of the application code.
    ApplicationCodeConfigurationDescription
-> Maybe CodeContentDescription
codeContentDescription :: Prelude.Maybe CodeContentDescription,
    -- | Specifies whether the code content is in text or zip format.
    ApplicationCodeConfigurationDescription -> CodeContentType
codeContentType :: CodeContentType
  }
  deriving (ApplicationCodeConfigurationDescription
-> ApplicationCodeConfigurationDescription -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ApplicationCodeConfigurationDescription
-> ApplicationCodeConfigurationDescription -> Bool
$c/= :: ApplicationCodeConfigurationDescription
-> ApplicationCodeConfigurationDescription -> Bool
== :: ApplicationCodeConfigurationDescription
-> ApplicationCodeConfigurationDescription -> Bool
$c== :: ApplicationCodeConfigurationDescription
-> ApplicationCodeConfigurationDescription -> Bool
Prelude.Eq, ReadPrec [ApplicationCodeConfigurationDescription]
ReadPrec ApplicationCodeConfigurationDescription
Int -> ReadS ApplicationCodeConfigurationDescription
ReadS [ApplicationCodeConfigurationDescription]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ApplicationCodeConfigurationDescription]
$creadListPrec :: ReadPrec [ApplicationCodeConfigurationDescription]
readPrec :: ReadPrec ApplicationCodeConfigurationDescription
$creadPrec :: ReadPrec ApplicationCodeConfigurationDescription
readList :: ReadS [ApplicationCodeConfigurationDescription]
$creadList :: ReadS [ApplicationCodeConfigurationDescription]
readsPrec :: Int -> ReadS ApplicationCodeConfigurationDescription
$creadsPrec :: Int -> ReadS ApplicationCodeConfigurationDescription
Prelude.Read, Int -> ApplicationCodeConfigurationDescription -> ShowS
[ApplicationCodeConfigurationDescription] -> ShowS
ApplicationCodeConfigurationDescription -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ApplicationCodeConfigurationDescription] -> ShowS
$cshowList :: [ApplicationCodeConfigurationDescription] -> ShowS
show :: ApplicationCodeConfigurationDescription -> String
$cshow :: ApplicationCodeConfigurationDescription -> String
showsPrec :: Int -> ApplicationCodeConfigurationDescription -> ShowS
$cshowsPrec :: Int -> ApplicationCodeConfigurationDescription -> ShowS
Prelude.Show, forall x.
Rep ApplicationCodeConfigurationDescription x
-> ApplicationCodeConfigurationDescription
forall x.
ApplicationCodeConfigurationDescription
-> Rep ApplicationCodeConfigurationDescription x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ApplicationCodeConfigurationDescription x
-> ApplicationCodeConfigurationDescription
$cfrom :: forall x.
ApplicationCodeConfigurationDescription
-> Rep ApplicationCodeConfigurationDescription x
Prelude.Generic)

-- |
-- Create a value of 'ApplicationCodeConfigurationDescription' 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:
--
-- 'codeContentDescription', 'applicationCodeConfigurationDescription_codeContentDescription' - Describes details about the location and format of the application code.
--
-- 'codeContentType', 'applicationCodeConfigurationDescription_codeContentType' - Specifies whether the code content is in text or zip format.
newApplicationCodeConfigurationDescription ::
  -- | 'codeContentType'
  CodeContentType ->
  ApplicationCodeConfigurationDescription
newApplicationCodeConfigurationDescription :: CodeContentType -> ApplicationCodeConfigurationDescription
newApplicationCodeConfigurationDescription
  CodeContentType
pCodeContentType_ =
    ApplicationCodeConfigurationDescription'
      { $sel:codeContentDescription:ApplicationCodeConfigurationDescription' :: Maybe CodeContentDescription
codeContentDescription =
          forall a. Maybe a
Prelude.Nothing,
        $sel:codeContentType:ApplicationCodeConfigurationDescription' :: CodeContentType
codeContentType =
          CodeContentType
pCodeContentType_
      }

-- | Describes details about the location and format of the application code.
applicationCodeConfigurationDescription_codeContentDescription :: Lens.Lens' ApplicationCodeConfigurationDescription (Prelude.Maybe CodeContentDescription)
applicationCodeConfigurationDescription_codeContentDescription :: Lens'
  ApplicationCodeConfigurationDescription
  (Maybe CodeContentDescription)
applicationCodeConfigurationDescription_codeContentDescription = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ApplicationCodeConfigurationDescription' {Maybe CodeContentDescription
codeContentDescription :: Maybe CodeContentDescription
$sel:codeContentDescription:ApplicationCodeConfigurationDescription' :: ApplicationCodeConfigurationDescription
-> Maybe CodeContentDescription
codeContentDescription} -> Maybe CodeContentDescription
codeContentDescription) (\s :: ApplicationCodeConfigurationDescription
s@ApplicationCodeConfigurationDescription' {} Maybe CodeContentDescription
a -> ApplicationCodeConfigurationDescription
s {$sel:codeContentDescription:ApplicationCodeConfigurationDescription' :: Maybe CodeContentDescription
codeContentDescription = Maybe CodeContentDescription
a} :: ApplicationCodeConfigurationDescription)

-- | Specifies whether the code content is in text or zip format.
applicationCodeConfigurationDescription_codeContentType :: Lens.Lens' ApplicationCodeConfigurationDescription CodeContentType
applicationCodeConfigurationDescription_codeContentType :: Lens' ApplicationCodeConfigurationDescription CodeContentType
applicationCodeConfigurationDescription_codeContentType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ApplicationCodeConfigurationDescription' {CodeContentType
codeContentType :: CodeContentType
$sel:codeContentType:ApplicationCodeConfigurationDescription' :: ApplicationCodeConfigurationDescription -> CodeContentType
codeContentType} -> CodeContentType
codeContentType) (\s :: ApplicationCodeConfigurationDescription
s@ApplicationCodeConfigurationDescription' {} CodeContentType
a -> ApplicationCodeConfigurationDescription
s {$sel:codeContentType:ApplicationCodeConfigurationDescription' :: CodeContentType
codeContentType = CodeContentType
a} :: ApplicationCodeConfigurationDescription)

instance
  Data.FromJSON
    ApplicationCodeConfigurationDescription
  where
  parseJSON :: Value -> Parser ApplicationCodeConfigurationDescription
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ApplicationCodeConfigurationDescription"
      ( \Object
x ->
          Maybe CodeContentDescription
-> CodeContentType -> ApplicationCodeConfigurationDescription
ApplicationCodeConfigurationDescription'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"CodeContentDescription")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"CodeContentType")
      )

instance
  Prelude.Hashable
    ApplicationCodeConfigurationDescription
  where
  hashWithSalt :: Int -> ApplicationCodeConfigurationDescription -> Int
hashWithSalt
    Int
_salt
    ApplicationCodeConfigurationDescription' {Maybe CodeContentDescription
CodeContentType
codeContentType :: CodeContentType
codeContentDescription :: Maybe CodeContentDescription
$sel:codeContentType:ApplicationCodeConfigurationDescription' :: ApplicationCodeConfigurationDescription -> CodeContentType
$sel:codeContentDescription:ApplicationCodeConfigurationDescription' :: ApplicationCodeConfigurationDescription
-> Maybe CodeContentDescription
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe CodeContentDescription
codeContentDescription
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` CodeContentType
codeContentType

instance
  Prelude.NFData
    ApplicationCodeConfigurationDescription
  where
  rnf :: ApplicationCodeConfigurationDescription -> ()
rnf ApplicationCodeConfigurationDescription' {Maybe CodeContentDescription
CodeContentType
codeContentType :: CodeContentType
codeContentDescription :: Maybe CodeContentDescription
$sel:codeContentType:ApplicationCodeConfigurationDescription' :: ApplicationCodeConfigurationDescription -> CodeContentType
$sel:codeContentDescription:ApplicationCodeConfigurationDescription' :: ApplicationCodeConfigurationDescription
-> Maybe CodeContentDescription
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe CodeContentDescription
codeContentDescription
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf CodeContentType
codeContentType