{-# 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.ImageBuilder.Types.ComponentParameterDetail
-- 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.ImageBuilder.Types.ComponentParameterDetail where

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

-- | Defines a parameter that is used to provide configuration details for
-- the component.
--
-- /See:/ 'newComponentParameterDetail' smart constructor.
data ComponentParameterDetail = ComponentParameterDetail'
  { -- | The default value of this parameter if no input is provided.
    ComponentParameterDetail -> Maybe [Text]
defaultValue :: Prelude.Maybe [Prelude.Text],
    -- | Describes this parameter.
    ComponentParameterDetail -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The name of this input parameter.
    ComponentParameterDetail -> Text
name :: Prelude.Text,
    -- | The type of input this parameter provides. The currently supported value
    -- is \"string\".
    ComponentParameterDetail -> Text
type' :: Prelude.Text
  }
  deriving (ComponentParameterDetail -> ComponentParameterDetail -> Bool
(ComponentParameterDetail -> ComponentParameterDetail -> Bool)
-> (ComponentParameterDetail -> ComponentParameterDetail -> Bool)
-> Eq ComponentParameterDetail
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ComponentParameterDetail -> ComponentParameterDetail -> Bool
$c/= :: ComponentParameterDetail -> ComponentParameterDetail -> Bool
== :: ComponentParameterDetail -> ComponentParameterDetail -> Bool
$c== :: ComponentParameterDetail -> ComponentParameterDetail -> Bool
Prelude.Eq, ReadPrec [ComponentParameterDetail]
ReadPrec ComponentParameterDetail
Int -> ReadS ComponentParameterDetail
ReadS [ComponentParameterDetail]
(Int -> ReadS ComponentParameterDetail)
-> ReadS [ComponentParameterDetail]
-> ReadPrec ComponentParameterDetail
-> ReadPrec [ComponentParameterDetail]
-> Read ComponentParameterDetail
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ComponentParameterDetail]
$creadListPrec :: ReadPrec [ComponentParameterDetail]
readPrec :: ReadPrec ComponentParameterDetail
$creadPrec :: ReadPrec ComponentParameterDetail
readList :: ReadS [ComponentParameterDetail]
$creadList :: ReadS [ComponentParameterDetail]
readsPrec :: Int -> ReadS ComponentParameterDetail
$creadsPrec :: Int -> ReadS ComponentParameterDetail
Prelude.Read, Int -> ComponentParameterDetail -> ShowS
[ComponentParameterDetail] -> ShowS
ComponentParameterDetail -> String
(Int -> ComponentParameterDetail -> ShowS)
-> (ComponentParameterDetail -> String)
-> ([ComponentParameterDetail] -> ShowS)
-> Show ComponentParameterDetail
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ComponentParameterDetail] -> ShowS
$cshowList :: [ComponentParameterDetail] -> ShowS
show :: ComponentParameterDetail -> String
$cshow :: ComponentParameterDetail -> String
showsPrec :: Int -> ComponentParameterDetail -> ShowS
$cshowsPrec :: Int -> ComponentParameterDetail -> ShowS
Prelude.Show, (forall x.
 ComponentParameterDetail -> Rep ComponentParameterDetail x)
-> (forall x.
    Rep ComponentParameterDetail x -> ComponentParameterDetail)
-> Generic ComponentParameterDetail
forall x.
Rep ComponentParameterDetail x -> ComponentParameterDetail
forall x.
ComponentParameterDetail -> Rep ComponentParameterDetail x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ComponentParameterDetail x -> ComponentParameterDetail
$cfrom :: forall x.
ComponentParameterDetail -> Rep ComponentParameterDetail x
Prelude.Generic)

-- |
-- Create a value of 'ComponentParameterDetail' 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:
--
-- 'defaultValue', 'componentParameterDetail_defaultValue' - The default value of this parameter if no input is provided.
--
-- 'description', 'componentParameterDetail_description' - Describes this parameter.
--
-- 'name', 'componentParameterDetail_name' - The name of this input parameter.
--
-- 'type'', 'componentParameterDetail_type' - The type of input this parameter provides. The currently supported value
-- is \"string\".
newComponentParameterDetail ::
  -- | 'name'
  Prelude.Text ->
  -- | 'type''
  Prelude.Text ->
  ComponentParameterDetail
newComponentParameterDetail :: Text -> Text -> ComponentParameterDetail
newComponentParameterDetail Text
pName_ Text
pType_ =
  ComponentParameterDetail' :: Maybe [Text]
-> Maybe Text -> Text -> Text -> ComponentParameterDetail
ComponentParameterDetail'
    { $sel:defaultValue:ComponentParameterDetail' :: Maybe [Text]
defaultValue =
        Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:description:ComponentParameterDetail' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:ComponentParameterDetail' :: Text
name = Text
pName_,
      $sel:type':ComponentParameterDetail' :: Text
type' = Text
pType_
    }

-- | The default value of this parameter if no input is provided.
componentParameterDetail_defaultValue :: Lens.Lens' ComponentParameterDetail (Prelude.Maybe [Prelude.Text])
componentParameterDetail_defaultValue :: (Maybe [Text] -> f (Maybe [Text]))
-> ComponentParameterDetail -> f ComponentParameterDetail
componentParameterDetail_defaultValue = (ComponentParameterDetail -> Maybe [Text])
-> (ComponentParameterDetail
    -> Maybe [Text] -> ComponentParameterDetail)
