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

import qualified Amazonka.Core as Core
import Amazonka.KinesisAnalyticsV2.Types.CodeContentDescription
import Amazonka.KinesisAnalyticsV2.Types.CodeContentType
import qualified Amazonka.Lens as Lens
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
(ApplicationCodeConfigurationDescription
 -> ApplicationCodeConfigurationDescription -> Bool)
-> (ApplicationCodeConfigurationDescription
    -> ApplicationCodeConfigurationDescription -> Bool)
-> Eq ApplicationCodeConfigurationDescription
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]
(Int -> ReadS ApplicationCodeConfigurationDescription)
-> ReadS [ApplicationCodeConfigurationDescription]
-> ReadPrec ApplicationCodeConfigurationDescription
-> ReadPrec [ApplicationCodeConfigurationDescription]
-> Read 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
(Int -> ApplicationCodeConfigurationDescription -> ShowS)
-> (ApplicationCodeConfigurationDescription -> String)
-> ([ApplicationCodeConfigurationDescription] -> ShowS)
-> Show ApplicationCodeConfigurationDescription
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.
 ApplicationCodeConfigurationDescription
 -> Rep ApplicationCodeConfigurationDescription x)
-> (forall x.
    Rep ApplicationCodeConfigurationDescription x
    -> ApplicationCodeConfigurationDescription)
-> Generic ApplicationCodeConfigurationDescription
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' :: Maybe CodeContentDescription
-> CodeContentType -> ApplicationCodeConfigurationDescription
ApplicationCodeConfigurationDescription'
      { $sel:codeContentDescription:ApplicationCodeConfigurationDescription' :: Maybe CodeContentDescription
codeContentDescription =
          Maybe 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 :: (Maybe CodeContentDescription -> f (Maybe CodeContentDescription))
-> ApplicationCodeConfigurationDescription
-> f ApplicationCodeConfigurationDescription
applicationCodeConfigurationDescription_codeContentDescription = (ApplicationCodeConfigurationDescription
 -> Maybe CodeContentDescription)
-> (ApplicationCodeConfigurationDescription
    -> Maybe CodeContentDescription
    -> ApplicationCodeConfigurationDescription)
-> Lens
     ApplicationCodeConfigurationDescription
     ApplicationCodeConfigurationDescription
     (Maybe CodeContentDescription)
     (Maybe 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 :: (CodeContentType -> f CodeContentType)
-> ApplicationCodeConfigurationDescription
-> f ApplicationCodeConfigurationDescription
applicationCodeConfigurationDescription_codeContentType = (ApplicationCodeConfigurationDescription -> CodeContentType)
-> (ApplicationCodeConfigurationDescription
    -> CodeContentType -> ApplicationCodeConfigurationDescription)
-> Lens
     ApplicationCodeConfigurationDescription
     ApplicationCodeConfigurationDescription
     CodeContentType
     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
  Core.FromJSON
    ApplicationCodeConfigurationDescription
  where
  parseJSON :: Value -> Parser ApplicationCodeConfigurationDescription
parseJSON =
    String
-> (Object -> Parser ApplicationCodeConfigurationDescription)
-> Value
-> Parser ApplicationCodeConfigurationDescription
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ApplicationCodeConfigurationDescription"
      ( \Object
x ->
          Maybe CodeContentDescription
-> CodeContentType -> ApplicationCodeConfigurationDescription
ApplicationCodeConfigurationDescription'
            (Maybe CodeContentDescription
 -> CodeContentType -> ApplicationCodeConfigurationDescription)
-> Parser (Maybe CodeContentDescription)
-> Parser
     (CodeContentType -> ApplicationCodeConfigurationDescription)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe CodeContentDescription)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CodeContentDescription")
            Parser (CodeContentType -> ApplicationCodeConfigurationDescription)
-> Parser CodeContentType
-> Parser ApplicationCodeConfigurationDescription
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser CodeContentType
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"CodeContentType")
      )

instance
  Prelude.Hashable
    ApplicationCodeConfigurationDescription

instance
  Prelude.NFData
    ApplicationCodeConfigurationDescription