{-# 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.MediaConnect.Types.Encryption
-- 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.MediaConnect.Types.Encryption where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaConnect.Types.Algorithm
import Amazonka.MediaConnect.Types.KeyType
import qualified Amazonka.Prelude as Prelude

-- | Information about the encryption of the flow.
--
-- /See:/ 'newEncryption' smart constructor.
data Encryption = Encryption'
  { -- | The type of key that is used for the encryption. If no keyType is
    -- provided, the service will use the default setting (static-key).
    Encryption -> Maybe KeyType
keyType :: Prelude.Maybe KeyType,
    -- | An identifier for the content. The service sends this value to the key
    -- server to identify the current endpoint. The resource ID is also known
    -- as the content ID. This parameter is required for SPEKE encryption and
    -- is not valid for static key encryption.
    Encryption -> Maybe Text
resourceId :: Prelude.Maybe Prelude.Text,
    -- | The URL from the API Gateway proxy that you set up to talk to your key
    -- server. This parameter is required for SPEKE encryption and is not valid
    -- for static key encryption.
    Encryption -> Maybe Text
url :: Prelude.Maybe Prelude.Text,
    -- | The type of algorithm that is used for the encryption (such as aes128,
    -- aes192, or aes256).
    Encryption -> Maybe Algorithm
algorithm :: Prelude.Maybe Algorithm,
    -- | A 128-bit, 16-byte hex value represented by a 32-character string, to be
    -- used with the key for encrypting content. This parameter is not valid
    -- for static key encryption.
    Encryption -> Maybe Text
constantInitializationVector :: Prelude.Maybe Prelude.Text,
    -- | The value of one of the devices that you configured with your digital
    -- rights management (DRM) platform key provider. This parameter is
    -- required for SPEKE encryption and is not valid for static key
    -- encryption.
    Encryption -> Maybe Text
deviceId :: Prelude.Maybe Prelude.Text,
    -- | The AWS Region that the API Gateway proxy endpoint was created in. This
    -- parameter is required for SPEKE encryption and is not valid for static
    -- key encryption.
    Encryption -> Maybe Text
region :: Prelude.Maybe Prelude.Text,
    -- | The ARN of the secret that you created in AWS Secrets Manager to store
    -- the encryption key. This parameter is required for static key encryption
    -- and is not valid for SPEKE encryption.
    Encryption -> Maybe Text
secretArn :: Prelude.Maybe Prelude.Text,
    -- | The ARN of the role that you created during setup (when you set up AWS
    -- Elemental MediaConnect as a trusted entity).
    Encryption -> Text
roleArn :: Prelude.Text
  }
  deriving (Encryption -> Encryption -> Bool
(Encryption -> Encryption -> Bool)
-> (Encryption -> Encryption -> Bool) -> Eq Encryption
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Encryption -> Encryption -> Bool
$c/= :: Encryption -> Encryption -> Bool
== :: Encryption -> Encryption -> Bool
$c== :: Encryption -> Encryption -> Bool
Prelude.Eq, ReadPrec [Encryption]
ReadPrec Encryption
Int -> ReadS Encryption
ReadS [Encryption]
(Int -> ReadS Encryption)
-> ReadS [Encryption]
-> ReadPrec Encryption
-> ReadPrec [Encryption]
-> Read Encryption
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Encryption]
$creadListPrec :: ReadPrec [Encryption]
readPrec :: ReadPrec Encryption
$creadPrec :: ReadPrec Encryption
readList :: ReadS [Encryption]
$creadList :: ReadS [Encryption]
readsPrec :: Int -> ReadS Encryption
$creadsPrec :: Int -> ReadS Encryption
Prelude.Read, Int -> Encryption -> ShowS
[Encryption] -> ShowS
Encryption -> String
(Int -> Encryption -> ShowS)
-> (Encryption -> String)
-> ([Encryption] -> ShowS)
-> Show Encryption
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Encryption] -> ShowS
$cshowList :: [Encryption] -> ShowS
show :: Encryption -> String
$cshow :: Encryption -> String
showsPrec :: Int -> Encryption -> ShowS
$cshowsPrec :: Int -> Encryption -> ShowS
Prelude.Show, (forall x. Encryption -> Rep Encryption x)
-> (forall x. Rep Encryption x -> Encryption) -> Generic Encryption
forall x. Rep Encryption x -> Encryption
forall x. Encryption -> Rep Encryption x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Encryption x -> Encryption
$cfrom :: forall x. Encryption -> Rep Encryption x
Prelude.Generic)

