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

import qualified Amazonka.Core as Core
import Amazonka.KinesisAnalyticsV2.Types.ArtifactType
import Amazonka.KinesisAnalyticsV2.Types.MavenReference
import Amazonka.KinesisAnalyticsV2.Types.S3ContentLocation
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Specifies dependency JARs, as well as JAR files that contain
-- user-defined functions (UDF).
--
-- /See:/ 'newCustomArtifactConfiguration' smart constructor.
data CustomArtifactConfiguration = CustomArtifactConfiguration'
  { CustomArtifactConfiguration -> Maybe S3ContentLocation
s3ContentLocation :: Prelude.Maybe S3ContentLocation,
    -- | The parameters required to fully specify a Maven reference.
    CustomArtifactConfiguration -> Maybe MavenReference
mavenReference :: Prelude.Maybe MavenReference,
    -- | @UDF@ stands for user-defined functions. This type of artifact must be
    -- in an S3 bucket. A @DEPENDENCY_JAR@ can be in either Maven or an S3
    -- bucket.
    CustomArtifactConfiguration -> ArtifactType
artifactType :: ArtifactType
  }
  deriving (CustomArtifactConfiguration -> CustomArtifactConfiguration -> Bool
(CustomArtifactConfiguration
 -> CustomArtifactConfiguration -> Bool)
-> (CustomArtifactConfiguration
    -> CustomArtifactConfiguration -> Bool)
-> Eq CustomArtifactConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CustomArtifactConfiguration -> CustomArtifactConfiguration -> Bool
$c/= :: CustomArtifactConfiguration -> CustomArtifactConfiguration -> Bool
== :: CustomArtifactConfiguration -> CustomArtifactConfiguration -> Bool
$c== :: CustomArtifactConfiguration -> CustomArtifactConfiguration -> Bool
Prelude.Eq, ReadPrec [CustomArtifactConfiguration]
ReadPrec CustomArtifactConfiguration
Int -> ReadS CustomArtifactConfiguration
ReadS [CustomArtifactConfiguration]
(Int -> ReadS CustomArtifactConfiguration)
-> ReadS [CustomArtifactConfiguration]
-> ReadPrec CustomArtifactConfiguration
-> ReadPrec [CustomArtifactConfiguration]
-> Read CustomArtifactConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CustomArtifactConfiguration]
$creadListPrec :: ReadPrec [CustomArtifactConfiguration]
readPrec :: ReadPrec CustomArtifactConfiguration
$creadPrec :: ReadPrec CustomArtifactConfiguration
readList :: ReadS [CustomArtifactConfiguration]
$creadList :: ReadS [CustomArtifactConfiguration]
readsPrec :: Int -> ReadS CustomArtifactConfiguration
$creadsPrec :: Int -> ReadS CustomArtifactConfiguration
Prelude.Read, Int -> CustomArtifactConfiguration -> ShowS
[CustomArtifactConfiguration] -> ShowS
CustomArtifactConfiguration -> String
(Int -> CustomArtifactConfiguration -> ShowS)
-> (CustomArtifactConfiguration -> String)
-> ([CustomArtifactConfiguration] -> ShowS)
-> Show CustomArtifactConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CustomArtifactConfiguration] -> ShowS
$cshowList :: [CustomArtifactConfiguration] -> ShowS
show :: CustomArtifactConfiguration -> String
$cshow :: CustomArtifactConfiguration -> String
showsPrec :: Int -> CustomArtifactConfiguration -> ShowS
$cshowsPrec :: Int -> CustomArtifactConfiguration -> ShowS
Prelude.Show, (forall x.
 CustomArtifactConfiguration -> Rep CustomArtifactConfiguration x)
-> (forall x.
    Rep CustomArtifactConfiguration x -> CustomArtifactConfiguration)
-> Generic CustomArtifactConfiguration
forall x.
Rep CustomArtifactConfiguration x -> CustomArtifactConfiguration
forall x.
CustomArtifactConfiguration -> Rep CustomArtifactConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CustomArtifactConfiguration x -> CustomArtifactConfiguration
$cfrom :: forall x.
CustomArtifactConfiguration -> Rep CustomArtifactConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'CustomArtifactConfiguration' 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:
--
-- 's3ContentLocation', 'customArtifactConfiguration_s3ContentLocation' - Undocumented member.
--
-- 'mavenReference', 'customArtifactConfiguration_mavenReference' - The parameters required to fully specify a Maven reference.
--
-- 'artifactType', 'customArtifactConfiguration_artifactType' - @UDF@ stands for user-defined functions. This type of artifact must be
-- in an S3 bucket. A @DEPENDENCY_JAR@ can be in either Maven or an S3
-- bucket.
newCustomArtifactConfiguration ::
  -- | 'artifactType'
  ArtifactType ->
  CustomArtifactConfiguration
newCustomArtifactConfiguration :: ArtifactType -> CustomArtifactConfiguration
newCustomArtifactConfiguration ArtifactType
pArtifactType_ =
  CustomArtifactConfiguration' :: Maybe S3ContentLocation
-> Maybe MavenReference
-> ArtifactType
-> CustomArtifactConfiguration
CustomArtifactConfiguration'
    { $sel:s3ContentLocation:CustomArtifactConfiguration' :: Maybe S3ContentLocation
s3ContentLocation =
        Maybe S3ContentLocation
forall a. Maybe a
Prelude.Nothing,
      $sel:mavenReference:CustomArtifactConfiguration' :: Maybe MavenReference
mavenReference = Maybe MavenReference
forall a. Maybe a
Prelude.Nothing,
      $sel:artifactType:CustomArtifactConfiguration' :: ArtifactType
artifactType = ArtifactType
pArtifactType_
    }

