{-# 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.S3.Types.SSEKMS
-- 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.S3.Types.SSEKMS where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.S3.Internal

-- | Specifies the use of SSE-KMS to encrypt delivered inventory reports.
--
-- /See:/ 'newSSEKMS' smart constructor.
data SSEKMS = SSEKMS'
  { -- | Specifies the ID of the Amazon Web Services Key Management Service
    -- (Amazon Web Services KMS) symmetric customer managed key to use for
    -- encrypting inventory reports.
    SSEKMS -> Sensitive Text
keyId :: Core.Sensitive Prelude.Text
  }
  deriving (SSEKMS -> SSEKMS -> Bool
(SSEKMS -> SSEKMS -> Bool)
-> (SSEKMS -> SSEKMS -> Bool) -> Eq SSEKMS
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SSEKMS -> SSEKMS -> Bool
$c/= :: SSEKMS -> SSEKMS -> Bool
== :: SSEKMS -> SSEKMS -> Bool
$c== :: SSEKMS -> SSEKMS -> Bool
Prelude.Eq, Int -> SSEKMS -> ShowS
[SSEKMS] -> ShowS
SSEKMS -> String
(Int -> SSEKMS -> ShowS)
-> (SSEKMS -> String) -> ([SSEKMS] -> ShowS) -> Show SSEKMS
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SSEKMS] -> ShowS
$cshowList :: [SSEKMS] -> ShowS
show :: SSEKMS -> String
$cshow :: SSEKMS -> String
showsPrec :: Int -> SSEKMS -> ShowS
$cshowsPrec :: Int -> SSEKMS -> ShowS
Prelude.Show, (forall x. SSEKMS -> Rep SSEKMS x)
-> (forall x. Rep SSEKMS x -> SSEKMS) -> Generic SSEKMS
forall x. Rep SSEKMS x -> SSEKMS
forall x. SSEKMS -> Rep SSEKMS x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SSEKMS x -> SSEKMS
$cfrom :: forall x. SSEKMS -> Rep SSEKMS x
Prelude.Generic)

-- |
-- Create a value of 'SSEKMS' 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:
--
-- 'keyId', 'ssekms_keyId' - Specifies the ID of the Amazon Web Services Key Management Service
-- (Amazon Web Services KMS) symmetric customer managed key to use for
-- encrypting inventory reports.
newSSEKMS ::
  -- | 'keyId'
  Prelude.Text ->
  SSEKMS
newSSEKMS :: Text -> SSEKMS
newSSEKMS Text
pKeyId_ =
  SSEKMS' :: Sensitive Text -> SSEKMS
SSEKMS' {$sel:keyId:SSEKMS' :: Sensitive Text
keyId = Tagged Text (Identity Text)
-> Tagged (Sensitive Text) (Identity (Sensitive Text))
forall a. Iso' (Sensitive a) a
Core._Sensitive (Tagged Text (Identity Text)
 -> Tagged (Sensitive Text) (Identity (Sensitive Text)))
-> Text -> Sensitive Text
forall t b. AReview t b -> b -> t
Lens.# Text
pKeyId_}

-- | Specifies the ID of the Amazon Web Services Key Management Service
-- (Amazon Web Services KMS) symmetric customer managed key to use for
-- encrypting inventory reports.
ssekms_keyId :: Lens.Lens' SSEKMS Prelude.Text
ssekms_keyId :: (Text -> f Text) -> SSEKMS -> f SSEKMS
ssekms_keyId = (SSEKMS -> Sensitive Text)
-> (SSEKMS -> Sensitive Text -> SSEKMS)
-> Lens SSEKMS SSEKMS (Sensitive Text) (Sensitive Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SSEKMS' {Sensitive Text
keyId :: Sensitive Text
$sel:keyId:SSEKMS' :: SSEKMS -> Sensitive Text
keyId} -> Sensitive Text
keyId) (\s :: SSEKMS
s@SSEKMS' {} Sensitive Text
a -> SSEKMS
s {$sel:keyId:SSEKMS' :: Sensitive Text
keyId = Sensitive Text
a} :: SSEKMS) ((Sensitive Text -> f (Sensitive Text)) -> SSEKMS -> f SSEKMS)
-> ((Text -> f Text) -> Sensitive Text -> f (Sensitive Text))
-> (Text -> f Text)
-> SSEKMS
-> f SSEKMS
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> f Text) -> Sensitive Text -> f (Sensitive Text)
forall a. Iso' (Sensitive a) a
Core._Sensitive

instance Core.FromXML SSEKMS where
  parseXML :: [Node] -> Either String SSEKMS
parseXML [Node]
x = Sensitive Text -> SSEKMS
SSEKMS' (Sensitive Text -> SSEKMS)
-> Either String (Sensitive Text) -> Either String SSEKMS
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Sensitive Text)
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"KeyId")

instance Prelude.Hashable SSEKMS

instance Prelude.NFData SSEKMS

instance Core.ToXML SSEKMS where
  toXML :: SSEKMS -> XML
toXML SSEKMS' {Sensitive Text
keyId :: Sensitive Text
$sel:keyId:SSEKMS' :: SSEKMS -> Sensitive Text
..} =
    [XML] -> XML
forall a. Monoid a => [a] -> a
Prelude.mconcat [Name
"KeyId" Name -> Sensitive Text -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Sensitive Text
keyId]