{-# 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.CodePipeline.Types.ActionTypeProperty
-- 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.CodePipeline.Types.ActionTypeProperty 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

-- | Represents information about each property specified in the action
-- configuration, such as the description and key name that display for the
-- customer using the action type.
--
-- /See:/ 'newActionTypeProperty' smart constructor.
data ActionTypeProperty = ActionTypeProperty'
  { -- | The description of the property that is displayed to users.
    ActionTypeProperty -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | Indicates that the property is used with polling. An action type can
    -- have up to one queryable property. If it has one, that property must be
    -- both required and not secret.
    ActionTypeProperty -> Maybe Bool
queryable :: Prelude.Maybe Prelude.Bool,
    -- | The property name that is displayed to users.
    ActionTypeProperty -> Text
name :: Prelude.Text,
    -- | Whether the configuration property is an optional value.
    ActionTypeProperty -> Bool
optional :: Prelude.Bool,
    -- | Whether the configuration property is a key.
    ActionTypeProperty -> Bool
key :: Prelude.Bool,
    -- | Whether to omit the field value entered by the customer in the log. If
    -- @true@, the value is not saved in CloudTrail logs for the action
    -- execution.
    ActionTypeProperty -> Bool
noEcho :: Prelude.Bool
  }
  deriving (ActionTypeProperty -> ActionTypeProperty -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ActionTypeProperty -> ActionTypeProperty -> Bool
$c/= :: ActionTypeProperty -> ActionTypeProperty -> Bool
== :: ActionTypeProperty -> ActionTypeProperty -> Bool
$c== :: ActionTypeProperty -> ActionTypeProperty -> Bool
Prelude.Eq, ReadPrec [ActionTypeProperty]
ReadPrec ActionTypeProperty
Int -> ReadS ActionTypeProperty
ReadS [ActionTypeProperty]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ActionTypeProperty]
$creadListPrec :: ReadPrec [ActionTypeProperty]
readPrec :: ReadPrec ActionTypeProperty
$creadPrec :: ReadPrec ActionTypeProperty
readList :: ReadS [ActionTypeProperty]
$creadList :: ReadS [ActionTypeProperty]
readsPrec :: Int -> ReadS ActionTypeProperty
$creadsPrec :: Int -> ReadS ActionTypeProperty
Prelude.Read, Int -> ActionTypeProperty -> ShowS
[ActionTypeProperty] -> ShowS
ActionTypeProperty -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ActionTypeProperty] -> ShowS
$cshowList :: [ActionTypeProperty] -> ShowS
show :: ActionTypeProperty -> String
$cshow :: ActionTypeProperty -> String
showsPrec :: Int -> ActionTypeProperty -> ShowS
$cshowsPrec :: Int -> ActionTypeProperty -> ShowS
Prelude.Show, forall x. Rep ActionTypeProperty x -> ActionTypeProperty
forall x. ActionTypeProperty -> Rep ActionTypeProperty x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ActionTypeProperty x -> ActionTypeProperty
$cfrom :: forall x. ActionTypeProperty -> Rep ActionTypeProperty x
Prelude.Generic)

-- |
-- Create a value of 'ActionTypeProperty' 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', 'actionTypeProperty_description' - The description of the property that is displayed to users.
--
-- 'queryable', 'actionTypeProperty_queryable' - Indicates that the property is used with polling. An action type can
-- have up to one queryable property. If it has one, that property must be
-- both required and not secret.
--
-- 'name', 'actionTypeProperty_name' - The property name that is displayed to users.
--
-- 'optional', 'actionTypeProperty_optional' - Whether the configuration property is an optional value.
--
-- 'key', 'actionTypeProperty_key' - Whether the configuration property is a key.
--
-- 'noEcho', 'actionTypeProperty_noEcho' - Whether to omit the field value entered by the customer in the log. If
-- @true@, the value is not saved in CloudTrail logs for the action
-- execution.
newActionTypeProperty ::
  -- | 'name'
  Prelude.Text ->
  -- | 'optional'
  Prelude.Bool ->
  -- | 'key'
  Prelude.Bool ->
  -- | 'noEcho'
  Prelude.Bool ->
  ActionTypeProperty
newActionTypeProperty :: Text -> Bool -> Bool -> Bool -> ActionTypeProperty
newActionTypeProperty
  Text
