{-# 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.FIS.Types.ActionParameter
-- 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.FIS.Types.ActionParameter where

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

-- | Describes a parameter for an action.
--
-- /See:/ 'newActionParameter' smart constructor.
data ActionParameter = ActionParameter'
  { -- | Indicates whether the parameter is required.
    ActionParameter -> Maybe Bool
required :: Prelude.Maybe Prelude.Bool,
    -- | The parameter description.
    ActionParameter -> Maybe Text
description :: Prelude.Maybe Prelude.Text
  }
  deriving (ActionParameter -> ActionParameter -> Bool
(ActionParameter -> ActionParameter -> Bool)
-> (ActionParameter -> ActionParameter -> Bool)
-> Eq ActionParameter
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ActionParameter -> ActionParameter -> Bool
$c/= :: ActionParameter -> ActionParameter -> Bool
== :: ActionParameter -> ActionParameter -> Bool
$c== :: ActionParameter -> ActionParameter -> Bool
Prelude.Eq, ReadPrec [ActionParameter]
ReadPrec ActionParameter
Int -> ReadS ActionParameter
ReadS [ActionParameter]
(Int -> ReadS ActionParameter)
-> ReadS [ActionParameter]
-> ReadPrec ActionParameter
-> ReadPrec [ActionParameter]
-> Read ActionParameter
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ActionParameter]
$creadListPrec :: ReadPrec [ActionParameter]
readPrec :: ReadPrec ActionParameter
$creadPrec :: ReadPrec ActionParameter
readList :: ReadS [ActionParameter]
$creadList :: ReadS [ActionParameter]
readsPrec :: Int -> ReadS ActionParameter
$creadsPrec :: Int -> ReadS ActionParameter
Prelude.Read, Int -> ActionParameter -> ShowS
[ActionParameter] -> ShowS
ActionParameter -> String
(Int -> ActionParameter -> ShowS)
-> (ActionParameter -> String)
-> ([ActionParameter] -> ShowS)
-> Show ActionParameter
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ActionParameter] -> ShowS
$cshowList :: [ActionParameter] -> ShowS
show :: ActionParameter -> String
$cshow :: ActionParameter -> String
showsPrec :: Int -> ActionParameter -> ShowS
$cshowsPrec :: Int -> ActionParameter -> ShowS
Prelude.Show, (forall x. ActionParameter -> Rep ActionParameter x)
-> (forall x. Rep ActionParameter x -> ActionParameter)
-> Generic ActionParameter
forall x. Rep ActionParameter x -> ActionParameter
forall x. ActionParameter -> Rep ActionParameter x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ActionParameter x -> ActionParameter
$cfrom :: forall x. ActionParameter -> Rep ActionParameter x
Prelude.Generic)

-- |
-- Create a value of 'ActionParameter' 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:
--
-- 'required', 'actionParameter_required' - Indicates whether the parameter is required.
--
-- 'description', 'actionParameter_description' - The parameter description.
newActionParameter ::
  ActionParameter
newActionParameter :: ActionParameter
newActionParameter =
  ActionParameter' :: Maybe Bool -> Maybe Text -> ActionParameter
ActionParameter'
    { $sel:required:ActionParameter' :: Maybe Bool
required = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:description:ActionParameter' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | Indicates whether the parameter is required.
actionParameter_required :: Lens.Lens' ActionParameter (Prelude.Maybe Prelude.Bool)
actionParameter_required :: (Maybe Bool -> f (Maybe Bool))
-> ActionParameter -> f ActionParameter
actionParameter_required = (ActionParameter -> Maybe Bool)
-> (ActionParameter -> Maybe Bool -> ActionParameter)
-> Lens ActionParameter ActionParameter (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActionParameter' {Maybe Bool
required :: Maybe Bool
$sel:required:ActionParameter' :: ActionParameter -> Maybe Bool
required} -> Maybe Bool
required) (\s :: ActionParameter
s@ActionParameter' {} Maybe Bool
a -> ActionParameter
s {$sel:required:ActionParameter' :: Maybe Bool
required = Maybe Bool
a} :: ActionParameter)

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

instance Core.FromJSON ActionParameter where
  parseJSON :: Value -> Parser ActionParameter
parseJSON =
    String
-> (Object -> Parser ActionParameter)
-> Value
-> Parser ActionParameter
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ActionParameter"
      ( \Object
x ->
          Maybe Bool -> Maybe Text -> ActionParameter
ActionParameter'
            (Maybe Bool -> Maybe Text -> ActionParameter)
-> Parser (Maybe Bool) -> Parser (Maybe Text -> ActionParameter)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"required")
            Parser (Maybe Text -> ActionParameter)
-> Parser (Maybe Text) -> Parser ActionParameter
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")
      )

instance Prelude.Hashable ActionParameter

instance Prelude.NFData ActionParameter