-- |
-- Create a value of 'Encryption' 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:
--
-- 'keyType', 'encryption_keyType' - The type of key that is used for the encryption. If no keyType is
-- provided, the service will use the default setting (static-key).
--
-- 'resourceId', 'encryption_resourceId' - An identifier for the content. The service sends this value to the key
-- server to identify the current endpoint. The resource ID is also known
-- as the content ID. This parameter is required for SPEKE encryption and
-- is not valid for static key encryption.
--
-- 'url', 'encryption_url' - The URL from the API Gateway proxy that you set up to talk to your key
-- server. This parameter is required for SPEKE encryption and is not valid
-- for static key encryption.
--
-- 'algorithm', 'encryption_algorithm' - The type of algorithm that is used for the encryption (such as aes128,
-- aes192, or aes256).
--
-- 'constantInitializationVector', 'encryption_constantInitializationVector' - A 128-bit, 16-byte hex value represented by a 32-character string, to be
-- used with the key for encrypting content. This parameter is not valid
-- for static key encryption.
--
-- 'deviceId', 'encryption_deviceId' - The value of one of the devices that you configured with your digital
-- rights management (DRM) platform key provider. This parameter is
-- required for SPEKE encryption and is not valid for static key
-- encryption.
--
-- 'region', 'encryption_region' - The AWS Region that the API Gateway proxy endpoint was created in. This
-- parameter is required for SPEKE encryption and is not valid for static
-- key encryption.
--
-- 'secretArn', 'encryption_secretArn' - The ARN of the secret that you created in AWS Secrets Manager to store
-- the encryption key. This parameter is required for static key encryption
-- and is not valid for SPEKE encryption.
--
-- 'roleArn', 'encryption_roleArn' - The ARN of the role that you created during setup (when you set up AWS
-- Elemental MediaConnect as a trusted entity).
newEncryption ::
  -- | 'roleArn'
  Prelude.Text ->
  Encryption
newEncryption :: Text -> Encryption
newEncryption Text
pRoleArn_ =
  Encryption' :: Maybe KeyType
-> Maybe Text
-> Maybe Text
-> Maybe Algorithm
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Text
-> Encryption
Encryption'
    { $sel:keyType:Encryption' :: Maybe KeyType
keyType = Maybe KeyType
forall a. Maybe a
Prelude.Nothing,
      $sel:resourceId:Encryption' :: Maybe Text
resourceId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:url:Encryption' :: Maybe Text
url = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:algorithm:Encryption' :: Maybe Algorithm
algorithm = Maybe Algorithm
forall a. Maybe a
Prelude.Nothing,
      $sel:constantInitializationVector:Encryption' :: Maybe Text
constantInitializationVector = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:deviceId:Encryption' :: Maybe Text
deviceId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:region:Encryption' :: Maybe Text
region = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:secretArn:Encryption' :: Maybe Text
secretArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:roleArn:Encryption' :: Text
roleArn = Text
pRoleArn_
    }

