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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The information required to specify a Maven reference. You can use Maven
-- references to specify dependency JAR files.
--
-- /See:/ 'newMavenReference' smart constructor.
data MavenReference = MavenReference'
  { -- | The group ID of the Maven reference.
    MavenReference -> Text
groupId :: Prelude.Text,
    -- | The artifact ID of the Maven reference.
    MavenReference -> Text
artifactId :: Prelude.Text,
    -- | The version of the Maven reference.
    MavenReference -> Text
version :: Prelude.Text
  }
  deriving (MavenReference -> MavenReference -> Bool
(MavenReference -> MavenReference -> Bool)
-> (MavenReference -> MavenReference -> Bool) -> Eq MavenReference
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MavenReference -> MavenReference -> Bool
$c/= :: MavenReference -> MavenReference -> Bool
== :: MavenReference -> MavenReference -> Bool
$c== :: MavenReference -> MavenReference -> Bool
Prelude.Eq, ReadPrec [MavenReference]
ReadPrec MavenReference
Int -> ReadS MavenReference
ReadS [MavenReference]
(Int -> ReadS MavenReference)
-> ReadS [MavenReference]
-> ReadPrec MavenReference
-> ReadPrec [MavenReference]
-> Read MavenReference
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MavenReference]
$creadListPrec :: ReadPrec [MavenReference]
readPrec :: ReadPrec MavenReference
$creadPrec :: ReadPrec MavenReference
readList :: ReadS [MavenReference]
$creadList :: ReadS [MavenReference]
readsPrec :: Int -> ReadS MavenReference
$creadsPrec :: Int -> ReadS MavenReference
Prelude.Read, Int -> MavenReference -> ShowS
[MavenReference] -> ShowS
MavenReference -> String
(Int -> MavenReference -> ShowS)
-> (MavenReference -> String)
-> ([MavenReference] -> ShowS)
-> Show MavenReference
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MavenReference] -> ShowS
$cshowList :: [MavenReference] -> ShowS
show :: MavenReference -> String
$cshow :: MavenReference -> String
showsPrec :: Int -> MavenReference -> ShowS
$cshowsPrec :: Int -> MavenReference -> ShowS
Prelude.Show, (forall x. MavenReference -> Rep MavenReference x)
-> (forall x. Rep MavenReference x -> MavenReference)
-> Generic MavenReference
forall x. Rep MavenReference x -> MavenReference
forall x. MavenReference -> Rep MavenReference x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep MavenReference x -> MavenReference
$cfrom :: forall x. MavenReference -> Rep MavenReference x
Prelude.Generic)

-- |
-- Create a value of 'MavenReference' 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:
--
-- 'groupId', 'mavenReference_groupId' - The group ID of the Maven reference.
--
-- 'artifactId', 'mavenReference_artifactId' - The artifact ID of the Maven reference.
--
-- 'version', 'mavenReference_version' - The version of the Maven reference.
newMavenReference ::
  -- | 'groupId'
  Prelude.Text ->
  -- | 'artifactId'
  Prelude.Text ->
  -- | 'version'
  Prelude.Text ->
  MavenReference
newMavenReference :: Text -> Text -> Text -> MavenReference
newMavenReference Text
pGroupId_ Text
pArtifactId_ Text
pVersion_ =
  MavenReference' :: Text -> Text -> Text -> MavenReference
MavenReference'
    { $sel:groupId:MavenReference' :: Text
groupId = Text
pGroupId_,
      $sel:artifactId:MavenReference' :: Text
artifactId = Text
pArtifactId_,
      $sel:version:MavenReference' :: Text
version = Text
pVersion_
    }

-- | The group ID of the Maven reference.
mavenReference_groupId :: Lens.Lens' MavenReference Prelude.Text
mavenReference_groupId :: (Text -> f Text) -> MavenReference -> f MavenReference
mavenReference_groupId = (MavenReference -> Text)
-> (MavenReference -> Text -> MavenReference)
-> Lens MavenReference MavenReference Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MavenReference' {Text
groupId :: Text
$sel:groupId:MavenReference' :: MavenReference -> Text
groupId} -> Text
groupId) (\s :: MavenReference
s@MavenReference' {} Text
a -> MavenReference
s {$sel:groupId:MavenReference' :: Text
groupId = Text
a} :: MavenReference)

-- | The artifact ID of the Maven reference.
mavenReference_artifactId :: Lens.Lens' MavenReference Prelude.Text
mavenReference_artifactId :: (Text -> f Text) -> MavenReference -> f MavenReference
mavenReference_artifactId = (MavenReference -> Text)
-> (MavenReference -> Text -> MavenReference)
-> Lens MavenReference MavenReference Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MavenReference' {Text
artifactId :: Text
$sel:artifactId:MavenReference' :: MavenReference -> Text
artifactId} -> Text
artifactId) (\s :: MavenReference
s@MavenReference' {} Text
a -> MavenReference
s {$sel:artifactId:MavenReference' :: Text
artifactId = Text
a} :: MavenReference)

-- | The version of the Maven reference.
mavenReference_version :: Lens.Lens' MavenReference Prelude.Text
mavenReference_version :: (Text -> f Text) -> MavenReference -> f MavenReference
mavenReference_version = (MavenReference -> Text)
-> (MavenReference -> Text -> MavenReference)
-> Lens MavenReference MavenReference Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MavenReference' {Text
version :: Text
$sel:version:MavenReference' :: MavenReference -> Text
version} -> Text
version) (\s :: MavenReference
s@MavenReference' {} Text
a -> MavenReference
s {$sel:version:MavenReference' :: Text
version = Text
a} :: MavenReference)

instance Core.FromJSON MavenReference where
  parseJSON :: Value -> Parser MavenReference
parseJSON =
    String
-> (Object -> Parser MavenReference)
-> Value
-> Parser MavenReference
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"MavenReference"
      ( \Object
x ->
          Text -> Text -> Text -> MavenReference
MavenReference'
            (Text -> Text -> Text -> MavenReference)
-> Parser Text -> Parser (Text -> Text -> MavenReference)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"GroupId")
            Parser (Text -> Text -> MavenReference)
-> Parser Text -> Parser (Text -> MavenReference)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"ArtifactId")
            Parser (Text -> MavenReference)
-> Parser Text -> Parser MavenReference
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Version")
      )

instance Prelude.Hashable MavenReference

instance Prelude.NFData MavenReference

instance Core.ToJSON MavenReference where
  toJSON :: MavenReference -> Value
toJSON MavenReference' {Text
version :: Text
artifactId :: Text
groupId :: Text
$sel:version:MavenReference' :: MavenReference -> Text
$sel:artifactId:MavenReference' :: MavenReference -> Text
$sel:groupId:MavenReference' :: MavenReference -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"GroupId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
groupId),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ArtifactId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
artifactId),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Version" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
version)
          ]
      )