{-# 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.Signer.Types.SigningPlatformOverrides
-- 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.Signer.Types.SigningPlatformOverrides where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Signer.Types.ImageFormat
import Amazonka.Signer.Types.SigningConfigurationOverrides

-- | Any overrides that are applied to the signing configuration of a code
-- signing platform.
--
-- /See:/ 'newSigningPlatformOverrides' smart constructor.
data SigningPlatformOverrides = SigningPlatformOverrides'
  { -- | A signing configuration that overrides the default encryption or hash
    -- algorithm of a signing job.
    SigningPlatformOverrides -> Maybe SigningConfigurationOverrides
signingConfiguration :: Prelude.Maybe SigningConfigurationOverrides,
    -- | A signed image is a JSON object. When overriding the default signing
    -- platform configuration, a customer can select either of two signing
    -- formats, @JSONEmbedded@ or @JSONDetached@. (A third format value,
    -- @JSON@, is reserved for future use.) With @JSONEmbedded@, the signing
    -- image has the payload embedded in it. With @JSONDetached@, the payload
    -- is not be embedded in the signing image.
    SigningPlatformOverrides -> Maybe ImageFormat
signingImageFormat :: Prelude.Maybe ImageFormat
  }
  deriving (SigningPlatformOverrides -> SigningPlatformOverrides -> Bool
(SigningPlatformOverrides -> SigningPlatformOverrides -> Bool)
-> (SigningPlatformOverrides -> SigningPlatformOverrides -> Bool)
-> Eq SigningPlatformOverrides
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SigningPlatformOverrides -> SigningPlatformOverrides -> Bool
$c/= :: SigningPlatformOverrides -> SigningPlatformOverrides -> Bool
== :: SigningPlatformOverrides -> SigningPlatformOverrides -> Bool
$c== :: SigningPlatformOverrides -> SigningPlatformOverrides -> Bool
Prelude.Eq, ReadPrec [SigningPlatformOverrides]
ReadPrec SigningPlatformOverrides
Int -> ReadS SigningPlatformOverrides
ReadS [SigningPlatformOverrides]
(Int -> ReadS SigningPlatformOverrides)
-> ReadS [SigningPlatformOverrides]
-> ReadPrec SigningPlatformOverrides
-> ReadPrec [SigningPlatformOverrides]
-> Read SigningPlatformOverrides
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SigningPlatformOverrides]
$creadListPrec :: ReadPrec [SigningPlatformOverrides]
readPrec :: ReadPrec SigningPlatformOverrides
$creadPrec :: ReadPrec SigningPlatformOverrides
readList :: ReadS [SigningPlatformOverrides]
$creadList :: ReadS [SigningPlatformOverrides]
readsPrec :: Int -> ReadS SigningPlatformOverrides
$creadsPrec :: Int -> ReadS SigningPlatformOverrides
Prelude.Read, Int -> SigningPlatformOverrides -> ShowS
[SigningPlatformOverrides] -> ShowS
SigningPlatformOverrides -> String
(Int -> SigningPlatformOverrides -> ShowS)
-> (SigningPlatformOverrides -> String)
-> ([SigningPlatformOverrides] -> ShowS)
-> Show SigningPlatformOverrides
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SigningPlatformOverrides] -> ShowS
$cshowList :: [SigningPlatformOverrides] -> ShowS
show :: SigningPlatformOverrides -> String
$cshow :: SigningPlatformOverrides -> String
showsPrec :: Int -> SigningPlatformOverrides -> ShowS
$cshowsPrec :: Int -> SigningPlatformOverrides -> ShowS
Prelude.Show, (forall x.
 SigningPlatformOverrides -> Rep SigningPlatformOverrides x)
-> (forall x.
    Rep SigningPlatformOverrides x -> SigningPlatformOverrides)
-> Generic SigningPlatformOverrides
forall x.
Rep SigningPlatformOverrides x -> SigningPlatformOverrides
forall x.
SigningPlatformOverrides -> Rep SigningPlatformOverrides x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep SigningPlatformOverrides x -> SigningPlatformOverrides
$cfrom :: forall x.
SigningPlatformOverrides -> Rep SigningPlatformOverrides x
Prelude.Generic)

-- |
-- Create a value of 'SigningPlatformOverrides' 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:
--
-- 'signingConfiguration', 'signingPlatformOverrides_signingConfiguration' - A signing configuration that overrides the default encryption or hash
-- algorithm of a signing job.
--
-- 'signingImageFormat', 'signingPlatformOverrides_signingImageFormat' - A signed image is a JSON object. When overriding the default signing
-- platform configuration, a customer can select either of two signing
-- formats, @JSONEmbedded@ or @JSONDetached@. (A third format value,
-- @JSON@, is reserved for future use.) With @JSONEmbedded@, the signing
-- image has the payload embedded in it. With @JSONDetached@, the payload
-- is not be embedded in the signing image.
newSigningPlatformOverrides ::
  SigningPlatformOverrides
newSigningPlatformOverrides :: SigningPlatformOverrides
newSigningPlatformOverrides =
  SigningPlatformOverrides' :: Maybe SigningConfigurationOverrides
-> Maybe ImageFormat -> SigningPlatformOverrides
SigningPlatformOverrides'
    { $sel:signingConfiguration:SigningPlatformOverrides' :: Maybe SigningConfigurationOverrides
signingConfiguration =
        Maybe SigningConfigurationOverrides
forall a. Maybe a
Prelude.Nothing,
      $sel:signingImageFormat:SigningPlatformOverrides' :: Maybe ImageFormat
signingImageFormat = Maybe ImageFormat
forall a. Maybe a
Prelude.Nothing
    }