-- | The type of key that is used for the encryption. If no keyType is
-- provided, the service will use the default setting (static-key).
encryption_keyType :: Lens.Lens' Encryption (Prelude.Maybe KeyType)
encryption_keyType :: (Maybe KeyType -> f (Maybe KeyType)) -> Encryption -> f Encryption
encryption_keyType = (Encryption -> Maybe KeyType)
-> (Encryption -> Maybe KeyType -> Encryption)
-> Lens Encryption Encryption (Maybe KeyType) (Maybe KeyType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Encryption' {Maybe KeyType
keyType :: Maybe KeyType
$sel:keyType:Encryption' :: Encryption -> Maybe KeyType
keyType} -> Maybe KeyType
keyType) (\s :: Encryption
s@Encryption' {} Maybe KeyType
a -> Encryption
s {$sel:keyType:Encryption' :: Maybe KeyType
keyType = Maybe KeyType
a} :: Encryption)

-- | An identifier for the content. The service sends this value to the key
-- server to identify the current endpoint. The resource ID is also known
-- as the content ID. This parameter is required for SPEKE encryption and
-- is not valid for static key encryption.
encryption_resourceId :: Lens.Lens' Encryption (Prelude.Maybe Prelude.Text)
encryption_resourceId :: (Maybe Text -> f (Maybe Text)) -> Encryption -> f Encryption
encryption_resourceId = (Encryption -> Maybe Text)
-> (Encryption -> Maybe Text -> Encryption)
-> Lens Encryption Encryption (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Encryption' {Maybe Text
resourceId :: Maybe Text
$sel:resourceId:Encryption' :: Encryption -> Maybe Text
resourceId} -> Maybe Text
resourceId) (\s :: Encryption
s@Encryption' {} Maybe Text
a -> Encryption
s {$sel:resourceId:Encryption' :: Maybe Text
resourceId = Maybe Text
a} :: Encryption)

-- | The URL from the API Gateway proxy that you set up to talk to your key
-- server. This parameter is required for SPEKE encryption and is not valid
-- for static key encryption.
encryption_url :: Lens.Lens' Encryption (Prelude.Maybe Prelude.Text)
encryption_url :: (Maybe Text -> f (Maybe Text)) -> Encryption -> f Encryption
encryption_url = (Encryption -> Maybe Text)
-> (Encryption -> Maybe Text -> Encryption)
-> Lens Encryption Encryption (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Encryption' {Maybe Text
url :: Maybe Text
$sel:url:Encryption' :: Encryption -> Maybe Text
url} -> Maybe Text
url) (\s :: Encryption
s@Encryption' {} Maybe Text
a -> Encryption
s {$sel:url:Encryption' :: Maybe Text
url = Maybe Text
a} :: Encryption)

-- | The type of algorithm that is used for the encryption (such as aes128,
-- aes192, or aes256).
encryption_algorithm :: Lens.Lens' Encryption (Prelude.Maybe Algorithm)
encryption_algorithm :: (Maybe Algorithm -> f (Maybe Algorithm))
-> Encryption -> f Encryption
encryption_algorithm = (Encryption -> Maybe Algorithm)
-> (Encryption -> Maybe Algorithm -> Encryption)
-> Lens Encryption Encryption (Maybe Algorithm) (Maybe Algorithm)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Encryption' {Maybe Algorithm
algorithm :: Maybe Algorithm
$sel:algorithm:Encryption' :: Encryption -> Maybe Algorithm
algorithm} -> Maybe Algorithm
algorithm) (\s :: Encryption
s@Encryption' {} Maybe Algorithm
a -> Encryption
s {$sel:algorithm:Encryption' :: Maybe Algorithm
algorithm = Maybe Algorithm
a} :: Encryption)

-- | A 128-bit, 16-byte hex value represented by a 32-character string, to be
-- used with the key for encrypting content. This parameter is not valid
-- for static key encryption.
encryption_constantInitializationVector :: Lens.Lens' Encryption (Prelude.Maybe Prelude.Text)
encryption_constantInitializationVector :: (Maybe Text -> f (Maybe Text)) -> Encryption -> f Encryption
encryption_constantInitializationVector = (Encryption -> Maybe Text)
-> (Encryption -> Maybe Text -> Encryption)
-> Lens Encryption Encryption (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Encryption' {Maybe Text
constantInitializationVector :: Maybe Text
$sel:constantInitializationVector:Encryption' :: Encryption -> Maybe Text
constantInitializationVector} -> Maybe Text
constantInitializationVector) (\s :: Encryption
s@Encryption' {} Maybe Text
a -> Encryption
s {$sel:constantInitializationVector:Encryption' :: Maybe Text
constantInitializationVector = Maybe Text
a} :: Encryption)

