{-# 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.Glue.Types.JobBookmarksEncryption
-- 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.Glue.Types.JobBookmarksEncryption where

import qualified Amazonka.Core as Core
import Amazonka.Glue.Types.JobBookmarksEncryptionMode
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Specifies how job bookmark data should be encrypted.
--
-- /See:/ 'newJobBookmarksEncryption' smart constructor.
data JobBookmarksEncryption = JobBookmarksEncryption'
  { -- | The encryption mode to use for job bookmarks data.
    JobBookmarksEncryption -> Maybe JobBookmarksEncryptionMode
jobBookmarksEncryptionMode :: Prelude.Maybe JobBookmarksEncryptionMode,
    -- | The Amazon Resource Name (ARN) of the KMS key to be used to encrypt the
    -- data.
    JobBookmarksEncryption -> Maybe Text
kmsKeyArn :: Prelude.Maybe Prelude.Text
  }
  deriving (JobBookmarksEncryption -> JobBookmarksEncryption -> Bool
(JobBookmarksEncryption -> JobBookmarksEncryption -> Bool)
-> (JobBookmarksEncryption -> JobBookmarksEncryption -> Bool)
-> Eq JobBookmarksEncryption
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: JobBookmarksEncryption -> JobBookmarksEncryption -> Bool
$c/= :: JobBookmarksEncryption -> JobBookmarksEncryption -> Bool
== :: JobBookmarksEncryption -> JobBookmarksEncryption -> Bool
$c== :: JobBookmarksEncryption -> JobBookmarksEncryption -> Bool
Prelude.Eq, ReadPrec [JobBookmarksEncryption]
ReadPrec JobBookmarksEncryption
Int -> ReadS JobBookmarksEncryption
ReadS [JobBookmarksEncryption]
(Int -> ReadS JobBookmarksEncryption)
-> ReadS [JobBookmarksEncryption]
-> ReadPrec JobBookmarksEncryption
-> ReadPrec [JobBookmarksEncryption]
-> Read JobBookmarksEncryption
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [JobBookmarksEncryption]
$creadListPrec :: ReadPrec [JobBookmarksEncryption]
readPrec :: ReadPrec JobBookmarksEncryption
$creadPrec :: ReadPrec JobBookmarksEncryption
readList :: ReadS [JobBookmarksEncryption]
$creadList :: ReadS [JobBookmarksEncryption]
readsPrec :: Int -> ReadS JobBookmarksEncryption
$creadsPrec :: Int -> ReadS JobBookmarksEncryption
Prelude.Read, Int -> JobBookmarksEncryption -> ShowS
[JobBookmarksEncryption] -> ShowS
JobBookmarksEncryption -> String
(Int -> JobBookmarksEncryption -> ShowS)
-> (JobBookmarksEncryption -> String)
-> ([JobBookmarksEncryption] -> ShowS)
-> Show JobBookmarksEncryption
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [JobBookmarksEncryption] -> ShowS
$cshowList :: [JobBookmarksEncryption] -> ShowS
show :: JobBookmarksEncryption -> String
$cshow :: JobBookmarksEncryption -> String
showsPrec :: Int -> JobBookmarksEncryption -> ShowS
$cshowsPrec :: Int -> JobBookmarksEncryption -> ShowS
Prelude.Show, (forall x. JobBookmarksEncryption -> Rep JobBookmarksEncryption x)
-> (forall x.
    Rep JobBookmarksEncryption x -> JobBookmarksEncryption)
-> Generic JobBookmarksEncryption
forall x. Rep JobBookmarksEncryption x -> JobBookmarksEncryption
forall x. JobBookmarksEncryption -> Rep JobBookmarksEncryption x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep JobBookmarksEncryption x -> JobBookmarksEncryption
$cfrom :: forall x. JobBookmarksEncryption -> Rep JobBookmarksEncryption x
Prelude.Generic)

-- |
-- Create a value of 'JobBookmarksEncryption' 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:
--
-- 'jobBookmarksEncryptionMode', 'jobBookmarksEncryption_jobBookmarksEncryptionMode' - The encryption mode to use for job bookmarks data.
--
-- 'kmsKeyArn', 'jobBookmarksEncryption_kmsKeyArn' - The Amazon Resource Name (ARN) of the KMS key to be used to encrypt the
-- data.
newJobBookmarksEncryption ::
  JobBookmarksEncryption
newJobBookmarksEncryption :: JobBookmarksEncryption
newJobBookmarksEncryption =
  JobBookmarksEncryption' :: Maybe JobBookmarksEncryptionMode
-> Maybe Text -> JobBookmarksEncryption
JobBookmarksEncryption'
    { $sel:jobBookmarksEncryptionMode:JobBookmarksEncryption' :: Maybe JobBookmarksEncryptionMode
jobBookmarksEncryptionMode =
        Maybe JobBookmarksEncryptionMode
forall a. Maybe a
Prelude.Nothing,
      $sel:kmsKeyArn:JobBookmarksEncryption' :: Maybe Text
kmsKeyArn = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The encryption mode to use for job bookmarks data.
jobBookmarksEncryption_jobBookmarksEncryptionMode :: Lens.Lens' JobBookmarksEncryption (Prelude.Maybe JobBookmarksEncryptionMode)
jobBookmarksEncryption_jobBookmarksEncryptionMode :: (Maybe JobBookmarksEncryptionMode
 -> f (Maybe JobBookmarksEncryptionMode))
-> JobBookmarksEncryption -> f JobBookmarksEncryption
jobBookmarksEncryption_jobBookmarksEncryptionMode = (JobBookmarksEncryption -> Maybe JobBookmarksEncryptionMode)
-> (JobBookmarksEncryption
    -> Maybe JobBookmarksEncryptionMode -> JobBookmarksEncryption)
-> Lens
     JobBookmarksEncryption
     JobBookmarksEncryption
     (Maybe JobBookmarksEncryptionMode)
     (Maybe JobBookmarksEncryptionMode)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobBookmarksEncryption' {Maybe JobBookmarksEncryptionMode
jobBookmarksEncryptionMode :: Maybe JobBookmarksEncryptionMode
$sel:jobBookmarksEncryptionMode:JobBookmarksEncryption' :: JobBookmarksEncryption -> Maybe JobBookmarksEncryptionMode
jobBookmarksEncryptionMode} -> Maybe JobBookmarksEncryptionMode
jobBookmarksEncryptionMode) (\s :: JobBookmarksEncryption
s@JobBookmarksEncryption' {} Maybe JobBookmarksEncryptionMode
a -> JobBookmarksEncryption
s {$sel:jobBookmarksEncryptionMode:JobBookmarksEncryption' :: Maybe JobBookmarksEncryptionMode
jobBookmarksEncryptionMode = Maybe JobBookmarksEncryptionMode
a} :: JobBookmarksEncryption)