pName_
  Bool
pOptional_
  Bool
pKey_
  Bool
pNoEcho_ =
    ActionTypeProperty'
      { $sel:description:ActionTypeProperty' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
        $sel:queryable:ActionTypeProperty' :: Maybe Bool
queryable = forall a. Maybe a
Prelude.Nothing,
        $sel:name:ActionTypeProperty' :: Text
name = Text
pName_,
        $sel:optional:ActionTypeProperty' :: Bool
optional = Bool
pOptional_,
        $sel:key:ActionTypeProperty' :: Bool
key = Bool
pKey_,
        $sel:noEcho:ActionTypeProperty' :: Bool
noEcho = Bool
pNoEcho_
      }

-- | The description of the property that is displayed to users.
actionTypeProperty_description :: Lens.Lens' ActionTypeProperty (Prelude.Maybe Prelude.Text)
actionTypeProperty_description :: Lens' ActionTypeProperty (Maybe Text)
actionTypeProperty_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActionTypeProperty' {Maybe Text
description :: Maybe Text
$sel:description:ActionTypeProperty' :: ActionTypeProperty -> Maybe Text
description} -> Maybe Text
description) (\s :: ActionTypeProperty
s@ActionTypeProperty' {} Maybe Text
a -> ActionTypeProperty
s {$sel:description:ActionTypeProperty' :: Maybe Text
description = Maybe Text
a} :: ActionTypeProperty)

-- | Indicates that the property is used with polling. An action type can
-- have up to one queryable property. If it has one, that property must be
-- both required and not secret.
actionTypeProperty_queryable :: Lens.Lens' ActionTypeProperty (Prelude.Maybe Prelude.Bool)
actionTypeProperty_queryable :: Lens' ActionTypeProperty (Maybe Bool)
actionTypeProperty_queryable = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActionTypeProperty' {Maybe Bool
queryable :: Maybe Bool
$sel:queryable:ActionTypeProperty' :: ActionTypeProperty -> Maybe Bool
queryable} -> Maybe Bool
queryable) (\s :: ActionTypeProperty
s@ActionTypeProperty' {} Maybe Bool
a -> ActionTypeProperty
s {$sel:queryable:ActionTypeProperty' :: Maybe Bool
queryable = Maybe Bool
a} :: ActionTypeProperty)

-- | The property name that is displayed to users.
actionTypeProperty_name :: Lens.Lens' ActionTypeProperty Prelude.Text
actionTypeProperty_name :: Lens' ActionTypeProperty Text
actionTypeProperty_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActionTypeProperty' {Text
name :: Text
$sel:name:ActionTypeProperty' :: ActionTypeProperty -> Text
name} -> Text
name) (\s :: ActionTypeProperty
s@ActionTypeProperty' {} Text
a -> ActionTypeProperty
s {$sel:name:ActionTypeProperty' :: Text
name = Text
a} :: ActionTypeProperty)

-- | Whether the configuration property is an optional value.
actionTypeProperty_optional :: Lens.Lens' ActionTypeProperty Prelude.Bool
actionTypeProperty_optional :: Lens' ActionTypeProperty Bool
actionTypeProperty_optional = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActionTypeProperty' {Bool
optional :: Bool
$sel:optional:ActionTypeProperty' :: ActionTypeProperty -> Bool
optional} -> Bool
optional) (\s :: ActionTypeProperty
s@ActionTypeProperty' {} Bool
a -> ActionTypeProperty
s {$sel:optional:ActionTypeProperty' :: Bool
optional = Bool
a} :: ActionTypeProperty)

-- | Whether the configuration property is a key.
actionTypeProperty_key :: Lens.Lens' ActionTypeProperty Prelude.Bool
actionTypeProperty_key :: Lens' ActionTypeProperty Bool
actionTypeProperty_key = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActionTypeProperty' {Bool
key :: Bool
$sel:key:ActionTypeProperty' :: ActionTypeProperty -> Bool
key} -> Bool
key) (\s :: ActionTypeProperty
s@ActionTypeProperty' {} Bool
a -> ActionTypeProperty
s {$sel:key:ActionTypeProperty' :: Bool
key = Bool
a} :: ActionTypeProperty)