-> Lens
     ComponentParameterDetail
     ComponentParameterDetail
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ComponentParameterDetail' {Maybe [Text]
defaultValue :: Maybe [Text]
$sel:defaultValue:ComponentParameterDetail' :: ComponentParameterDetail -> Maybe [Text]
defaultValue} -> Maybe [Text]
defaultValue) (\s :: ComponentParameterDetail
s@ComponentParameterDetail' {} Maybe [Text]
a -> ComponentParameterDetail
s {$sel:defaultValue:ComponentParameterDetail' :: Maybe [Text]
defaultValue = Maybe [Text]
a} :: ComponentParameterDetail) ((Maybe [Text] -> f (Maybe [Text]))
 -> ComponentParameterDetail -> f ComponentParameterDetail)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> ComponentParameterDetail
-> f ComponentParameterDetail
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

-- | Describes this parameter.
componentParameterDetail_description :: Lens.Lens' ComponentParameterDetail (Prelude.Maybe Prelude.Text)
componentParameterDetail_description :: (Maybe Text -> f (Maybe Text))
-> ComponentParameterDetail -> f ComponentParameterDetail
componentParameterDetail_description = (ComponentParameterDetail -> Maybe Text)
-> (ComponentParameterDetail
    -> Maybe Text -> ComponentParameterDetail)
-> Lens
     ComponentParameterDetail
     ComponentParameterDetail
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ComponentParameterDetail' {Maybe Text
description :: Maybe Text
$sel:description:ComponentParameterDetail' :: ComponentParameterDetail -> Maybe Text
description} -> Maybe Text
description) (\s :: ComponentParameterDetail
s@ComponentParameterDetail' {} Maybe Text
a -> ComponentParameterDetail
s {$sel:description:ComponentParameterDetail' :: Maybe Text
description = Maybe Text
a} :: ComponentParameterDetail)

-- | The name of this input parameter.
componentParameterDetail_name :: Lens.Lens' ComponentParameterDetail Prelude.Text
componentParameterDetail_name :: (Text -> f Text)
-> ComponentParameterDetail -> f ComponentParameterDetail
componentParameterDetail_name = (ComponentParameterDetail -> Text)
-> (ComponentParameterDetail -> Text -> ComponentParameterDetail)
-> Lens ComponentParameterDetail ComponentParameterDetail Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ComponentParameterDetail' {Text
name :: Text
$sel:name:ComponentParameterDetail' :: ComponentParameterDetail -> Text
name} -> Text
name) (\s :: ComponentParameterDetail
s@ComponentParameterDetail' {} Text
a -> ComponentParameterDetail
s {$sel:name:ComponentParameterDetail' :: Text
name = Text
a} :: ComponentParameterDetail)

-- | The type of input this parameter provides. The currently supported value
-- is \"string\".
componentParameterDetail_type :: Lens.Lens' ComponentParameterDetail Prelude.Text
componentParameterDetail_type :: (Text -> f Text)
-> ComponentParameterDetail -> f ComponentParameterDetail
componentParameterDetail_type = (ComponentParameterDetail -> Text)
-> (ComponentParameterDetail -> Text -> ComponentParameterDetail)
-> Lens ComponentParameterDetail ComponentParameterDetail Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ComponentParameterDetail' {Text
type' :: Text
$sel:type':ComponentParameterDetail' :: ComponentParameterDetail -> Text
type'} -> Text
type') (\s :: ComponentParameterDetail
s@ComponentParameterDetail' {} Text
a -> ComponentParameterDetail
s {$sel:type':ComponentParameterDetail' :: Text
type' = Text
a} :: ComponentParameterDetail)

instance Core.FromJSON ComponentParameterDetail where
  parseJSON :: Value -> Parser ComponentParameterDetail
parseJSON =
    String
-> (Object -> Parser ComponentParameterDetail)
-> Value
-> Parser ComponentParameterDetail
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ComponentParameterDetail"
      ( \Object
x ->
          Maybe [Text]
-> Maybe Text -> Text -> Text -> ComponentParameterDetail
ComponentParameterDetail'
            (Maybe [Text]
 -> Maybe Text -> Text -> Text -> ComponentParameterDetail)
-> Parser (Maybe [Text])
-> Parser (Maybe Text -> Text -> Text -> ComponentParameterDetail)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"defaultValue" Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty)
            Parser (Maybe Text -> Text -> Text -> ComponentParameterDetail)
-> Parser (Maybe Text)
-> Parser (Text -> Text -> ComponentParameterDetail)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"description")
            Parser (Text -> Text -> ComponentParameterDetail)
-> Parser Text -> Parser (Text -> ComponentParameterDetail)
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
"name")
            Parser (Text -> ComponentParameterDetail)
-> Parser Text -> Parser ComponentParameterDetail
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
"type")
      )

instance Prelude.Hashable ComponentParameterDetail

instance Prelude.NFData ComponentParameterDetail