-- | The Amazon Resource Name (ARN) of the KMS key to be used to encrypt the
-- data.
jobBookmarksEncryption_kmsKeyArn :: Lens.Lens' JobBookmarksEncryption (Prelude.Maybe Prelude.Text)
jobBookmarksEncryption_kmsKeyArn :: (Maybe Text -> f (Maybe Text))
-> JobBookmarksEncryption -> f JobBookmarksEncryption
jobBookmarksEncryption_kmsKeyArn = (JobBookmarksEncryption -> Maybe Text)
-> (JobBookmarksEncryption -> Maybe Text -> JobBookmarksEncryption)
-> Lens
     JobBookmarksEncryption
     JobBookmarksEncryption
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobBookmarksEncryption' {Maybe Text
kmsKeyArn :: Maybe Text
$sel:kmsKeyArn:JobBookmarksEncryption' :: JobBookmarksEncryption -> Maybe Text
kmsKeyArn} -> Maybe Text
kmsKeyArn) (\s :: JobBookmarksEncryption
s@JobBookmarksEncryption' {} Maybe Text
a -> JobBookmarksEncryption
s {$sel:kmsKeyArn:JobBookmarksEncryption' :: Maybe Text
kmsKeyArn = Maybe Text
a} :: JobBookmarksEncryption)

instance Core.FromJSON JobBookmarksEncryption where
  parseJSON :: Value -> Parser JobBookmarksEncryption
parseJSON =
    String
-> (Object -> Parser JobBookmarksEncryption)
-> Value
-> Parser JobBookmarksEncryption
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"JobBookmarksEncryption"
      ( \Object
x ->
          Maybe JobBookmarksEncryptionMode
-> Maybe Text -> JobBookmarksEncryption
JobBookmarksEncryption'
            (Maybe JobBookmarksEncryptionMode
 -> Maybe Text -> JobBookmarksEncryption)
-> Parser (Maybe JobBookmarksEncryptionMode)
-> Parser (Maybe Text -> JobBookmarksEncryption)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe JobBookmarksEncryptionMode)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"JobBookmarksEncryptionMode")
            Parser (Maybe Text -> JobBookmarksEncryption)
-> Parser (Maybe Text) -> Parser JobBookmarksEncryption
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"KmsKeyArn")
      )

instance Prelude.Hashable JobBookmarksEncryption

instance Prelude.NFData JobBookmarksEncryption

instance Core.ToJSON JobBookmarksEncryption where
  toJSON :: JobBookmarksEncryption -> Value
toJSON JobBookmarksEncryption' {Maybe Text
Maybe JobBookmarksEncryptionMode
kmsKeyArn :: Maybe Text
jobBookmarksEncryptionMode :: Maybe JobBookmarksEncryptionMode
$sel:kmsKeyArn:JobBookmarksEncryption' :: JobBookmarksEncryption -> Maybe Text
$sel:jobBookmarksEncryptionMode:JobBookmarksEncryption' :: JobBookmarksEncryption -> Maybe JobBookmarksEncryptionMode
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"JobBookmarksEncryptionMode" Text -> JobBookmarksEncryptionMode -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (JobBookmarksEncryptionMode -> Pair)
-> Maybe JobBookmarksEncryptionMode -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe JobBookmarksEncryptionMode
jobBookmarksEncryptionMode,
            (Text
"KmsKeyArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
kmsKeyArn
          ]
      )