{-# 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.SecurityHub.Types.AwsXrayEncryptionConfigDetails
-- 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.SecurityHub.Types.AwsXrayEncryptionConfigDetails where

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

-- | Information about the encryption configuration for X-Ray.
--
-- /See:/ 'newAwsXrayEncryptionConfigDetails' smart constructor.
data AwsXrayEncryptionConfigDetails = AwsXrayEncryptionConfigDetails'
  { -- | The current status of the encryption configuration. When @Status@ is
    -- @UPDATING@, X-Ray might use both the old and new encryption.
    AwsXrayEncryptionConfigDetails -> Maybe Text
status :: Prelude.Maybe Prelude.Text,
    -- | The identifier of the KMS key that is used for encryption. Provided if
    -- @Type@ is @KMS@.
    AwsXrayEncryptionConfigDetails -> Maybe Text
keyId :: Prelude.Maybe Prelude.Text,
    -- | The type of encryption. @KMS@ indicates that the encryption uses KMS
    -- keys. @NONE@ indicates to use the default encryption.
    AwsXrayEncryptionConfigDetails -> Maybe Text
type' :: Prelude.Maybe Prelude.Text
  }
  deriving (AwsXrayEncryptionConfigDetails
-> AwsXrayEncryptionConfigDetails -> Bool
(AwsXrayEncryptionConfigDetails
 -> AwsXrayEncryptionConfigDetails -> Bool)
-> (AwsXrayEncryptionConfigDetails
    -> AwsXrayEncryptionConfigDetails -> Bool)
-> Eq AwsXrayEncryptionConfigDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AwsXrayEncryptionConfigDetails
-> AwsXrayEncryptionConfigDetails -> Bool
$c/= :: AwsXrayEncryptionConfigDetails
-> AwsXrayEncryptionConfigDetails -> Bool
== :: AwsXrayEncryptionConfigDetails
-> AwsXrayEncryptionConfigDetails -> Bool
$c== :: AwsXrayEncryptionConfigDetails
-> AwsXrayEncryptionConfigDetails -> Bool
Prelude.Eq, ReadPrec [AwsXrayEncryptionConfigDetails]
ReadPrec AwsXrayEncryptionConfigDetails
Int -> ReadS AwsXrayEncryptionConfigDetails
ReadS [AwsXrayEncryptionConfigDetails]
(Int -> ReadS AwsXrayEncryptionConfigDetails)
-> ReadS [AwsXrayEncryptionConfigDetails]
-> ReadPrec AwsXrayEncryptionConfigDetails
-> ReadPrec [AwsXrayEncryptionConfigDetails]
-> Read AwsXrayEncryptionConfigDetails
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AwsXrayEncryptionConfigDetails]
$creadListPrec :: ReadPrec [AwsXrayEncryptionConfigDetails]
readPrec :: ReadPrec AwsXrayEncryptionConfigDetails
$creadPrec :: ReadPrec AwsXrayEncryptionConfigDetails
readList :: ReadS [AwsXrayEncryptionConfigDetails]
$creadList :: ReadS [AwsXrayEncryptionConfigDetails]
readsPrec :: Int -> ReadS AwsXrayEncryptionConfigDetails
$creadsPrec :: Int -> ReadS AwsXrayEncryptionConfigDetails
Prelude.Read, Int -> AwsXrayEncryptionConfigDetails -> ShowS
[AwsXrayEncryptionConfigDetails] -> ShowS
AwsXrayEncryptionConfigDetails -> String
(Int -> AwsXrayEncryptionConfigDetails -> ShowS)
-> (AwsXrayEncryptionConfigDetails -> String)
-> ([AwsXrayEncryptionConfigDetails] -> ShowS)
-> Show AwsXrayEncryptionConfigDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AwsXrayEncryptionConfigDetails] -> ShowS
$cshowList :: [AwsXrayEncryptionConfigDetails] -> ShowS
show :: AwsXrayEncryptionConfigDetails -> String
$cshow :: AwsXrayEncryptionConfigDetails -> String
showsPrec :: Int -> AwsXrayEncryptionConfigDetails -> ShowS
$cshowsPrec :: Int -> AwsXrayEncryptionConfigDetails -> ShowS
Prelude.Show, (forall x.
 AwsXrayEncryptionConfigDetails
 -> Rep AwsXrayEncryptionConfigDetails x)
