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

import qualified Amazonka.Core as Core
import Amazonka.HealthLake.Types.KmsEncryptionConfig
import qualified Amazonka.Lens as Lens
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
(SseConfiguration -> SseConfiguration -> Bool)
-> (SseConfiguration -> SseConfiguration -> Bool)
-> Eq SseConfiguration
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]
(Int -> ReadS SseConfiguration)
-> ReadS [SseConfiguration]
-> ReadPrec SseConfiguration
-> ReadPrec [SseConfiguration]
-> Read 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
(Int -> SseConfiguration -> ShowS)
-> (SseConfiguration -> String)
-> ([SseConfiguration] -> ShowS)
-> Show SseConfiguration
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. SseConfiguration -> Rep SseConfiguration x)
-> (forall x. Rep SseConfiguration x -> SseConfiguration)
-> Generic SseConfiguration
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' :: KmsEncryptionConfig -> SseConfiguration
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 :: (KmsEncryptionConfig -> f KmsEncryptionConfig)
-> SseConfiguration -> f SseConfiguration
sseConfiguration_kmsEncryptionConfig = (SseConfiguration -> KmsEncryptionConfig)
-> (SseConfiguration -> KmsEncryptionConfig -> SseConfiguration)
-> Lens
     SseConfiguration
     SseConfiguration
     KmsEncryptionConfig
     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 Core.FromJSON SseConfiguration where
  parseJSON :: Value -> Parser SseConfiguration
parseJSON =
    String
-> (Object -> Parser SseConfiguration)
-> Value
-> Parser SseConfiguration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"SseConfiguration"
      ( \Object
x ->
          KmsEncryptionConfig -> SseConfiguration
SseConfiguration'
            (KmsEncryptionConfig -> SseConfiguration)
-> Parser KmsEncryptionConfig -> Parser SseConfiguration
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser KmsEncryptionConfig
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"KmsEncryptionConfig")
      )

instance Prelude.Hashable SseConfiguration

instance Prelude.NFData SseConfiguration

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