-- | A signing configuration that overrides the default encryption or hash
-- algorithm of a signing job.
signingPlatformOverrides_signingConfiguration :: Lens.Lens' SigningPlatformOverrides (Prelude.Maybe SigningConfigurationOverrides)
signingPlatformOverrides_signingConfiguration :: (Maybe SigningConfigurationOverrides
 -> f (Maybe SigningConfigurationOverrides))
-> SigningPlatformOverrides -> f SigningPlatformOverrides
signingPlatformOverrides_signingConfiguration = (SigningPlatformOverrides -> Maybe SigningConfigurationOverrides)
-> (SigningPlatformOverrides
    -> Maybe SigningConfigurationOverrides -> SigningPlatformOverrides)
-> Lens
     SigningPlatformOverrides
     SigningPlatformOverrides
     (Maybe SigningConfigurationOverrides)
     (Maybe SigningConfigurationOverrides)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SigningPlatformOverrides' {Maybe SigningConfigurationOverrides
signingConfiguration :: Maybe SigningConfigurationOverrides
$sel:signingConfiguration:SigningPlatformOverrides' :: SigningPlatformOverrides -> Maybe SigningConfigurationOverrides
signingConfiguration} -> Maybe SigningConfigurationOverrides
signingConfiguration) (\s :: SigningPlatformOverrides
s@SigningPlatformOverrides' {} Maybe SigningConfigurationOverrides
a -> SigningPlatformOverrides
s {$sel:signingConfiguration:SigningPlatformOverrides' :: Maybe SigningConfigurationOverrides
signingConfiguration = Maybe SigningConfigurationOverrides
a} :: SigningPlatformOverrides)

-- | A signed image is a JSON object. When overriding the default signing
-- platform configuration, a customer can select either of two signing
-- formats, @JSONEmbedded@ or @JSONDetached@. (A third format value,
-- @JSON@, is reserved for future use.) With @JSONEmbedded@, the signing
-- image has the payload embedded in it. With @JSONDetached@, the payload
-- is not be embedded in the signing image.
signingPlatformOverrides_signingImageFormat :: Lens.Lens' SigningPlatformOverrides (Prelude.Maybe ImageFormat)
signingPlatformOverrides_signingImageFormat :: (Maybe ImageFormat -> f (Maybe ImageFormat))
-> SigningPlatformOverrides -> f SigningPlatformOverrides
signingPlatformOverrides_signingImageFormat = (SigningPlatformOverrides -> Maybe ImageFormat)
-> (SigningPlatformOverrides
    -> Maybe ImageFormat -> SigningPlatformOverrides)
-> Lens
     SigningPlatformOverrides
     SigningPlatformOverrides
     (Maybe ImageFormat)
     (Maybe ImageFormat)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SigningPlatformOverrides' {Maybe ImageFormat
signingImageFormat :: Maybe ImageFormat
$sel:signingImageFormat:SigningPlatformOverrides' :: SigningPlatformOverrides -> Maybe ImageFormat
signingImageFormat} -> Maybe ImageFormat
signingImageFormat) (\s :: SigningPlatformOverrides
s@SigningPlatformOverrides' {} Maybe ImageFormat
a -> SigningPlatformOverrides
s {$sel:signingImageFormat:SigningPlatformOverrides' :: Maybe ImageFormat
signingImageFormat = Maybe ImageFormat
a} :: SigningPlatformOverrides)

instance Core.FromJSON SigningPlatformOverrides where
  parseJSON :: Value -> Parser SigningPlatformOverrides
parseJSON =
    String
-> (Object -> Parser SigningPlatformOverrides)
-> Value
-> Parser SigningPlatformOverrides
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"SigningPlatformOverrides"
      ( \Object
x ->
          Maybe SigningConfigurationOverrides
-> Maybe ImageFormat -> SigningPlatformOverrides
SigningPlatformOverrides'
            (Maybe SigningConfigurationOverrides
 -> Maybe ImageFormat -> SigningPlatformOverrides)
-> Parser (Maybe SigningConfigurationOverrides)
-> Parser (Maybe ImageFormat -> SigningPlatformOverrides)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe SigningConfigurationOverrides)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"signingConfiguration")
            Parser (Maybe ImageFormat -> SigningPlatformOverrides)
-> Parser (Maybe ImageFormat) -> Parser SigningPlatformOverrides
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ImageFormat)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"signingImageFormat")
      )

instance Prelude.Hashable SigningPlatformOverrides

instance Prelude.NFData SigningPlatformOverrides

instance Core.ToJSON SigningPlatformOverrides where
  toJSON :: SigningPlatformOverrides -> Value
toJSON SigningPlatformOverrides' {Maybe ImageFormat
Maybe SigningConfigurationOverrides
signingImageFormat :: Maybe ImageFormat
signingConfiguration :: Maybe SigningConfigurationOverrides
$sel:signingImageFormat:SigningPlatformOverrides' :: SigningPlatformOverrides -> Maybe ImageFormat
$sel:signingConfiguration:SigningPlatformOverrides' :: SigningPlatformOverrides -> Maybe SigningConfigurationOverrides
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"signingConfiguration" Text -> SigningConfigurationOverrides -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (SigningConfigurationOverrides -> Pair)
-> Maybe SigningConfigurationOverrides -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SigningConfigurationOverrides
signingConfiguration,
            (Text
"signingImageFormat" Text -> ImageFormat -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (ImageFormat -> Pair) -> Maybe ImageFormat -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ImageFormat
signingImageFormat
          ]
      )