{-# 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.QuickSight.Types.CustomActionSetParametersOperation
-- 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.QuickSight.Types.CustomActionSetParametersOperation 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
import Amazonka.QuickSight.Types.SetParameterValueConfiguration

-- | The set parameter operation that sets parameters in custom action.
--
-- /See:/ 'newCustomActionSetParametersOperation' smart constructor.
data CustomActionSetParametersOperation = CustomActionSetParametersOperation'
  { -- | The parameter that determines the value configuration.
    CustomActionSetParametersOperation
-> NonEmpty SetParameterValueConfiguration
parameterValueConfigurations :: Prelude.NonEmpty SetParameterValueConfiguration
  }
  deriving (CustomActionSetParametersOperation
-> CustomActionSetParametersOperation -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CustomActionSetParametersOperation
-> CustomActionSetParametersOperation -> Bool
$c/= :: CustomActionSetParametersOperation
-> CustomActionSetParametersOperation -> Bool
== :: CustomActionSetParametersOperation
-> CustomActionSetParametersOperation -> Bool
$c== :: CustomActionSetParametersOperation
-> CustomActionSetParametersOperation -> Bool
Prelude.Eq, Int -> CustomActionSetParametersOperation -> ShowS
[CustomActionSetParametersOperation] -> ShowS
CustomActionSetParametersOperation -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CustomActionSetParametersOperation] -> ShowS
$cshowList :: [CustomActionSetParametersOperation] -> ShowS
show :: CustomActionSetParametersOperation -> String
$cshow :: CustomActionSetParametersOperation -> String
showsPrec :: Int -> CustomActionSetParametersOperation -> ShowS
$cshowsPrec :: Int -> CustomActionSetParametersOperation -> ShowS
Prelude.Show, forall x.
Rep CustomActionSetParametersOperation x
-> CustomActionSetParametersOperation
forall x.
CustomActionSetParametersOperation
-> Rep CustomActionSetParametersOperation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CustomActionSetParametersOperation x
-> CustomActionSetParametersOperation
$cfrom :: forall x.
CustomActionSetParametersOperation
-> Rep CustomActionSetParametersOperation x
Prelude.Generic)

-- |
-- Create a value of 'CustomActionSetParametersOperation' 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:
--
-- 'parameterValueConfigurations', 'customActionSetParametersOperation_parameterValueConfigurations' - The parameter that determines the value configuration.
newCustomActionSetParametersOperation ::
  -- | 'parameterValueConfigurations'
  Prelude.NonEmpty SetParameterValueConfiguration ->
  CustomActionSetParametersOperation
newCustomActionSetParametersOperation :: NonEmpty SetParameterValueConfiguration
-> CustomActionSetParametersOperation
newCustomActionSetParametersOperation
  NonEmpty SetParameterValueConfiguration
pParameterValueConfigurations_ =
    CustomActionSetParametersOperation'
      { $sel:parameterValueConfigurations:CustomActionSetParametersOperation' :: NonEmpty SetParameterValueConfiguration
parameterValueConfigurations =
          forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
            forall t b. AReview t b -> b -> t
Lens.# NonEmpty SetParameterValueConfiguration
pParameterValueConfigurations_
      }

-- | The parameter that determines the value configuration.
customActionSetParametersOperation_parameterValueConfigurations :: Lens.Lens' CustomActionSetParametersOperation (Prelude.NonEmpty SetParameterValueConfiguration)
customActionSetParametersOperation_parameterValueConfigurations :: Lens'
  CustomActionSetParametersOperation
  (NonEmpty SetParameterValueConfiguration)
customActionSetParametersOperation_parameterValueConfigurations = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomActionSetParametersOperation' {NonEmpty SetParameterValueConfiguration
parameterValueConfigurations :: NonEmpty SetParameterValueConfiguration
$sel:parameterValueConfigurations:CustomActionSetParametersOperation' :: CustomActionSetParametersOperation
-> NonEmpty SetParameterValueConfiguration
parameterValueConfigurations} -> NonEmpty SetParameterValueConfiguration
parameterValueConfigurations) (\s :: CustomActionSetParametersOperation
s@CustomActionSetParametersOperation' {} NonEmpty SetParameterValueConfiguration
a -> CustomActionSetParametersOperation
s {$sel:parameterValueConfigurations:CustomActionSetParametersOperation' :: NonEmpty SetParameterValueConfiguration
parameterValueConfigurations = NonEmpty SetParameterValueConfiguration
a} :: CustomActionSetParametersOperation) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance
  Data.FromJSON
    CustomActionSetParametersOperation
  where
  parseJSON :: Value -> Parser CustomActionSetParametersOperation
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"CustomActionSetParametersOperation"
      ( \Object
x ->
          NonEmpty SetParameterValueConfiguration
-> CustomActionSetParametersOperation
CustomActionSetParametersOperation'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"ParameterValueConfigurations")
      )

instance
  Prelude.Hashable
    CustomActionSetParametersOperation
  where
  hashWithSalt :: Int -> CustomActionSetParametersOperation -> Int
hashWithSalt
    Int
_salt
    CustomActionSetParametersOperation' {NonEmpty SetParameterValueConfiguration
parameterValueConfigurations :: NonEmpty SetParameterValueConfiguration
$sel:parameterValueConfigurations:CustomActionSetParametersOperation' :: CustomActionSetParametersOperation
-> NonEmpty SetParameterValueConfiguration
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` NonEmpty SetParameterValueConfiguration
parameterValueConfigurations

instance
  Prelude.NFData
    CustomActionSetParametersOperation
  where
  rnf :: CustomActionSetParametersOperation -> ()
rnf CustomActionSetParametersOperation' {NonEmpty SetParameterValueConfiguration
parameterValueConfigurations :: NonEmpty SetParameterValueConfiguration
$sel:parameterValueConfigurations:CustomActionSetParametersOperation' :: CustomActionSetParametersOperation
-> NonEmpty SetParameterValueConfiguration
..} =
    forall a. NFData a => a -> ()
Prelude.rnf NonEmpty SetParameterValueConfiguration
parameterValueConfigurations

instance
  Data.ToJSON
    CustomActionSetParametersOperation
  where
  toJSON :: CustomActionSetParametersOperation -> Value
toJSON CustomActionSetParametersOperation' {NonEmpty SetParameterValueConfiguration
parameterValueConfigurations :: NonEmpty SetParameterValueConfiguration
$sel:parameterValueConfigurations:CustomActionSetParametersOperation' :: CustomActionSetParametersOperation
-> NonEmpty SetParameterValueConfiguration
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              ( Key
"ParameterValueConfigurations"
                  forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= NonEmpty SetParameterValueConfiguration
parameterValueConfigurations
              )
          ]
      )