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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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'
  { -- | 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 description of the property that is displayed to users.
    ActionTypeProperty -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | 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
(ActionTypeProperty -> ActionTypeProperty -> Bool)
-> (ActionTypeProperty -> ActionTypeProperty -> Bool)
-> Eq ActionTypeProperty
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]
(Int -> ReadS ActionTypeProperty)
-> ReadS [ActionTypeProperty]
-> ReadPrec ActionTypeProperty
-> ReadPrec [ActionTypeProperty]
-> Read 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
(Int -> ActionTypeProperty -> ShowS)
-> (ActionTypeProperty -> String)
-> ([ActionTypeProperty] -> ShowS)
-> Show ActionTypeProperty
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. ActionTypeProperty -> Rep ActionTypeProperty x)
-> (forall x. Rep ActionTypeProperty x -> ActionTypeProperty)
-> Generic ActionTypeProperty
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:
--
-- '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.
--
-- 'description', 'actionTypeProperty_description' - The description of the property that is displayed to users.
--
-- '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' :: Maybe Bool
-> Maybe Text -> Text -> Bool -> Bool -> Bool -> ActionTypeProperty
ActionTypeProperty'
      { $sel:queryable:ActionTypeProperty' :: Maybe Bool
queryable = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
        $sel:description:ActionTypeProperty' :: Maybe Text
description = Maybe Text
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_
      }

-- | 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 :: (Maybe Bool -> f (Maybe Bool))
-> ActionTypeProperty -> f ActionTypeProperty
actionTypeProperty_queryable = (ActionTypeProperty -> Maybe Bool)
-> (ActionTypeProperty -> Maybe Bool -> ActionTypeProperty)
-> Lens
     ActionTypeProperty ActionTypeProperty (Maybe Bool) (Maybe Bool)
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 description of the property that is displayed to users.
actionTypeProperty_description :: Lens.Lens' ActionTypeProperty (Prelude.Maybe Prelude.Text)
actionTypeProperty_description :: (Maybe Text -> f (Maybe Text))
-> ActionTypeProperty -> f ActionTypeProperty
actionTypeProperty_description = (ActionTypeProperty -> Maybe Text)
-> (ActionTypeProperty -> Maybe Text -> ActionTypeProperty)
-> Lens
     ActionTypeProperty ActionTypeProperty (Maybe Text) (Maybe Text)
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)

-- | The property name that is displayed to users.
actionTypeProperty_name :: Lens.Lens' ActionTypeProperty Prelude.Text
actionTypeProperty_name :: (Text -> f Text) -> ActionTypeProperty -> f ActionTypeProperty
actionTypeProperty_name = (ActionTypeProperty -> Text)
-> (ActionTypeProperty -> Text -> ActionTypeProperty)
-> Lens ActionTypeProperty ActionTypeProperty Text Text
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 :: (Bool -> f Bool) -> ActionTypeProperty -> f ActionTypeProperty
actionTypeProperty_optional = (ActionTypeProperty -> Bool)
-> (ActionTypeProperty -> Bool -> ActionTypeProperty)
-> Lens ActionTypeProperty ActionTypeProperty Bool Bool
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 :: (Bool -> f Bool) -> ActionTypeProperty -> f ActionTypeProperty
actionTypeProperty_key = (ActionTypeProperty -> Bool)
-> (ActionTypeProperty -> Bool -> ActionTypeProperty)
-> Lens ActionTypeProperty ActionTypeProperty Bool Bool
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 :: (Bool -> f Bool) -> ActionTypeProperty -> f ActionTypeProperty
actionTypeProperty_noEcho = (ActionTypeProperty -> Bool)
-> (ActionTypeProperty -> Bool -> ActionTypeProperty)
-> Lens ActionTypeProperty ActionTypeProperty Bool Bool
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 Core.FromJSON ActionTypeProperty where
  parseJSON :: Value -> Parser ActionTypeProperty
parseJSON =
    String
-> (Object -> Parser ActionTypeProperty)
-> Value
-> Parser ActionTypeProperty
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ActionTypeProperty"
      ( \Object
x ->
          Maybe Bool
-> Maybe Text -> Text -> Bool -> Bool -> Bool -> ActionTypeProperty
ActionTypeProperty'
            (Maybe Bool
 -> Maybe Text
 -> Text
 -> Bool
 -> Bool
 -> Bool
 -> ActionTypeProperty)
-> Parser (Maybe Bool)
-> Parser
     (Maybe Text -> Text -> Bool -> Bool -> Bool -> ActionTypeProperty)
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
"queryable")
            Parser
  (Maybe Text -> Text -> Bool -> Bool -> Bool -> ActionTypeProperty)
-> Parser (Maybe Text)
-> Parser (Text -> Bool -> Bool -> Bool -> ActionTypeProperty)
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 -> Bool -> Bool -> Bool -> ActionTypeProperty)
-> Parser Text
-> Parser (Bool -> Bool -> Bool -> ActionTypeProperty)
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 (Bool -> Bool -> Bool -> ActionTypeProperty)
-> Parser Bool -> Parser (Bool -> Bool -> ActionTypeProperty)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Bool
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"optional")
            Parser (Bool -> Bool -> ActionTypeProperty)
-> Parser Bool -> Parser (Bool -> ActionTypeProperty)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Bool
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"key")
            Parser (Bool -> ActionTypeProperty)
-> Parser Bool -> Parser ActionTypeProperty
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Bool
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"noEcho")
      )

instance Prelude.Hashable ActionTypeProperty

instance Prelude.NFData ActionTypeProperty

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