{-# 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.Athena.Types.CustomerContentEncryptionConfiguration
-- 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.Athena.Types.CustomerContentEncryptionConfiguration 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

-- | Specifies the KMS key that is used to encrypt the user\'s data stores in
-- Athena.
--
-- /See:/ 'newCustomerContentEncryptionConfiguration' smart constructor.
data CustomerContentEncryptionConfiguration = CustomerContentEncryptionConfiguration'
  { -- | The KMS key that is used to encrypt the user\'s data stores in Athena.
    CustomerContentEncryptionConfiguration -> Text
kmsKey :: Prelude.Text
  }
  deriving (CustomerContentEncryptionConfiguration
-> CustomerContentEncryptionConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CustomerContentEncryptionConfiguration
-> CustomerContentEncryptionConfiguration -> Bool
$c/= :: CustomerContentEncryptionConfiguration
-> CustomerContentEncryptionConfiguration -> Bool
== :: CustomerContentEncryptionConfiguration
-> CustomerContentEncryptionConfiguration -> Bool
$c== :: CustomerContentEncryptionConfiguration
-> CustomerContentEncryptionConfiguration -> Bool
Prelude.Eq, ReadPrec [CustomerContentEncryptionConfiguration]
ReadPrec CustomerContentEncryptionConfiguration
Int -> ReadS CustomerContentEncryptionConfiguration
ReadS [CustomerContentEncryptionConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CustomerContentEncryptionConfiguration]
$creadListPrec :: ReadPrec [CustomerContentEncryptionConfiguration]
readPrec :: ReadPrec CustomerContentEncryptionConfiguration
$creadPrec :: ReadPrec CustomerContentEncryptionConfiguration
readList :: ReadS [CustomerContentEncryptionConfiguration]
$creadList :: ReadS [CustomerContentEncryptionConfiguration]
readsPrec :: Int -> ReadS CustomerContentEncryptionConfiguration
$creadsPrec :: Int -> ReadS CustomerContentEncryptionConfiguration
Prelude.Read, Int -> CustomerContentEncryptionConfiguration -> ShowS
[CustomerContentEncryptionConfiguration] -> ShowS
CustomerContentEncryptionConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CustomerContentEncryptionConfiguration] -> ShowS
$cshowList :: [CustomerContentEncryptionConfiguration] -> ShowS
show :: CustomerContentEncryptionConfiguration -> String
$cshow :: CustomerContentEncryptionConfiguration -> String
showsPrec :: Int -> CustomerContentEncryptionConfiguration -> ShowS
$cshowsPrec :: Int -> CustomerContentEncryptionConfiguration -> ShowS
Prelude.Show, forall x.
Rep CustomerContentEncryptionConfiguration x
-> CustomerContentEncryptionConfiguration
forall x.
CustomerContentEncryptionConfiguration
-> Rep CustomerContentEncryptionConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CustomerContentEncryptionConfiguration x
-> CustomerContentEncryptionConfiguration
$cfrom :: forall x.
CustomerContentEncryptionConfiguration
-> Rep CustomerContentEncryptionConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'CustomerContentEncryptionConfiguration' 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:
--
-- 'kmsKey', 'customerContentEncryptionConfiguration_kmsKey' - The KMS key that is used to encrypt the user\'s data stores in Athena.
newCustomerContentEncryptionConfiguration ::
  -- | 'kmsKey'
  Prelude.Text ->
  CustomerContentEncryptionConfiguration
newCustomerContentEncryptionConfiguration :: Text -> CustomerContentEncryptionConfiguration
newCustomerContentEncryptionConfiguration Text
pKmsKey_ =
  CustomerContentEncryptionConfiguration'
    { $sel:kmsKey:CustomerContentEncryptionConfiguration' :: Text
kmsKey =
        Text
pKmsKey_
    }

-- | The KMS key that is used to encrypt the user\'s data stores in Athena.
customerContentEncryptionConfiguration_kmsKey :: Lens.Lens' CustomerContentEncryptionConfiguration Prelude.Text
customerContentEncryptionConfiguration_kmsKey :: Lens' CustomerContentEncryptionConfiguration Text
customerContentEncryptionConfiguration_kmsKey = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomerContentEncryptionConfiguration' {Text
kmsKey :: Text
$sel:kmsKey:CustomerContentEncryptionConfiguration' :: CustomerContentEncryptionConfiguration -> Text
kmsKey} -> Text
kmsKey) (\s :: CustomerContentEncryptionConfiguration
s@CustomerContentEncryptionConfiguration' {} Text
a -> CustomerContentEncryptionConfiguration
s {$sel:kmsKey:CustomerContentEncryptionConfiguration' :: Text
kmsKey = Text
a} :: CustomerContentEncryptionConfiguration)

instance
  Data.FromJSON
    CustomerContentEncryptionConfiguration
  where
  parseJSON :: Value -> Parser CustomerContentEncryptionConfiguration
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"CustomerContentEncryptionConfiguration"
      ( \Object
x ->
          Text -> CustomerContentEncryptionConfiguration
CustomerContentEncryptionConfiguration'
            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
"KmsKey")
      )

instance
  Prelude.Hashable
    CustomerContentEncryptionConfiguration
  where
  hashWithSalt :: Int -> CustomerContentEncryptionConfiguration -> Int
hashWithSalt
    Int
_salt
    CustomerContentEncryptionConfiguration' {Text
kmsKey :: Text
$sel:kmsKey:CustomerContentEncryptionConfiguration' :: CustomerContentEncryptionConfiguration -> Text
..} =
      Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
kmsKey

instance
  Prelude.NFData
    CustomerContentEncryptionConfiguration
  where
  rnf :: CustomerContentEncryptionConfiguration -> ()
rnf CustomerContentEncryptionConfiguration' {Text
kmsKey :: Text
$sel:kmsKey:CustomerContentEncryptionConfiguration' :: CustomerContentEncryptionConfiguration -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
kmsKey

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