-- | The value of one of the devices that you configured with your digital
-- rights management (DRM) platform key provider. This parameter is
-- required for SPEKE encryption and is not valid for static key
-- encryption.
encryption_deviceId :: Lens.Lens' Encryption (Prelude.Maybe Prelude.Text)
encryption_deviceId :: (Maybe Text -> f (Maybe Text)) -> Encryption -> f Encryption
encryption_deviceId = (Encryption -> Maybe Text)
-> (Encryption -> Maybe Text -> Encryption)
-> Lens Encryption Encryption (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Encryption' {Maybe Text
deviceId :: Maybe Text
$sel:deviceId:Encryption' :: Encryption -> Maybe Text
deviceId} -> Maybe Text
deviceId) (\s :: Encryption
s@Encryption' {} Maybe Text
a -> Encryption
s {$sel:deviceId:Encryption' :: Maybe Text
deviceId = Maybe Text
a} :: Encryption)

-- | The AWS Region that the API Gateway proxy endpoint was created in. This
-- parameter is required for SPEKE encryption and is not valid for static
-- key encryption.
encryption_region :: Lens.Lens' Encryption (Prelude.Maybe Prelude.Text)
encryption_region :: (Maybe Text -> f (Maybe Text)) -> Encryption -> f Encryption
encryption_region = (Encryption -> Maybe Text)
-> (Encryption -> Maybe Text -> Encryption)
-> Lens Encryption Encryption (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Encryption' {Maybe Text
region :: Maybe Text
$sel:region:Encryption' :: Encryption -> Maybe Text
region} -> Maybe Text
region) (\s :: Encryption
s@Encryption' {} Maybe Text
a -> Encryption
s {$sel:region:Encryption' :: Maybe Text
region = Maybe Text
a} :: Encryption)

-- | The ARN of the secret that you created in AWS Secrets Manager to store
-- the encryption key. This parameter is required for static key encryption
-- and is not valid for SPEKE encryption.
encryption_secretArn :: Lens.Lens' Encryption (Prelude.Maybe Prelude.Text)
encryption_secretArn :: (Maybe Text -> f (Maybe Text)) -> Encryption -> f Encryption
encryption_secretArn = (Encryption -> Maybe Text)
-> (Encryption -> Maybe Text -> Encryption)
-> Lens Encryption Encryption (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Encryption' {Maybe Text
secretArn :: Maybe Text
$sel:secretArn:Encryption' :: Encryption -> Maybe Text
secretArn} -> Maybe Text
secretArn) (\s :: Encryption
s@Encryption' {} Maybe Text
a -> Encryption
s {$sel:secretArn:Encryption' :: Maybe Text
secretArn = Maybe Text
a} :: Encryption)

-- | The ARN of the role that you created during setup (when you set up AWS
-- Elemental MediaConnect as a trusted entity).
encryption_roleArn :: Lens.Lens' Encryption Prelude.Text
encryption_roleArn :: (Text -> f Text) -> Encryption -> f Encryption
encryption_roleArn = (Encryption -> Text)
-> (Encryption -> Text -> Encryption)
-> Lens Encryption Encryption Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Encryption' {Text
roleArn :: Text
$sel:roleArn:Encryption' :: Encryption -> Text
roleArn} -> Text
roleArn) (\s :: Encryption
s@Encryption' {} Text
a -> Encryption
s {$sel:roleArn:Encryption' :: Text
roleArn = Text
a} :: Encryption)