-- | Whether to omit the field value entered by the customer in the log. If
-- @true@, the value is not saved in CloudTrail logs for the action
-- execution.
actionTypeProperty_noEcho :: Lens.Lens' ActionTypeProperty Prelude.Bool
actionTypeProperty_noEcho :: Lens' ActionTypeProperty Bool
actionTypeProperty_noEcho = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActionTypeProperty' {Bool
noEcho :: Bool
$sel:noEcho:ActionTypeProperty' :: ActionTypeProperty -> Bool
noEcho} -> Bool
noEcho) (\s :: ActionTypeProperty
s@ActionTypeProperty' {} Bool
a -> ActionTypeProperty
s {$sel:noEcho:ActionTypeProperty' :: Bool
noEcho = Bool
a} :: ActionTypeProperty)

instance Data.FromJSON ActionTypeProperty where
  parseJSON :: Value -> Parser ActionTypeProperty
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ActionTypeProperty"
      ( \Object
x ->
          Maybe Text
-> Maybe Bool -> Text -> Bool -> Bool -> Bool -> ActionTypeProperty
ActionTypeProperty'
            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
"queryable")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"name")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"optional")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"key")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"noEcho")
      )

instance Prelude.Hashable ActionTypeProperty where
  hashWithSalt :: Int -> ActionTypeProperty -> Int
hashWithSalt Int
_salt ActionTypeProperty' {Bool
Maybe Bool
Maybe Text
Text
noEcho :: Bool
key :: Bool
optional :: Bool
name :: Text
queryable :: Maybe Bool
description :: Maybe Text
$sel:noEcho:ActionTypeProperty' :: ActionTypeProperty -> Bool
$sel:key:ActionTypeProperty' :: ActionTypeProperty -> Bool
$sel:optional:ActionTypeProperty' :: ActionTypeProperty -> Bool
$sel:name:ActionTypeProperty' :: ActionTypeProperty -> Text
$sel:queryable:ActionTypeProperty' :: ActionTypeProperty -> Maybe Bool
$sel:description:ActionTypeProperty' :: ActionTypeProperty -> 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
queryable
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Bool
optional
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Bool
key
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Bool
noEcho

instance Prelude.NFData ActionTypeProperty where
  rnf :: ActionTypeProperty -> ()
rnf ActionTypeProperty' {Bool
Maybe Bool
Maybe Text
Text
noEcho :: Bool
key :: Bool
optional :: Bool
name :: Text
queryable :: Maybe Bool
description :: Maybe Text
$sel:noEcho:ActionTypeProperty' :: ActionTypeProperty -> Bool
$sel:key:ActionTypeProperty' :: ActionTypeProperty -> Bool
$sel:optional:ActionTypeProperty' :: ActionTypeProperty -> Bool
$sel:name:ActionTypeProperty' :: ActionTypeProperty -> Text
$sel:queryable:ActionTypeProperty' :: ActionTypeProperty -> Maybe Bool
$sel:description:ActionTypeProperty' :: ActionTypeProperty -> 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
queryable
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Bool
optional
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Bool
key
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Bool
noEcho

instance Data.ToJSON ActionTypeProperty where
  toJSON :: ActionTypeProperty -> Value
toJSON ActionTypeProperty' {Bool
Maybe Bool
Maybe Text
Text
noEcho :: Bool
key :: Bool
optional :: Bool
name :: Text
queryable :: Maybe Bool
description :: Maybe Text
$sel:noEcho:ActionTypeProperty' :: ActionTypeProperty -> Bool
$sel:key:ActionTypeProperty' :: ActionTypeProperty -> Bool
$sel:optional:ActionTypeProperty' :: ActionTypeProperty -> Bool
$sel:name:ActionTypeProperty' :: ActionTypeProperty -> Text
$sel:queryable:ActionTypeProperty' :: ActionTypeProperty -> Maybe Bool
$sel:description:ActionTypeProperty' :: ActionTypeProperty -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"description" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
description,
            (Key
"queryable" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
queryable,
            forall a. a -> Maybe a
Prelude.Just (Key
"name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
name),
            forall a. a -> Maybe a
Prelude.Just (Key
"optional" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Bool
optional),
            forall a. a -> Maybe a
Prelude.Just (Key
"key" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Bool
key),
            forall a. a -> Maybe a
Prelude.Just (Key
"noEcho" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Bool
noEcho)
          ]
      )