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

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

-- |
--
-- /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
(StreamingImageEncryptionConfiguration
 -> StreamingImageEncryptionConfiguration -> Bool)
-> (StreamingImageEncryptionConfiguration
    -> StreamingImageEncryptionConfiguration -> Bool)
-> Eq StreamingImageEncryptionConfiguration
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]
(Int -> ReadS StreamingImageEncryptionConfiguration)
-> ReadS [StreamingImageEncryptionConfiguration]
-> ReadPrec StreamingImageEncryptionConfiguration
-> ReadPrec [StreamingImageEncryptionConfiguration]
-> Read 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
(Int -> StreamingImageEncryptionConfiguration -> ShowS)
-> (StreamingImageEncryptionConfiguration -> String)
-> ([StreamingImageEncryptionConfiguration] -> ShowS)
-> Show StreamingImageEncryptionConfiguration
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.
 StreamingImageEncryptionConfiguration
 -> Rep StreamingImageEncryptionConfiguration x)
-> (forall x.
    Rep StreamingImageEncryptionConfiguration x
    -> StreamingImageEncryptionConfiguration)
-> Generic StreamingImageEncryptionConfiguration
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' :: Maybe Text
-> StreamingImageEncryptionConfigurationKeyType
-> StreamingImageEncryptionConfiguration
StreamingImageEncryptionConfiguration'
    { $sel:keyArn:StreamingImageEncryptionConfiguration' :: Maybe Text
keyArn =
        Maybe Text
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 :: (Maybe Text -> f (Maybe Text))
-> StreamingImageEncryptionConfiguration
-> f StreamingImageEncryptionConfiguration
streamingImageEncryptionConfiguration_keyArn = (StreamingImageEncryptionConfiguration -> Maybe Text)
-> (StreamingImageEncryptionConfiguration
    -> Maybe Text -> StreamingImageEncryptionConfiguration)
-> Lens
     StreamingImageEncryptionConfiguration
     StreamingImageEncryptionConfiguration
     (Maybe Text)
     (Maybe Text)
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 :: (StreamingImageEncryptionConfigurationKeyType
 -> f StreamingImageEncryptionConfigurationKeyType)
-> StreamingImageEncryptionConfiguration
-> f StreamingImageEncryptionConfiguration
streamingImageEncryptionConfiguration_keyType = (StreamingImageEncryptionConfiguration
 -> StreamingImageEncryptionConfigurationKeyType)
-> (StreamingImageEncryptionConfiguration
    -> StreamingImageEncryptionConfigurationKeyType
    -> StreamingImageEncryptionConfiguration)
-> Lens
     StreamingImageEncryptionConfiguration
     StreamingImageEncryptionConfiguration
     StreamingImageEncryptionConfigurationKeyType
     StreamingImageEncryptionConfigurationKeyType
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
  Core.FromJSON
    StreamingImageEncryptionConfiguration
  where
  parseJSON :: Value -> Parser StreamingImageEncryptionConfiguration
parseJSON =
    String
-> (Object -> Parser StreamingImageEncryptionConfiguration)
-> Value
-> Parser StreamingImageEncryptionConfiguration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"StreamingImageEncryptionConfiguration"
      ( \Object
x ->
          Maybe Text
-> StreamingImageEncryptionConfigurationKeyType
-> StreamingImageEncryptionConfiguration
StreamingImageEncryptionConfiguration'
            (Maybe Text
 -> StreamingImageEncryptionConfigurationKeyType
 -> StreamingImageEncryptionConfiguration)
-> Parser (Maybe Text)
-> Parser
     (StreamingImageEncryptionConfigurationKeyType
      -> StreamingImageEncryptionConfiguration)
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
"keyArn")
            Parser
  (StreamingImageEncryptionConfigurationKeyType
   -> StreamingImageEncryptionConfiguration)
-> Parser StreamingImageEncryptionConfigurationKeyType
-> Parser StreamingImageEncryptionConfiguration
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object
-> Text -> Parser StreamingImageEncryptionConfigurationKeyType
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"keyType")
      )

instance
  Prelude.Hashable
    StreamingImageEncryptionConfiguration

instance
  Prelude.NFData
    StreamingImageEncryptionConfiguration