{-# 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.Config.Types.StaticValue
-- 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.Config.Types.StaticValue 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

-- | The static value of the resource.
--
-- /See:/ 'newStaticValue' smart constructor.
data StaticValue = StaticValue'
  { -- | A list of values. For example, the ARN of the assumed role.
    StaticValue -> [Text]
values :: [Prelude.Text]
  }
  deriving (StaticValue -> StaticValue -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StaticValue -> StaticValue -> Bool
$c/= :: StaticValue -> StaticValue -> Bool
== :: StaticValue -> StaticValue -> Bool
$c== :: StaticValue -> StaticValue -> Bool
Prelude.Eq, ReadPrec [StaticValue]
ReadPrec StaticValue
Int -> ReadS StaticValue
ReadS [StaticValue]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StaticValue]
$creadListPrec :: ReadPrec [StaticValue]
readPrec :: ReadPrec StaticValue
$creadPrec :: ReadPrec StaticValue
readList :: ReadS [StaticValue]
$creadList :: ReadS [StaticValue]
readsPrec :: Int -> ReadS StaticValue
$creadsPrec :: Int -> ReadS StaticValue
Prelude.Read, Int -> StaticValue -> ShowS
[StaticValue] -> ShowS
StaticValue -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StaticValue] -> ShowS
$cshowList :: [StaticValue] -> ShowS
show :: StaticValue -> String
$cshow :: StaticValue -> String
showsPrec :: Int -> StaticValue -> ShowS
$cshowsPrec :: Int -> StaticValue -> ShowS
Prelude.Show, forall x. Rep StaticValue x -> StaticValue
forall x. StaticValue -> Rep StaticValue x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StaticValue x -> StaticValue
$cfrom :: forall x. StaticValue -> Rep StaticValue x
Prelude.Generic)

-- |
-- Create a value of 'StaticValue' 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:
--
-- 'values', 'staticValue_values' - A list of values. For example, the ARN of the assumed role.
newStaticValue ::
  StaticValue
newStaticValue :: StaticValue
newStaticValue =
  StaticValue' {$sel:values:StaticValue' :: [Text]
values = forall a. Monoid a => a
Prelude.mempty}

-- | A list of values. For example, the ARN of the assumed role.
staticValue_values :: Lens.Lens' StaticValue [Prelude.Text]
staticValue_values :: Lens' StaticValue [Text]
staticValue_values = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StaticValue' {[Text]
values :: [Text]
$sel:values:StaticValue' :: StaticValue -> [Text]
values} -> [Text]
values) (\s :: StaticValue
s@StaticValue' {} [Text]
a -> StaticValue
s {$sel:values:StaticValue' :: [Text]
values = [Text]
a} :: StaticValue) 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 StaticValue where
  parseJSON :: Value -> Parser StaticValue
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"StaticValue"
      ( \Object
x ->
          [Text] -> StaticValue
StaticValue'
            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
"Values" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable StaticValue where
  hashWithSalt :: Int -> StaticValue -> Int
hashWithSalt Int
_salt StaticValue' {[Text]
values :: [Text]
$sel:values:StaticValue' :: StaticValue -> [Text]
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [Text]
values

instance Prelude.NFData StaticValue where
  rnf :: StaticValue -> ()
rnf StaticValue' {[Text]
values :: [Text]
$sel:values:StaticValue' :: StaticValue -> [Text]
..} = forall a. NFData a => a -> ()
Prelude.rnf [Text]
values

instance Data.ToJSON StaticValue where
  toJSON :: StaticValue -> Value
toJSON StaticValue' {[Text]
values :: [Text]
$sel:values:StaticValue' :: StaticValue -> [Text]
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [forall a. a -> Maybe a
Prelude.Just (Key
"Values" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= [Text]
values)]
      )