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

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

-- | Represents information about an action configuration.
--
-- /See:/ 'newActionConfiguration' smart constructor.
data ActionConfiguration = ActionConfiguration'
  { -- | The configuration data for the action.
    ActionConfiguration -> Maybe (HashMap Text Text)
configuration :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text)
  }
  deriving (ActionConfiguration -> ActionConfiguration -> Bool
(ActionConfiguration -> ActionConfiguration -> Bool)
-> (ActionConfiguration -> ActionConfiguration -> Bool)
-> Eq ActionConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ActionConfiguration -> ActionConfiguration -> Bool
$c/= :: ActionConfiguration -> ActionConfiguration -> Bool
== :: ActionConfiguration -> ActionConfiguration -> Bool
$c== :: ActionConfiguration -> ActionConfiguration -> Bool
Prelude.Eq, ReadPrec [ActionConfiguration]
ReadPrec ActionConfiguration
Int -> ReadS ActionConfiguration
ReadS [ActionConfiguration]
(Int -> ReadS ActionConfiguration)
-> ReadS [ActionConfiguration]
-> ReadPrec ActionConfiguration
-> ReadPrec [ActionConfiguration]
-> Read ActionConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ActionConfiguration]
$creadListPrec :: ReadPrec [ActionConfiguration]
readPrec :: ReadPrec ActionConfiguration
$creadPrec :: ReadPrec ActionConfiguration
readList :: ReadS [ActionConfiguration]
$creadList :: ReadS [ActionConfiguration]
readsPrec :: Int -> ReadS ActionConfiguration
$creadsPrec :: Int -> ReadS ActionConfiguration
Prelude.Read, Int -> ActionConfiguration -> ShowS
[ActionConfiguration] -> ShowS
ActionConfiguration -> String
(Int -> ActionConfiguration -> ShowS)
-> (ActionConfiguration -> String)
-> ([ActionConfiguration] -> ShowS)
-> Show ActionConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ActionConfiguration] -> ShowS
$cshowList :: [ActionConfiguration] -> ShowS
show :: ActionConfiguration -> String
$cshow :: ActionConfiguration -> String
showsPrec :: Int -> ActionConfiguration -> ShowS
$cshowsPrec :: Int -> ActionConfiguration -> ShowS
Prelude.Show, (forall x. ActionConfiguration -> Rep ActionConfiguration x)
-> (forall x. Rep ActionConfiguration x -> ActionConfiguration)
-> Generic ActionConfiguration
forall x. Rep ActionConfiguration x -> ActionConfiguration
forall x. ActionConfiguration -> Rep ActionConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ActionConfiguration x -> ActionConfiguration
$cfrom :: forall x. ActionConfiguration -> Rep ActionConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'ActionConfiguration' 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:
--
-- 'configuration', 'actionConfiguration_configuration' - The configuration data for the action.
newActionConfiguration ::
  ActionConfiguration
newActionConfiguration :: ActionConfiguration
newActionConfiguration =
  ActionConfiguration' :: Maybe (HashMap Text Text) -> ActionConfiguration
ActionConfiguration'
    { $sel:configuration:ActionConfiguration' :: Maybe (HashMap Text Text)
configuration =
        Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing
    }

-- | The configuration data for the action.
actionConfiguration_configuration :: Lens.Lens' ActionConfiguration (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
actionConfiguration_configuration :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> ActionConfiguration -> f ActionConfiguration
actionConfiguration_configuration = (ActionConfiguration -> Maybe (HashMap Text Text))
-> (ActionConfiguration
    -> Maybe (HashMap Text Text) -> ActionConfiguration)
-> Lens
     ActionConfiguration
     ActionConfiguration
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActionConfiguration' {Maybe (HashMap Text Text)
configuration :: Maybe (HashMap Text Text)
$sel:configuration:ActionConfiguration' :: ActionConfiguration -> Maybe (HashMap Text Text)
configuration} -> Maybe (HashMap Text Text)
configuration) (\s :: ActionConfiguration
s@ActionConfiguration' {} Maybe (HashMap Text Text)
a -> ActionConfiguration
s {$sel:configuration:ActionConfiguration' :: Maybe (HashMap Text Text)
configuration = Maybe (HashMap Text Text)
a} :: ActionConfiguration) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> ActionConfiguration -> f ActionConfiguration)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> ActionConfiguration
-> f ActionConfiguration
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON ActionConfiguration where
  parseJSON :: Value -> Parser ActionConfiguration
parseJSON =
    String
-> (Object -> Parser ActionConfiguration)
-> Value
-> Parser ActionConfiguration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ActionConfiguration"
      ( \Object
x ->
          Maybe (HashMap Text Text) -> ActionConfiguration
ActionConfiguration'
            (Maybe (HashMap Text Text) -> ActionConfiguration)
-> Parser (Maybe (HashMap Text Text)) -> Parser ActionConfiguration
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Maybe (HashMap Text Text)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"configuration" Parser (Maybe (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> Parser (Maybe (HashMap Text Text))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text Text)
forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable ActionConfiguration

instance Prelude.NFData ActionConfiguration