{-# 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.EMR.Types.SupportedProductConfig
-- 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.EMR.Types.SupportedProductConfig where

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

-- | The list of supported product configurations that allow user-supplied
-- arguments. EMR accepts these arguments and forwards them to the
-- corresponding installation script as bootstrap action arguments.
--
-- /See:/ 'newSupportedProductConfig' smart constructor.
data SupportedProductConfig = SupportedProductConfig'
  { -- | The list of user-supplied arguments.
    SupportedProductConfig -> Maybe [Text]
args :: Prelude.Maybe [Prelude.Text],
    -- | The name of the product configuration.
    SupportedProductConfig -> Maybe Text
name :: Prelude.Maybe Prelude.Text
  }
  deriving (SupportedProductConfig -> SupportedProductConfig -> Bool
(SupportedProductConfig -> SupportedProductConfig -> Bool)
-> (SupportedProductConfig -> SupportedProductConfig -> Bool)
-> Eq SupportedProductConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SupportedProductConfig -> SupportedProductConfig -> Bool
$c/= :: SupportedProductConfig -> SupportedProductConfig -> Bool
== :: SupportedProductConfig -> SupportedProductConfig -> Bool
$c== :: SupportedProductConfig -> SupportedProductConfig -> Bool
Prelude.Eq, ReadPrec [SupportedProductConfig]
ReadPrec SupportedProductConfig
Int -> ReadS SupportedProductConfig
ReadS [SupportedProductConfig]
(Int -> ReadS SupportedProductConfig)
-> ReadS [SupportedProductConfig]
-> ReadPrec SupportedProductConfig
-> ReadPrec [SupportedProductConfig]
-> Read SupportedProductConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SupportedProductConfig]
$creadListPrec :: ReadPrec [SupportedProductConfig]
readPrec :: ReadPrec SupportedProductConfig
$creadPrec :: ReadPrec SupportedProductConfig
readList :: ReadS [SupportedProductConfig]
$creadList :: ReadS [SupportedProductConfig]
readsPrec :: Int -> ReadS SupportedProductConfig
$creadsPrec :: Int -> ReadS SupportedProductConfig
Prelude.Read, Int -> SupportedProductConfig -> ShowS
[SupportedProductConfig] -> ShowS
SupportedProductConfig -> String
(Int -> SupportedProductConfig -> ShowS)
-> (SupportedProductConfig -> String)
-> ([SupportedProductConfig] -> ShowS)
-> Show SupportedProductConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SupportedProductConfig] -> ShowS
$cshowList :: [SupportedProductConfig] -> ShowS
show :: SupportedProductConfig -> String
$cshow :: SupportedProductConfig -> String
showsPrec :: Int -> SupportedProductConfig -> ShowS
$cshowsPrec :: Int -> SupportedProductConfig -> ShowS
Prelude.Show, (forall x. SupportedProductConfig -> Rep SupportedProductConfig x)
-> (forall x.
    Rep SupportedProductConfig x -> SupportedProductConfig)
-> Generic SupportedProductConfig
forall x. Rep SupportedProductConfig x -> SupportedProductConfig
forall x. SupportedProductConfig -> Rep SupportedProductConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SupportedProductConfig x -> SupportedProductConfig
$cfrom :: forall x. SupportedProductConfig -> Rep SupportedProductConfig x
Prelude.Generic)

-- |
-- Create a value of 'SupportedProductConfig' 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:
--
-- 'args', 'supportedProductConfig_args' - The list of user-supplied arguments.
--
-- 'name', 'supportedProductConfig_name' - The name of the product configuration.
newSupportedProductConfig ::
  SupportedProductConfig
newSupportedProductConfig :: SupportedProductConfig
newSupportedProductConfig =
  SupportedProductConfig' :: Maybe [Text] -> Maybe Text -> SupportedProductConfig
SupportedProductConfig'
    { $sel:args:SupportedProductConfig' :: Maybe [Text]
args = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:name:SupportedProductConfig' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The list of user-supplied arguments.
supportedProductConfig_args :: Lens.Lens' SupportedProductConfig (Prelude.Maybe [Prelude.Text])
supportedProductConfig_args :: (Maybe [Text] -> f (Maybe [Text]))
-> SupportedProductConfig -> f SupportedProductConfig
supportedProductConfig_args = (SupportedProductConfig -> Maybe [Text])
-> (SupportedProductConfig
    -> Maybe [Text] -> SupportedProductConfig)
-> Lens
     SupportedProductConfig
     SupportedProductConfig
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SupportedProductConfig' {Maybe [Text]
args :: Maybe [Text]
$sel:args:SupportedProductConfig' :: SupportedProductConfig -> Maybe [Text]
args} -> Maybe [Text]
args) (\s :: SupportedProductConfig
s@SupportedProductConfig' {} Maybe [Text]
a -> SupportedProductConfig
s {$sel:args:SupportedProductConfig' :: Maybe [Text]
args = Maybe [Text]
a} :: SupportedProductConfig) ((Maybe [Text] -> f (Maybe [Text]))
 -> SupportedProductConfig -> f SupportedProductConfig)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> SupportedProductConfig
-> f SupportedProductConfig
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The name of the product configuration.
supportedProductConfig_name :: Lens.Lens' SupportedProductConfig (Prelude.Maybe Prelude.Text)
supportedProductConfig_name :: (Maybe Text -> f (Maybe Text))
-> SupportedProductConfig -> f SupportedProductConfig
supportedProductConfig_name = (SupportedProductConfig -> Maybe Text)
-> (SupportedProductConfig -> Maybe Text -> SupportedProductConfig)
-> Lens
     SupportedProductConfig
     SupportedProductConfig
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SupportedProductConfig' {Maybe Text
name :: Maybe Text
$sel:name:SupportedProductConfig' :: SupportedProductConfig -> Maybe Text
name} -> Maybe Text
name) (\s :: SupportedProductConfig
s@SupportedProductConfig' {} Maybe Text
a -> SupportedProductConfig
s {$sel:name:SupportedProductConfig' :: Maybe Text
name = Maybe Text
a} :: SupportedProductConfig)

instance Prelude.Hashable SupportedProductConfig

instance Prelude.NFData SupportedProductConfig

instance Core.ToJSON SupportedProductConfig where
  toJSON :: SupportedProductConfig -> Value
toJSON SupportedProductConfig' {Maybe [Text]
Maybe Text
name :: Maybe Text
args :: Maybe [Text]
$sel:name:SupportedProductConfig' :: SupportedProductConfig -> Maybe Text
$sel:args:SupportedProductConfig' :: SupportedProductConfig -> Maybe [Text]
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"Args" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Text] -> Pair) -> Maybe [Text] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
args,
            (Text
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
name
          ]
      )