-> (forall x.
    Rep AwsXrayEncryptionConfigDetails x
    -> AwsXrayEncryptionConfigDetails)
-> Generic AwsXrayEncryptionConfigDetails
forall x.
Rep AwsXrayEncryptionConfigDetails x
-> AwsXrayEncryptionConfigDetails
forall x.
AwsXrayEncryptionConfigDetails
-> Rep AwsXrayEncryptionConfigDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AwsXrayEncryptionConfigDetails x
-> AwsXrayEncryptionConfigDetails
$cfrom :: forall x.
AwsXrayEncryptionConfigDetails
-> Rep AwsXrayEncryptionConfigDetails x
Prelude.Generic)

-- |
-- Create a value of 'AwsXrayEncryptionConfigDetails' 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:
--
-- 'status', 'awsXrayEncryptionConfigDetails_status' - The current status of the encryption configuration. When @Status@ is
-- @UPDATING@, X-Ray might use both the old and new encryption.
--
-- 'keyId', 'awsXrayEncryptionConfigDetails_keyId' - The identifier of the KMS key that is used for encryption. Provided if
-- @Type@ is @KMS@.
--
-- 'type'', 'awsXrayEncryptionConfigDetails_type' - The type of encryption. @KMS@ indicates that the encryption uses KMS
-- keys. @NONE@ indicates to use the default encryption.
newAwsXrayEncryptionConfigDetails ::
  AwsXrayEncryptionConfigDetails
newAwsXrayEncryptionConfigDetails :: AwsXrayEncryptionConfigDetails
newAwsXrayEncryptionConfigDetails =
  AwsXrayEncryptionConfigDetails' :: Maybe Text
-> Maybe Text -> Maybe Text -> AwsXrayEncryptionConfigDetails
AwsXrayEncryptionConfigDetails'
    { $sel:status:AwsXrayEncryptionConfigDetails' :: Maybe Text
status =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:keyId:AwsXrayEncryptionConfigDetails' :: Maybe Text
keyId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:type':AwsXrayEncryptionConfigDetails' :: Maybe Text
type' = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The current status of the encryption configuration. When @Status@ is
-- @UPDATING@, X-Ray might use both the old and new encryption.
awsXrayEncryptionConfigDetails_status :: Lens.Lens' AwsXrayEncryptionConfigDetails (Prelude.Maybe Prelude.Text)
awsXrayEncryptionConfigDetails_status :: (Maybe Text -> f (Maybe Text))
-> AwsXrayEncryptionConfigDetails
-> f AwsXrayEncryptionConfigDetails
awsXrayEncryptionConfigDetails_status = (AwsXrayEncryptionConfigDetails -> Maybe Text)
-> (AwsXrayEncryptionConfigDetails
    -> Maybe Text -> AwsXrayEncryptionConfigDetails)
-> Lens
     AwsXrayEncryptionConfigDetails
     AwsXrayEncryptionConfigDetails
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsXrayEncryptionConfigDetails' {Maybe Text
status :: Maybe Text
$sel:status:AwsXrayEncryptionConfigDetails' :: AwsXrayEncryptionConfigDetails -> Maybe Text
status} -> Maybe Text
status) (\s :: AwsXrayEncryptionConfigDetails
s@AwsXrayEncryptionConfigDetails' {} Maybe Text
a -> AwsXrayEncryptionConfigDetails
s {$sel:status:AwsXrayEncryptionConfigDetails' :: Maybe Text
status = Maybe Text
a} :: AwsXrayEncryptionConfigDetails)

-- | The identifier of the KMS key that is used for encryption. Provided if
-- @Type@ is @KMS@.
awsXrayEncryptionConfigDetails_keyId :: Lens.Lens' AwsXrayEncryptionConfigDetails (Prelude.Maybe Prelude.Text)
awsXrayEncryptionConfigDetails_keyId :: (Maybe Text -> f (Maybe Text))
-> AwsXrayEncryptionConfigDetails
-> f AwsXrayEncryptionConfigDetails
awsXrayEncryptionConfigDetails_keyId = (AwsXrayEncryptionConfigDetails -> Maybe Text)
-> (AwsXrayEncryptionConfigDetails
    -> Maybe Text -> AwsXrayEncryptionConfigDetails)
