{-# 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-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.CustomArtifactConfiguration 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.ArtifactType
import Amazonka.KinesisAnalyticsV2.Types.MavenReference
import Amazonka.KinesisAnalyticsV2.Types.S3ContentLocation
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'
  { -- | The parameters required to fully specify a Maven reference.
    CustomArtifactConfiguration -> Maybe MavenReference
mavenReference :: Prelude.Maybe MavenReference,
    CustomArtifactConfiguration -> Maybe S3ContentLocation
s3ContentLocation :: Prelude.Maybe S3ContentLocation,
    -- | @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
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]
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
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.
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:
--
-- 'mavenReference', 'customArtifactConfiguration_mavenReference' - The parameters required to fully specify a Maven reference.
--
-- 's3ContentLocation', 'customArtifactConfiguration_s3ContentLocation' - Undocumented member.
--
-- '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'
    { $sel:mavenReference:CustomArtifactConfiguration' :: Maybe MavenReference
mavenReference =
        forall a. Maybe a
Prelude.Nothing,
      $sel:s3ContentLocation:CustomArtifactConfiguration' :: Maybe S3ContentLocation
s3ContentLocation = forall a. Maybe a
Prelude.Nothing,
      $sel:artifactType:CustomArtifactConfiguration' :: ArtifactType
artifactType = ArtifactType
pArtifactType_
    }

-- | The parameters required to fully specify a Maven reference.
customArtifactConfiguration_mavenReference :: Lens.Lens' CustomArtifactConfiguration (Prelude.Maybe MavenReference)
customArtifactConfiguration_mavenReference :: Lens' CustomArtifactConfiguration (Maybe MavenReference)
customArtifactConfiguration_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)

-- | Undocumented member.
customArtifactConfiguration_s3ContentLocation :: Lens.Lens' CustomArtifactConfiguration (Prelude.Maybe S3ContentLocation)
customArtifactConfiguration_s3ContentLocation :: Lens' CustomArtifactConfiguration (Maybe S3ContentLocation)
customArtifactConfiguration_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)

-- | @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 :: Lens' CustomArtifactConfiguration ArtifactType
customArtifactConfiguration_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 where
  hashWithSalt :: Int -> CustomArtifactConfiguration -> Int
hashWithSalt Int
_salt CustomArtifactConfiguration' {Maybe MavenReference
Maybe S3ContentLocation
ArtifactType
artifactType :: ArtifactType
s3ContentLocation :: Maybe S3ContentLocation
mavenReference :: Maybe MavenReference
$sel:artifactType:CustomArtifactConfiguration' :: CustomArtifactConfiguration -> ArtifactType
$sel:s3ContentLocation:CustomArtifactConfiguration' :: CustomArtifactConfiguration -> Maybe S3ContentLocation
$sel:mavenReference:CustomArtifactConfiguration' :: CustomArtifactConfiguration -> Maybe MavenReference
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe MavenReference
mavenReference
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe S3ContentLocation
s3ContentLocation
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ArtifactType
artifactType

instance Prelude.NFData CustomArtifactConfiguration where
  rnf :: CustomArtifactConfiguration -> ()
rnf CustomArtifactConfiguration' {Maybe MavenReference
Maybe S3ContentLocation
ArtifactType
artifactType :: ArtifactType
s3ContentLocation :: Maybe S3ContentLocation
mavenReference :: Maybe MavenReference
$sel:artifactType:CustomArtifactConfiguration' :: CustomArtifactConfiguration -> ArtifactType
$sel:s3ContentLocation:CustomArtifactConfiguration' :: CustomArtifactConfiguration -> Maybe S3ContentLocation
$sel:mavenReference:CustomArtifactConfiguration' :: CustomArtifactConfiguration -> Maybe MavenReference
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe MavenReference
mavenReference
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe S3ContentLocation
s3ContentLocation
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ArtifactType
artifactType

instance Data.ToJSON CustomArtifactConfiguration where
  toJSON :: CustomArtifactConfiguration -> Value
toJSON CustomArtifactConfiguration' {Maybe MavenReference
Maybe S3ContentLocation
ArtifactType
artifactType :: ArtifactType
s3ContentLocation :: Maybe S3ContentLocation
mavenReference :: Maybe MavenReference
$sel:artifactType:CustomArtifactConfiguration' :: CustomArtifactConfiguration -> ArtifactType
$sel:s3ContentLocation:CustomArtifactConfiguration' :: CustomArtifactConfiguration -> Maybe S3ContentLocation
$sel:mavenReference:CustomArtifactConfiguration' :: CustomArtifactConfiguration -> Maybe MavenReference
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"MavenReference" 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 MavenReference
mavenReference,
            (Key
"S3ContentLocation" 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 S3ContentLocation
s3ContentLocation,
            forall a. a -> Maybe a
Prelude.Just (Key
"ArtifactType" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= ArtifactType
artifactType)
          ]
      )