{-# 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.HealthLake.Types.SseConfiguration
-- 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.HealthLake.Types.SseConfiguration where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.HealthLake.Types.KmsEncryptionConfig
import qualified Amazonka.Prelude as Prelude

-- | The server-side encryption key configuration for a customer provided
-- encryption key.
--
-- /See:/ 'newSseConfiguration' smart constructor.
data SseConfiguration = SseConfiguration'
  { -- | The KMS encryption configuration used to provide details for data
    -- encryption.
    SseConfiguration -> KmsEncryptionConfig
kmsEncryptionConfig :: KmsEncryptionConfig
  }
  deriving (SseConfiguration -> SseConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SseConfiguration -> SseConfiguration -> Bool
$c/= :: SseConfiguration -> SseConfiguration -> Bool
== :: SseConfiguration -> SseConfiguration -> Bool
$c== :: SseConfiguration -> SseConfiguration -> Bool
Prelude.Eq, ReadPrec [SseConfiguration]
ReadPrec SseConfiguration
Int -> ReadS SseConfiguration
ReadS [SseConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SseConfiguration]
$creadListPrec :: ReadPrec [SseConfiguration]
readPrec :: ReadPrec SseConfiguration
$creadPrec :: ReadPrec SseConfiguration
readList :: ReadS [SseConfiguration]
$creadList :: ReadS [SseConfiguration]
readsPrec :: Int -> ReadS SseConfiguration
$creadsPrec :: Int -> ReadS SseConfiguration
Prelude.Read, Int -> SseConfiguration -> ShowS
[SseConfiguration] -> ShowS
SseConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SseConfiguration] -> ShowS
$cshowList :: [SseConfiguration] -> ShowS
show :: SseConfiguration -> String
$cshow :: SseConfiguration -> String
showsPrec :: Int -> SseConfiguration -> ShowS
$cshowsPrec :: Int -> SseConfiguration -> ShowS
Prelude.Show, forall x. Rep SseConfiguration x -> SseConfiguration
forall x. SseConfiguration -> Rep SseConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SseConfiguration x -> SseConfiguration
$cfrom :: forall x. SseConfiguration -> Rep SseConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'SseConfiguration' 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:
--
-- 'kmsEncryptionConfig', 'sseConfiguration_kmsEncryptionConfig' - The KMS encryption configuration used to provide details for data
-- encryption.
newSseConfiguration ::
  -- | 'kmsEncryptionConfig'
  KmsEncryptionConfig ->
  SseConfiguration
newSseConfiguration :: KmsEncryptionConfig -> SseConfiguration
newSseConfiguration KmsEncryptionConfig
pKmsEncryptionConfig_ =
  SseConfiguration'
    { $sel:kmsEncryptionConfig:SseConfiguration' :: KmsEncryptionConfig
kmsEncryptionConfig =
        KmsEncryptionConfig
pKmsEncryptionConfig_
    }

-- | The KMS encryption configuration used to provide details for data
-- encryption.
sseConfiguration_kmsEncryptionConfig :: Lens.Lens' SseConfiguration KmsEncryptionConfig
sseConfiguration_kmsEncryptionConfig :: Lens' SseConfiguration KmsEncryptionConfig
sseConfiguration_kmsEncryptionConfig = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SseConfiguration' {KmsEncryptionConfig
kmsEncryptionConfig :: KmsEncryptionConfig
$sel:kmsEncryptionConfig:SseConfiguration' :: SseConfiguration -> KmsEncryptionConfig
kmsEncryptionConfig} -> KmsEncryptionConfig
kmsEncryptionConfig) (\s :: SseConfiguration
s@SseConfiguration' {} KmsEncryptionConfig
a -> SseConfiguration
s {$sel:kmsEncryptionConfig:SseConfiguration' :: KmsEncryptionConfig
kmsEncryptionConfig = KmsEncryptionConfig
a} :: SseConfiguration)

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

instance Prelude.Hashable SseConfiguration where
  hashWithSalt :: Int -> SseConfiguration -> Int
hashWithSalt Int
_salt SseConfiguration' {KmsEncryptionConfig
kmsEncryptionConfig :: KmsEncryptionConfig
$sel:kmsEncryptionConfig:SseConfiguration' :: SseConfiguration -> KmsEncryptionConfig
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` KmsEncryptionConfig
kmsEncryptionConfig

instance Prelude.NFData SseConfiguration where
  rnf :: SseConfiguration -> ()
rnf SseConfiguration' {KmsEncryptionConfig
kmsEncryptionConfig :: KmsEncryptionConfig
$sel:kmsEncryptionConfig:SseConfiguration' :: SseConfiguration -> KmsEncryptionConfig
..} =
    forall a. NFData a => a -> ()
Prelude.rnf KmsEncryptionConfig
kmsEncryptionConfig

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