{-# 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.ActionConfigurationProperty
-- 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.ActionConfigurationProperty where

import Amazonka.CodePipeline.Types.ActionConfigurationPropertyType
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 an action configuration property.
--
-- /See:/ 'newActionConfigurationProperty' smart constructor.
data ActionConfigurationProperty = ActionConfigurationProperty'
  { -- | The description of the action configuration property that is displayed
    -- to users.
    ActionConfigurationProperty -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | Indicates that the property is used with @PollForJobs@. When creating a
    -- custom action, an action can have up to one queryable property. If it
    -- has one, that property must be both required and not secret.
    --
    -- If you create a pipeline with a custom action type, and that custom
    -- action contains a queryable property, the value for that configuration
    -- property is subject to other restrictions. The value must be less than
    -- or equal to twenty (20) characters. The value can contain only
    -- alphanumeric characters, underscores, and hyphens.
    ActionConfigurationProperty -> Maybe Bool
queryable :: Prelude.Maybe Prelude.Bool,
    -- | The type of the configuration property.
    ActionConfigurationProperty
-> Maybe ActionConfigurationPropertyType
type' :: Prelude.Maybe ActionConfigurationPropertyType,
    -- | The name of the action configuration property.
    ActionConfigurationProperty -> Text
name :: Prelude.Text,
    -- | Whether the configuration property is a required value.
    ActionConfigurationProperty -> Bool
required :: Prelude.Bool,
    -- | Whether the configuration property is a key.
    ActionConfigurationProperty -> Bool
key :: Prelude.Bool,
    -- | Whether the configuration property is secret. Secrets are hidden from
    -- all calls except for @GetJobDetails@, @GetThirdPartyJobDetails@,
    -- @PollForJobs@, and @PollForThirdPartyJobs@.
    --
    -- When updating a pipeline, passing * * * * * without changing any other
    -- values of the action preserves the previous value of the secret.
    ActionConfigurationProperty -> Bool
secret :: Prelude.Bool
  }
  deriving (ActionConfigurationProperty -> ActionConfigurationProperty -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ActionConfigurationProperty -> ActionConfigurationProperty -> Bool
$c/= :: ActionConfigurationProperty -> ActionConfigurationProperty -> Bool
== :: ActionConfigurationProperty -> ActionConfigurationProperty -> Bool
$c== :: ActionConfigurationProperty -> ActionConfigurationProperty -> Bool
Prelude.Eq, ReadPrec [ActionConfigurationProperty]
ReadPrec ActionConfigurationProperty
Int -> ReadS ActionConfigurationProperty
ReadS [ActionConfigurationProperty]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ActionConfigurationProperty]
$creadListPrec :: ReadPrec [ActionConfigurationProperty]
readPrec :: ReadPrec ActionConfigurationProperty
$creadPrec :: ReadPrec ActionConfigurationProperty
readList :: ReadS [ActionConfigurationProperty]
$creadList :: ReadS [ActionConfigurationProperty]
readsPrec :: Int -> ReadS ActionConfigurationProperty
$creadsPrec :: Int -> ReadS ActionConfigurationProperty
Prelude.Read, Int -> ActionConfigurationProperty -> ShowS
[ActionConfigurationProperty] -> ShowS
ActionConfigurationProperty -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ActionConfigurationProperty] -> ShowS
$cshowList :: [ActionConfigurationProperty] -> ShowS
show :: ActionConfigurationProperty -> String
$cshow :: ActionConfigurationProperty -> String
showsPrec :: Int -> ActionConfigurationProperty -> ShowS
$cshowsPrec :: Int -> ActionConfigurationProperty -> ShowS
Prelude.Show, forall x.
Rep ActionConfigurationProperty x -> ActionConfigurationProperty
forall x.
ActionConfigurationProperty -> Rep ActionConfigurationProperty x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ActionConfigurationProperty x -> ActionConfigurationProperty
$cfrom :: forall x.
ActionConfigurationProperty -> Rep ActionConfigurationProperty x
Prelude.Generic)