instance Core.FromJSON Encryption where
  parseJSON :: Value -> Parser Encryption
parseJSON =
    String
-> (Object -> Parser Encryption) -> Value -> Parser Encryption
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Encryption"
      ( \Object
x ->
          Maybe KeyType
-> Maybe Text
-> Maybe Text
-> Maybe Algorithm
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Text
-> Encryption
Encryption'
            (Maybe KeyType
 -> Maybe Text
 -> Maybe Text
 -> Maybe Algorithm
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Text
 -> Encryption)
-> Parser (Maybe KeyType)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Algorithm
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Text
      -> Encryption)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe KeyType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"keyType")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Algorithm
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Text
   -> Encryption)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Algorithm
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Text
      -> Encryption)
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
"resourceId")
            Parser
  (Maybe Text
   -> Maybe Algorithm
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Text
   -> Encryption)
-> Parser (Maybe Text)
-> Parser
     (Maybe Algorithm
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Text
      -> Encryption)
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
"url")
            Parser
  (Maybe Algorithm
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Text
   -> Encryption)
-> Parser (Maybe Algorithm)
-> Parser
     (Maybe Text
      -> Maybe Text -> Maybe Text -> Maybe Text -> Text -> Encryption)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Algorithm)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"algorithm")
            Parser
  (Maybe Text
   -> Maybe Text -> Maybe Text -> Maybe Text -> Text -> Encryption)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> Maybe Text -> Maybe Text -> Text -> Encryption)
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
"constantInitializationVector")
            Parser
  (Maybe Text -> Maybe Text -> Maybe Text -> Text -> Encryption)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> Text -> Encryption)
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
"deviceId")
            Parser (Maybe Text -> Maybe Text -> Text -> Encryption)
-> Parser (Maybe Text) -> Parser (Maybe Text -> Text -> Encryption)
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
"region")
            Parser (Maybe Text -> Text -> Encryption)
-> Parser (Maybe Text) -> Parser (Text -> Encryption)
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
"secretArn")
            Parser (Text -> Encryption) -> Parser Text -> Parser Encryption
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"roleArn")
      )

instance Prelude.Hashable Encryption

instance Prelude.NFData Encryption

instance Core.ToJSON Encryption where
  toJSON :: Encryption -> Value
toJSON Encryption' {Maybe Text
Maybe Algorithm
Maybe KeyType
Text
roleArn :: Text
secretArn :: Maybe Text
region :: Maybe Text
deviceId :: Maybe Text
constantInitializationVector :: Maybe Text
algorithm :: Maybe Algorithm
url :: Maybe Text
resourceId :: Maybe Text
keyType :: Maybe KeyType
$sel:roleArn:Encryption' :: Encryption -> Text
$sel:secretArn:Encryption' :: Encryption -> Maybe Text
$sel:region:Encryption' :: Encryption -> Maybe Text
$sel:deviceId:Encryption' :: Encryption -> Maybe Text
$sel:constantInitializationVector:Encryption' :: Encryption -> Maybe Text
$sel:algorithm:Encryption' :: Encryption -> Maybe Algorithm
$sel:url:Encryption' :: Encryption -> Maybe Text
$sel:resourceId:Encryption' :: Encryption -> Maybe Text
$sel:keyType:Encryption' :: Encryption -> Maybe KeyType
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"keyType" Text -> KeyType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (KeyType -> Pair) -> Maybe KeyType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe KeyType
keyType,
            (Text
"resourceId" 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
resourceId,
            (Text
"url" 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
url,
            (Text
"algorithm" Text -> Algorithm -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Algorithm -> Pair) -> Maybe Algorithm -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Algorithm
algorithm,
            (Text
"constantInitializationVector" 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
constantInitializationVector,
            (Text
"deviceId" 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
deviceId,
            (Text
"region" 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
region,
            (Text
"secretArn" 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
secretArn,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"roleArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
roleArn)
          ]
      )