-> Lens
     AwsXrayEncryptionConfigDetails
     AwsXrayEncryptionConfigDetails
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsXrayEncryptionConfigDetails' {Maybe Text
keyId :: Maybe Text
$sel:keyId:AwsXrayEncryptionConfigDetails' :: AwsXrayEncryptionConfigDetails -> Maybe Text
keyId} -> Maybe Text
keyId) (\s :: AwsXrayEncryptionConfigDetails
s@AwsXrayEncryptionConfigDetails' {} Maybe Text
a -> AwsXrayEncryptionConfigDetails
s {$sel:keyId:AwsXrayEncryptionConfigDetails' :: Maybe Text
keyId = Maybe Text
a} :: AwsXrayEncryptionConfigDetails)

-- | The type of encryption. @KMS@ indicates that the encryption uses KMS
-- keys. @NONE@ indicates to use the default encryption.
awsXrayEncryptionConfigDetails_type :: Lens.Lens' AwsXrayEncryptionConfigDetails (Prelude.Maybe Prelude.Text)
awsXrayEncryptionConfigDetails_type :: (Maybe Text -> f (Maybe Text))
-> AwsXrayEncryptionConfigDetails
-> f AwsXrayEncryptionConfigDetails
awsXrayEncryptionConfigDetails_type = (AwsXrayEncryptionConfigDetails -> Maybe Text)
-> (AwsXrayEncryptionConfigDetails
    -> Maybe Text -> AwsXrayEncryptionConfigDetails)
-> Lens
     AwsXrayEncryptionConfigDetails
     AwsXrayEncryptionConfigDetails
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsXrayEncryptionConfigDetails' {Maybe Text
type' :: Maybe Text
$sel:type':AwsXrayEncryptionConfigDetails' :: AwsXrayEncryptionConfigDetails -> Maybe Text
type'} -> Maybe Text
type') (\s :: AwsXrayEncryptionConfigDetails
s@AwsXrayEncryptionConfigDetails' {} Maybe Text
a -> AwsXrayEncryptionConfigDetails
s {$sel:type':AwsXrayEncryptionConfigDetails' :: Maybe Text
type' = Maybe Text
a} :: AwsXrayEncryptionConfigDetails)

instance Core.FromJSON AwsXrayEncryptionConfigDetails where
  parseJSON :: Value -> Parser AwsXrayEncryptionConfigDetails
parseJSON =
    String
-> (Object -> Parser AwsXrayEncryptionConfigDetails)
-> Value
-> Parser AwsXrayEncryptionConfigDetails
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AwsXrayEncryptionConfigDetails"
      ( \Object
x ->
          Maybe Text
-> Maybe Text -> Maybe Text -> AwsXrayEncryptionConfigDetails
AwsXrayEncryptionConfigDetails'
            (Maybe Text
 -> Maybe Text -> Maybe Text -> AwsXrayEncryptionConfigDetails)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> Maybe Text -> AwsXrayEncryptionConfigDetails)
forall (f :: * -> *) a b. Functor 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
"Status")
            Parser (Maybe Text -> Maybe Text -> AwsXrayEncryptionConfigDetails)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> AwsXrayEncryptionConfigDetails)
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
"KeyId")
            Parser (Maybe Text -> AwsXrayEncryptionConfigDetails)
-> Parser (Maybe Text) -> Parser AwsXrayEncryptionConfigDetails
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
"Type")
      )

instance
  Prelude.Hashable
    AwsXrayEncryptionConfigDetails

instance
  Prelude.NFData
    AwsXrayEncryptionConfigDetails

instance Core.ToJSON AwsXrayEncryptionConfigDetails where
  toJSON :: AwsXrayEncryptionConfigDetails -> Value
toJSON AwsXrayEncryptionConfigDetails' {Maybe Text
type' :: Maybe Text
keyId :: Maybe Text
status :: Maybe Text
$sel:type':AwsXrayEncryptionConfigDetails' :: AwsXrayEncryptionConfigDetails -> Maybe Text
$sel:keyId:AwsXrayEncryptionConfigDetails' :: AwsXrayEncryptionConfigDetails -> Maybe Text
$sel:status:AwsXrayEncryptionConfigDetails' :: AwsXrayEncryptionConfigDetails -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"Status" 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
status,
            (Text
"KeyId" 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
keyId,
            (Text
"Type" 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
type'
          ]
      )