-- |
-- Create a value of 'ActionConfigurationProperty' 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', 'actionConfigurationProperty_description' - The description of the action configuration property that is displayed
-- to users.
--
-- 'queryable', 'actionConfigurationProperty_queryable' - Indicates that the property is used with @PollForJobs@. When creating a
-- custom action, an action can have up to one queryable property. If it
-- has one, that property must be both required and not secret.
--
-- If you create a pipeline with a custom action type, and that custom
-- action contains a queryable property, the value for that configuration
-- property is subject to other restrictions. The value must be less than
-- or equal to twenty (20) characters. The value can contain only
-- alphanumeric characters, underscores, and hyphens.
--
-- 'type'', 'actionConfigurationProperty_type' - The type of the configuration property.
--
-- 'name', 'actionConfigurationProperty_name' - The name of the action configuration property.
--
-- 'required', 'actionConfigurationProperty_required' - Whether the configuration property is a required value.
--
-- 'key', 'actionConfigurationProperty_key' - Whether the configuration property is a key.
--
-- 'secret', 'actionConfigurationProperty_secret' - Whether the configuration property is secret. Secrets are hidden from
-- all calls except for @GetJobDetails@, @GetThirdPartyJobDetails@,
-- @PollForJobs@, and @PollForThirdPartyJobs@.
--
-- When updating a pipeline, passing * * * * * without changing any other
-- values of the action preserves the previous value of the secret.
newActionConfigurationProperty ::
  -- | 'name'
  Prelude.Text ->
  -- | 'required'
  Prelude.Bool ->
  -- | 'key'
  Prelude.Bool ->
  -- | 'secret'
  Prelude.Bool ->
  ActionConfigurationProperty
newActionConfigurationProperty :: Text -> Bool -> Bool -> Bool -> ActionConfigurationProperty
newActionConfigurationProperty
  Text
pName_
  Bool
pRequired_
  Bool
pKey_
  Bool
pSecret_ =
    ActionConfigurationProperty'
      { $sel:description:ActionConfigurationProperty' :: Maybe Text
description =
          forall a. Maybe a
Prelude.Nothing,
        $sel:queryable:ActionConfigurationProperty' :: Maybe Bool
queryable = forall a. Maybe a
Prelude.Nothing,
        $sel:type':ActionConfigurationProperty' :: Maybe ActionConfigurationPropertyType
type' = forall a. Maybe a
Prelude.Nothing,
        $sel:name:ActionConfigurationProperty' :: Text
name = Text
pName_,
        $sel:required:ActionConfigurationProperty' :: Bool
required = Bool
pRequired_,
        $sel:key:ActionConfigurationProperty' :: Bool
key = Bool
pKey_,
        $sel:secret:ActionConfigurationProperty' :: Bool
secret = Bool
pSecret_
      }

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

-- | Indicates that the property is used with @PollForJobs@. When creating a
-- custom action, an action can have up to one queryable property. If it
-- has one, that property must be both required and not secret.
--
-- If you create a pipeline with a custom action type, and that custom
-- action contains a queryable property, the value for that configuration
-- property is subject to other restrictions. The value must be less than
-- or equal to twenty (20) characters. The value can contain only
-- alphanumeric characters, underscores, and hyphens.
actionConfigurationProperty_queryable :: Lens.Lens' ActionConfigurationProperty (Prelude.Maybe Prelude.Bool)
actionConfigurationProperty_queryable :: Lens' ActionConfigurationProperty (Maybe Bool)
actionConfigurationProperty_queryable = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActionConfigurationProperty' {Maybe Bool
queryable :: Maybe Bool
$sel:queryable:ActionConfigurationProperty' :: ActionConfigurationProperty -> Maybe Bool
queryable} -> Maybe Bool
queryable) (\s :: ActionConfigurationProperty
s@ActionConfigurationProperty' {} Maybe Bool
a -> ActionConfigurationProperty
s {$sel:queryable:ActionConfigurationProperty' :: Maybe Bool
queryable = Maybe Bool
a} :: ActionConfigurationProperty)

-- | The type of the configuration property.
actionConfigurationProperty_type :: Lens.Lens' ActionConfigurationProperty (Prelude.Maybe ActionConfigurationPropertyType)
actionConfigurationProperty_type :: Lens'
  ActionConfigurationProperty (Maybe ActionConfigurationPropertyType)
actionConfigurationProperty_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActionConfigurationProperty' {Maybe ActionConfigurationPropertyType
type' :: Maybe ActionConfigurationPropertyType
$sel:type':ActionConfigurationProperty' :: ActionConfigurationProperty
-> Maybe ActionConfigurationPropertyType
type'} -> Maybe ActionConfigurationPropertyType
type') (\s :: ActionConfigurationProperty
s@ActionConfigurationProperty' {} Maybe ActionConfigurationPropertyType
a -> ActionConfigurationProperty
s {$sel:type':ActionConfigurationProperty' :: Maybe ActionConfigurationPropertyType
type' = Maybe ActionConfigurationPropertyType
a} :: ActionConfigurationProperty)

