{-# 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.Nimble.Types.StreamingImageEncryptionConfiguration
-- 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.Nimble.Types.StreamingImageEncryptionConfiguration where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Nimble.Types.StreamingImageEncryptionConfigurationKeyType
import qualified Amazonka.Prelude as Prelude

-- | Specifies how a streaming image is encrypted.
--
-- /See:/ 'newStreamingImageEncryptionConfiguration' smart constructor.
data StreamingImageEncryptionConfiguration = StreamingImageEncryptionConfiguration'
  { -- | The ARN for a KMS key that is used to encrypt studio data.
    StreamingImageEncryptionConfiguration -> Maybe Text
keyArn :: Prelude.Maybe Prelude.Text,
    -- | The type of KMS key that is used to encrypt studio data.
    StreamingImageEncryptionConfiguration
-> StreamingImageEncryptionConfigurationKeyType
keyType :: StreamingImageEncryptionConfigurationKeyType
  }
  deriving (StreamingImageEncryptionConfiguration
-> StreamingImageEncryptionConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StreamingImageEncryptionConfiguration
-> StreamingImageEncryptionConfiguration -> Bool
$c/= :: StreamingImageEncryptionConfiguration
-> StreamingImageEncryptionConfiguration -> Bool
== :: StreamingImageEncryptionConfiguration
-> StreamingImageEncryptionConfiguration -> Bool
$c== :: StreamingImageEncryptionConfiguration
-> StreamingImageEncryptionConfiguration -> Bool
Prelude.Eq, ReadPrec [StreamingImageEncryptionConfiguration]
ReadPrec StreamingImageEncryptionConfiguration
Int -> ReadS StreamingImageEncryptionConfiguration
ReadS [StreamingImageEncryptionConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StreamingImageEncryptionConfiguration]
$creadListPrec :: ReadPrec [StreamingImageEncryptionConfiguration]
readPrec :: ReadPrec StreamingImageEncryptionConfiguration
$creadPrec :: ReadPrec StreamingImageEncryptionConfiguration
readList :: ReadS [StreamingImageEncryptionConfiguration]
$creadList :: ReadS [StreamingImageEncryptionConfiguration]
readsPrec :: Int -> ReadS StreamingImageEncryptionConfiguration
$creadsPrec :: Int -> ReadS StreamingImageEncryptionConfiguration
Prelude.Read, Int -> StreamingImageEncryptionConfiguration -> ShowS
[StreamingImageEncryptionConfiguration] -> ShowS
StreamingImageEncryptionConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StreamingImageEncryptionConfiguration] -> ShowS
$cshowList :: [StreamingImageEncryptionConfiguration] -> ShowS
show :: StreamingImageEncryptionConfiguration -> String
$cshow :: StreamingImageEncryptionConfiguration -> String
showsPrec :: Int -> StreamingImageEncryptionConfiguration -> ShowS
$cshowsPrec :: Int -> StreamingImageEncryptionConfiguration -> ShowS
Prelude.Show, forall x.
Rep StreamingImageEncryptionConfiguration x
-> StreamingImageEncryptionConfiguration
forall x.
StreamingImageEncryptionConfiguration
-> Rep StreamingImageEncryptionConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep StreamingImageEncryptionConfiguration x
-> StreamingImageEncryptionConfiguration
$cfrom :: forall x.
StreamingImageEncryptionConfiguration
-> Rep StreamingImageEncryptionConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'StreamingImageEncryptionConfiguration' 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:
--
-- 'keyArn', 'streamingImageEncryptionConfiguration_keyArn' - The ARN for a KMS key that is used to encrypt studio data.
--
-- 'keyType', 'streamingImageEncryptionConfiguration_keyType' - The type of KMS key that is used to encrypt studio data.
newStreamingImageEncryptionConfiguration ::
  -- | 'keyType'
  StreamingImageEncryptionConfigurationKeyType ->
  StreamingImageEncryptionConfiguration
newStreamingImageEncryptionConfiguration :: StreamingImageEncryptionConfigurationKeyType
-> StreamingImageEncryptionConfiguration
newStreamingImageEncryptionConfiguration StreamingImageEncryptionConfigurationKeyType
pKeyType_ =
  StreamingImageEncryptionConfiguration'
    { $sel:keyArn:StreamingImageEncryptionConfiguration' :: Maybe Text
keyArn =
        forall a. Maybe a
Prelude.Nothing,
      $sel:keyType:StreamingImageEncryptionConfiguration' :: StreamingImageEncryptionConfigurationKeyType
keyType = StreamingImageEncryptionConfigurationKeyType
pKeyType_
    }

-- | The ARN for a KMS key that is used to encrypt studio data.
streamingImageEncryptionConfiguration_keyArn :: Lens.Lens' StreamingImageEncryptionConfiguration (Prelude.Maybe Prelude.Text)
streamingImageEncryptionConfiguration_keyArn :: Lens' StreamingImageEncryptionConfiguration (Maybe Text)
streamingImageEncryptionConfiguration_keyArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StreamingImageEncryptionConfiguration' {Maybe Text
keyArn :: Maybe Text
$sel:keyArn:StreamingImageEncryptionConfiguration' :: StreamingImageEncryptionConfiguration -> Maybe Text
keyArn} -> Maybe Text
keyArn) (\s :: StreamingImageEncryptionConfiguration
s@StreamingImageEncryptionConfiguration' {} Maybe Text
a -> StreamingImageEncryptionConfiguration
s {$sel:keyArn:StreamingImageEncryptionConfiguration' :: Maybe Text
keyArn = Maybe Text
a} :: StreamingImageEncryptionConfiguration)