-- | Undocumented member.
customArtifactConfiguration_s3ContentLocation :: Lens.Lens' CustomArtifactConfiguration (Prelude.Maybe S3ContentLocation)
customArtifactConfiguration_s3ContentLocation :: (Maybe S3ContentLocation -> f (Maybe S3ContentLocation))
-> CustomArtifactConfiguration -> f CustomArtifactConfiguration
customArtifactConfiguration_s3ContentLocation = (CustomArtifactConfiguration -> Maybe S3ContentLocation)
-> (CustomArtifactConfiguration
    -> Maybe S3ContentLocation -> CustomArtifactConfiguration)
-> Lens
     CustomArtifactConfiguration
     CustomArtifactConfiguration
     (Maybe S3ContentLocation)
     (Maybe S3ContentLocation)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomArtifactConfiguration' {Maybe S3ContentLocation
s3ContentLocation :: Maybe S3ContentLocation
$sel:s3ContentLocation:CustomArtifactConfiguration' :: CustomArtifactConfiguration -> Maybe S3ContentLocation
s3ContentLocation} -> Maybe S3ContentLocation
s3ContentLocation) (\s :: CustomArtifactConfiguration
s@CustomArtifactConfiguration' {} Maybe S3ContentLocation
a -> CustomArtifactConfiguration
s {$sel:s3ContentLocation:CustomArtifactConfiguration' :: Maybe S3ContentLocation
s3ContentLocation = Maybe S3ContentLocation
a} :: CustomArtifactConfiguration)

-- | The parameters required to fully specify a Maven reference.
customArtifactConfiguration_mavenReference :: Lens.Lens' CustomArtifactConfiguration (Prelude.Maybe MavenReference)
customArtifactConfiguration_mavenReference :: (Maybe MavenReference -> f (Maybe MavenReference))
-> CustomArtifactConfiguration -> f CustomArtifactConfiguration
customArtifactConfiguration_mavenReference = (CustomArtifactConfiguration -> Maybe MavenReference)
-> (CustomArtifactConfiguration
    -> Maybe MavenReference -> CustomArtifactConfiguration)
-> Lens
     CustomArtifactConfiguration
     CustomArtifactConfiguration
     (Maybe MavenReference)
     (Maybe MavenReference)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomArtifactConfiguration' {Maybe MavenReference
mavenReference :: Maybe MavenReference
$sel:mavenReference:CustomArtifactConfiguration' :: CustomArtifactConfiguration -> Maybe MavenReference
mavenReference} -> Maybe MavenReference
mavenReference) (\s :: CustomArtifactConfiguration
s@CustomArtifactConfiguration' {} Maybe MavenReference
a -> CustomArtifactConfiguration
s {$sel:mavenReference:CustomArtifactConfiguration' :: Maybe MavenReference
mavenReference = Maybe MavenReference
a} :: CustomArtifactConfiguration)

-- | @UDF@ stands for user-defined functions. This type of artifact must be
-- in an S3 bucket. A @DEPENDENCY_JAR@ can be in either Maven or an S3
-- bucket.
customArtifactConfiguration_artifactType :: Lens.Lens' CustomArtifactConfiguration ArtifactType
customArtifactConfiguration_artifactType :: (ArtifactType -> f ArtifactType)
-> CustomArtifactConfiguration -> f CustomArtifactConfiguration
customArtifactConfiguration_artifactType = (CustomArtifactConfiguration -> ArtifactType)
-> (CustomArtifactConfiguration
    -> ArtifactType -> CustomArtifactConfiguration)
-> Lens
     CustomArtifactConfiguration
     CustomArtifactConfiguration
     ArtifactType
     ArtifactType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomArtifactConfiguration' {ArtifactType
artifactType :: ArtifactType
$sel:artifactType:CustomArtifactConfiguration' :: CustomArtifactConfiguration -> ArtifactType
artifactType} -> ArtifactType
artifactType) (\s :: CustomArtifactConfiguration
s@CustomArtifactConfiguration' {} ArtifactType
a -> CustomArtifactConfiguration
s {$sel:artifactType:CustomArtifactConfiguration' :: ArtifactType
artifactType = ArtifactType
a} :: CustomArtifactConfiguration)

instance Prelude.Hashable CustomArtifactConfiguration

instance Prelude.NFData CustomArtifactConfiguration

instance Core.ToJSON CustomArtifactConfiguration where
  toJSON :: CustomArtifactConfiguration -> Value
toJSON CustomArtifactConfiguration' {Maybe MavenReference
Maybe S3ContentLocation
ArtifactType
artifactType :: ArtifactType
mavenReference :: Maybe MavenReference
s3ContentLocation :: Maybe S3ContentLocation
$sel:artifactType:CustomArtifactConfiguration' :: CustomArtifactConfiguration -> ArtifactType
$sel:mavenReference:CustomArtifactConfiguration' :: CustomArtifactConfiguration -> Maybe MavenReference
$sel:s3ContentLocation:CustomArtifactConfiguration' :: CustomArtifactConfiguration -> Maybe S3ContentLocation
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"S3ContentLocation" Text -> S3ContentLocation -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (S3ContentLocation -> Pair)
-> Maybe S3ContentLocation -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe S3ContentLocation
s3ContentLocation,
            (Text
"MavenReference" Text -> MavenReference -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (MavenReference -> Pair) -> Maybe MavenReference -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe MavenReference
mavenReference,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ArtifactType" Text -> ArtifactType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ArtifactType
artifactType)
          ]
      )