-- | The name of the action configuration property.
actionConfigurationProperty_name :: Lens.Lens' ActionConfigurationProperty Prelude.Text
actionConfigurationProperty_name :: Lens' ActionConfigurationProperty Text
actionConfigurationProperty_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActionConfigurationProperty' {Text
name :: Text
$sel:name:ActionConfigurationProperty' :: ActionConfigurationProperty -> Text
name} -> Text
name) (\s :: ActionConfigurationProperty
s@ActionConfigurationProperty' {} Text
a -> ActionConfigurationProperty
s {$sel:name:ActionConfigurationProperty' :: Text
name = Text
a} :: ActionConfigurationProperty)

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

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

-- | Whether the configuration property is secret. Secrets are hidden from
-- all calls except for @GetJobDetails@, @GetThirdPartyJobDetails@,
-- @PollForJobs@, and @PollForThirdPartyJobs@.
--
-- When updating a pipeline, passing * * * * * without changing any other
-- values of the action preserves the previous value of the secret.
actionConfigurationProperty_secret :: Lens.Lens' ActionConfigurationProperty Prelude.Bool
actionConfigurationProperty_secret :: Lens' ActionConfigurationProperty Bool
actionConfigurationProperty_secret = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActionConfigurationProperty' {Bool
secret :: Bool
$sel:secret:ActionConfigurationProperty' :: ActionConfigurationProperty -> Bool
secret} -> Bool
secret) (\s :: ActionConfigurationProperty
s@ActionConfigurationProperty' {} Bool
a -> ActionConfigurationProperty
s {$sel:secret:ActionConfigurationProperty' :: Bool
secret = Bool
a} :: ActionConfigurationProperty)

instance Data.FromJSON ActionConfigurationProperty where
  parseJSON :: Value -> Parser ActionConfigurationProperty
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ActionConfigurationProperty"
      ( \Object
x ->
          Maybe Text
-> Maybe Bool
-> Maybe ActionConfigurationPropertyType
-> Text
-> Bool
-> Bool
-> Bool
-> ActionConfigurationProperty
ActionConfigurationProperty'
            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 (Maybe a)
Data..:? Key
"type")
            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
"required")
            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
"secret")
      )

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

instance Prelude.NFData ActionConfigurationProperty where
  rnf :: ActionConfigurationProperty -> ()
rnf ActionConfigurationProperty' {Bool
Maybe Bool
Maybe Text
Maybe ActionConfigurationPropertyType
Text
secret :: Bool
key :: Bool
required :: Bool
name :: Text
type' :: Maybe ActionConfigurationPropertyType
queryable :: Maybe Bool
description :: Maybe Text
$sel:secret:ActionConfigurationProperty' :: ActionConfigurationProperty -> Bool
$sel:key:ActionConfigurationProperty' :: ActionConfigurationProperty -> Bool
$sel:required:ActionConfigurationProperty' :: ActionConfigurationProperty -> Bool
$sel:name:ActionConfigurationProperty' :: ActionConfigurationProperty -> Text
$sel:type':ActionConfigurationProperty' :: ActionConfigurationProperty
-> Maybe ActionConfigurationPropertyType
$sel:queryable:ActionConfigurationProperty' :: ActionConfigurationProperty -> Maybe Bool
$sel:description:ActionConfigurationProperty' :: ActionConfigurationProperty -> 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 Maybe ActionConfigurationPropertyType
type'
      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
required
      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
secret

instance Data.ToJSON ActionConfigurationProperty where
  toJSON :: ActionConfigurationProperty -> Value
toJSON ActionConfigurationProperty' {Bool
Maybe Bool
Maybe Text
Maybe ActionConfigurationPropertyType
Text
secret :: Bool
key :: Bool
required :: Bool
name :: Text
type' :: Maybe ActionConfigurationPropertyType
queryable :: Maybe Bool
description :: Maybe Text
$sel:secret:ActionConfigurationProperty' :: ActionConfigurationProperty -> Bool
$sel:key:ActionConfigurationProperty' :: ActionConfigurationProperty -> Bool
$sel:required:ActionConfigurationProperty' :: ActionConfigurationProperty -> Bool
$sel:name:ActionConfigurationProperty' :: ActionConfigurationProperty -> Text
$sel:type':ActionConfigurationProperty' :: ActionConfigurationProperty
-> Maybe ActionConfigurationPropertyType
$sel:queryable:ActionConfigurationProperty' :: ActionConfigurationProperty -> Maybe Bool
$sel:description:ActionConfigurationProperty' :: ActionConfigurationProperty -> 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,
            (Key
"type" 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 ActionConfigurationPropertyType
type',
            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
"required" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Bool
required),
            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
"secret" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Bool
secret)
          ]
      )