-- | The type of KMS key that is used to encrypt studio data.
streamingImageEncryptionConfiguration_keyType :: Lens.Lens' StreamingImageEncryptionConfiguration StreamingImageEncryptionConfigurationKeyType
streamingImageEncryptionConfiguration_keyType :: Lens'
  StreamingImageEncryptionConfiguration
  StreamingImageEncryptionConfigurationKeyType
streamingImageEncryptionConfiguration_keyType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StreamingImageEncryptionConfiguration' {StreamingImageEncryptionConfigurationKeyType
keyType :: StreamingImageEncryptionConfigurationKeyType
$sel:keyType:StreamingImageEncryptionConfiguration' :: StreamingImageEncryptionConfiguration
-> StreamingImageEncryptionConfigurationKeyType
keyType} -> StreamingImageEncryptionConfigurationKeyType
keyType) (\s :: StreamingImageEncryptionConfiguration
s@StreamingImageEncryptionConfiguration' {} StreamingImageEncryptionConfigurationKeyType
a -> StreamingImageEncryptionConfiguration
s {$sel:keyType:StreamingImageEncryptionConfiguration' :: StreamingImageEncryptionConfigurationKeyType
keyType = StreamingImageEncryptionConfigurationKeyType
a} :: StreamingImageEncryptionConfiguration)

instance
  Data.FromJSON
    StreamingImageEncryptionConfiguration
  where
  parseJSON :: Value -> Parser StreamingImageEncryptionConfiguration
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"StreamingImageEncryptionConfiguration"
      ( \Object
x ->
          Maybe Text
-> StreamingImageEncryptionConfigurationKeyType
-> StreamingImageEncryptionConfiguration
StreamingImageEncryptionConfiguration'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"keyArn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"keyType")
      )

instance
  Prelude.Hashable
    StreamingImageEncryptionConfiguration
  where
  hashWithSalt :: Int -> StreamingImageEncryptionConfiguration -> Int
hashWithSalt
    Int
_salt
    StreamingImageEncryptionConfiguration' {Maybe Text
StreamingImageEncryptionConfigurationKeyType
keyType :: StreamingImageEncryptionConfigurationKeyType
keyArn :: Maybe Text
$sel:keyType:StreamingImageEncryptionConfiguration' :: StreamingImageEncryptionConfiguration
-> StreamingImageEncryptionConfigurationKeyType
$sel:keyArn:StreamingImageEncryptionConfiguration' :: StreamingImageEncryptionConfiguration -> Maybe Text
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
keyArn
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` StreamingImageEncryptionConfigurationKeyType
keyType

instance
  Prelude.NFData
    StreamingImageEncryptionConfiguration
  where
  rnf :: StreamingImageEncryptionConfiguration -> ()
rnf StreamingImageEncryptionConfiguration' {Maybe Text
StreamingImageEncryptionConfigurationKeyType
keyType :: StreamingImageEncryptionConfigurationKeyType
keyArn :: Maybe Text
$sel:keyType:StreamingImageEncryptionConfiguration' :: StreamingImageEncryptionConfiguration
-> StreamingImageEncryptionConfigurationKeyType
$sel:keyArn:StreamingImageEncryptionConfiguration' :: StreamingImageEncryptionConfiguration -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
keyArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf StreamingImageEncryptionConfigurationKeyType
keyType