{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.FIS.Types.ActionParameter where

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

-- | Describes a parameter for an action.
--
-- /See:/ 'newActionParameter' smart constructor.
data ActionParameter = ActionParameter'
  { -- | The parameter description.
    ActionParameter -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | Indicates whether the parameter is required.
    ActionParameter -> Maybe Bool
required :: Prelude.Maybe Prelude.Bool
  }
  deriving (ActionParameter -> ActionParameter -> Bool
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]
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
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. 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:
--
-- 'description', 'actionParameter_description' - The parameter description.
--
-- 'required', 'actionParameter_required' - Indicates whether the parameter is required.
newActionParameter ::
  ActionParameter
newActionParameter :: ActionParameter
newActionParameter =
  ActionParameter'
    { $sel:description:ActionParameter' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:required:ActionParameter' :: Maybe Bool
required = forall a. Maybe a
Prelude.Nothing
    }

-- | The parameter description.
actionParameter_description :: Lens.Lens' ActionParameter (Prelude.Maybe Prelude.Text)
actionParameter_description :: Lens' ActionParameter (Maybe Text)
actionParameter_description = 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)

-- | Indicates whether the parameter is required.
actionParameter_required :: Lens.Lens' ActionParameter (Prelude.Maybe Prelude.Bool)
actionParameter_required :: Lens' ActionParameter (Maybe Bool)
actionParameter_required = 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)

instance Data.FromJSON ActionParameter where
  parseJSON :: Value -> Parser ActionParameter
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ActionParameter"
      ( \Object
x ->
          Maybe Text -> Maybe Bool -> ActionParameter
ActionParameter'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"description")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"required")
      )

instance Prelude.Hashable ActionParameter where
  hashWithSalt :: Int -> ActionParameter -> Int
hashWithSalt Int
_salt ActionParameter' {Maybe Bool
Maybe Text
required :: Maybe Bool
description :: Maybe Text
$sel:required:ActionParameter' :: ActionParameter -> Maybe Bool
$sel:description:ActionParameter' :: ActionParameter -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
required

instance Prelude.NFData ActionParameter where
  rnf :: ActionParameter -> ()
rnf ActionParameter' {Maybe Bool
Maybe Text
required :: Maybe Bool
description :: Maybe Text
$sel:required:ActionParameter' :: ActionParameter -> Maybe Bool
$sel:description:ActionParameter' :: ActionParameter -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
required