{-# 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.IoT.Types.StartSigningJobParameter
-- 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.IoT.Types.StartSigningJobParameter where

import qualified Amazonka.Core as Core
import Amazonka.IoT.Types.Destination
import Amazonka.IoT.Types.SigningProfileParameter
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Information required to start a signing job.
--
-- /See:/ 'newStartSigningJobParameter' smart constructor.
data StartSigningJobParameter = StartSigningJobParameter'
  { -- | The location to write the code-signed file.
    StartSigningJobParameter -> Maybe Destination
destination :: Prelude.Maybe Destination,
    -- | The code-signing profile name.
    StartSigningJobParameter -> Maybe Text
signingProfileName :: Prelude.Maybe Prelude.Text,
    -- | Describes the code-signing profile.
    StartSigningJobParameter -> Maybe SigningProfileParameter
signingProfileParameter :: Prelude.Maybe SigningProfileParameter
  }
  deriving (StartSigningJobParameter -> StartSigningJobParameter -> Bool
(StartSigningJobParameter -> StartSigningJobParameter -> Bool)
-> (StartSigningJobParameter -> StartSigningJobParameter -> Bool)
-> Eq StartSigningJobParameter
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartSigningJobParameter -> StartSigningJobParameter -> Bool
$c/= :: StartSigningJobParameter -> StartSigningJobParameter -> Bool
== :: StartSigningJobParameter -> StartSigningJobParameter -> Bool
$c== :: StartSigningJobParameter -> StartSigningJobParameter -> Bool
Prelude.Eq, ReadPrec [StartSigningJobParameter]
ReadPrec StartSigningJobParameter
Int -> ReadS StartSigningJobParameter
ReadS [StartSigningJobParameter]
(Int -> ReadS StartSigningJobParameter)
-> ReadS [StartSigningJobParameter]
-> ReadPrec StartSigningJobParameter
-> ReadPrec [StartSigningJobParameter]
-> Read StartSigningJobParameter
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartSigningJobParameter]
$creadListPrec :: ReadPrec [StartSigningJobParameter]
readPrec :: ReadPrec StartSigningJobParameter
$creadPrec :: ReadPrec StartSigningJobParameter
readList :: ReadS [StartSigningJobParameter]
$creadList :: ReadS [StartSigningJobParameter]
readsPrec :: Int -> ReadS StartSigningJobParameter
$creadsPrec :: Int -> ReadS StartSigningJobParameter
Prelude.Read, Int -> StartSigningJobParameter -> ShowS
[StartSigningJobParameter] -> ShowS
StartSigningJobParameter -> String
(Int -> StartSigningJobParameter -> ShowS)
-> (StartSigningJobParameter -> String)
-> ([StartSigningJobParameter] -> ShowS)
-> Show StartSigningJobParameter
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartSigningJobParameter] -> ShowS
$cshowList :: [StartSigningJobParameter] -> ShowS
show :: StartSigningJobParameter -> String
$cshow :: StartSigningJobParameter -> String
showsPrec :: Int -> StartSigningJobParameter -> ShowS
$cshowsPrec :: Int -> StartSigningJobParameter -> ShowS
Prelude.Show, (forall x.
 StartSigningJobParameter -> Rep StartSigningJobParameter x)
-> (forall x.
    Rep StartSigningJobParameter x -> StartSigningJobParameter)
-> Generic StartSigningJobParameter
forall x.
Rep StartSigningJobParameter x -> StartSigningJobParameter
forall x.
StartSigningJobParameter -> Rep StartSigningJobParameter x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep StartSigningJobParameter x -> StartSigningJobParameter
$cfrom :: forall x.
StartSigningJobParameter -> Rep StartSigningJobParameter x
Prelude.Generic)

-- |
-- Create a value of 'StartSigningJobParameter' 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:
--
-- 'destination', 'startSigningJobParameter_destination' - The location to write the code-signed file.
--
-- 'signingProfileName', 'startSigningJobParameter_signingProfileName' - The code-signing profile name.
--
-- 'signingProfileParameter', 'startSigningJobParameter_signingProfileParameter' - Describes the code-signing profile.
newStartSigningJobParameter ::
  StartSigningJobParameter
newStartSigningJobParameter :: StartSigningJobParameter
newStartSigningJobParameter =
  StartSigningJobParameter' :: Maybe Destination
-> Maybe Text
-> Maybe SigningProfileParameter
-> StartSigningJobParameter
StartSigningJobParameter'
    { $sel:destination:StartSigningJobParameter' :: Maybe Destination
destination =
        Maybe Destination
forall a. Maybe a
Prelude.Nothing,
      $sel:signingProfileName:StartSigningJobParameter' :: Maybe Text
signingProfileName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:signingProfileParameter:StartSigningJobParameter' :: Maybe SigningProfileParameter
signingProfileParameter = Maybe SigningProfileParameter
forall a. Maybe a
Prelude.Nothing
    }

-- | The location to write the code-signed file.
startSigningJobParameter_destination :: Lens.Lens' StartSigningJobParameter (Prelude.Maybe Destination)
startSigningJobParameter_destination :: (Maybe Destination -> f (Maybe Destination))
-> StartSigningJobParameter -> f StartSigningJobParameter
startSigningJobParameter_destination = (StartSigningJobParameter -> Maybe Destination)
-> (StartSigningJobParameter
    -> Maybe Destination -> StartSigningJobParameter)
-> Lens
     StartSigningJobParameter
     StartSigningJobParameter
     (Maybe Destination)
     (Maybe Destination)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartSigningJobParameter' {Maybe Destination
destination :: Maybe Destination
$sel:destination:StartSigningJobParameter' :: StartSigningJobParameter -> Maybe Destination
destination} -> Maybe Destination
destination) (\s :: StartSigningJobParameter
s@StartSigningJobParameter' {} Maybe Destination
a -> StartSigningJobParameter
s {$sel:destination:StartSigningJobParameter' :: Maybe Destination
destination = Maybe Destination
a} :: StartSigningJobParameter)

-- | The code-signing profile name.
startSigningJobParameter_signingProfileName :: Lens.Lens' StartSigningJobParameter (Prelude.Maybe Prelude.Text)
startSigningJobParameter_signingProfileName :: (Maybe Text -> f (Maybe Text))
-> StartSigningJobParameter -> f StartSigningJobParameter
startSigningJobParameter_signingProfileName = (StartSigningJobParameter -> Maybe Text)
-> (StartSigningJobParameter
    -> Maybe Text -> StartSigningJobParameter)
-> Lens
     StartSigningJobParameter
     StartSigningJobParameter
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartSigningJobParameter' {Maybe Text
signingProfileName :: Maybe Text
$sel:signingProfileName:StartSigningJobParameter' :: StartSigningJobParameter -> Maybe Text
signingProfileName} -> Maybe Text
signingProfileName) (\s :: StartSigningJobParameter
s@StartSigningJobParameter' {} Maybe Text
a -> StartSigningJobParameter
s {$sel:signingProfileName:StartSigningJobParameter' :: Maybe Text
signingProfileName = Maybe Text
a} :: StartSigningJobParameter)

-- | Describes the code-signing profile.
startSigningJobParameter_signingProfileParameter :: Lens.Lens' StartSigningJobParameter (Prelude.Maybe SigningProfileParameter)
startSigningJobParameter_signingProfileParameter :: (Maybe SigningProfileParameter
 -> f (Maybe SigningProfileParameter))
-> StartSigningJobParameter -> f StartSigningJobParameter
startSigningJobParameter_signingProfileParameter = (StartSigningJobParameter -> Maybe SigningProfileParameter)
-> (StartSigningJobParameter
    -> Maybe SigningProfileParameter -> StartSigningJobParameter)
-> Lens
     StartSigningJobParameter
     StartSigningJobParameter
     (Maybe SigningProfileParameter)
     (Maybe SigningProfileParameter)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartSigningJobParameter' {Maybe SigningProfileParameter
signingProfileParameter :: Maybe SigningProfileParameter
$sel:signingProfileParameter:StartSigningJobParameter' :: StartSigningJobParameter -> Maybe SigningProfileParameter
signingProfileParameter} -> Maybe SigningProfileParameter
signingProfileParameter) (\s :: StartSigningJobParameter
s@StartSigningJobParameter' {} Maybe SigningProfileParameter
a -> StartSigningJobParameter
s {$sel:signingProfileParameter:StartSigningJobParameter' :: Maybe SigningProfileParameter
signingProfileParameter = Maybe SigningProfileParameter
a} :: StartSigningJobParameter)

instance Core.FromJSON StartSigningJobParameter where
  parseJSON :: Value -> Parser StartSigningJobParameter
parseJSON =
    String
-> (Object -> Parser StartSigningJobParameter)
-> Value
-> Parser StartSigningJobParameter
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"StartSigningJobParameter"
      ( \Object
x ->
          Maybe Destination
-> Maybe Text
-> Maybe SigningProfileParameter
-> StartSigningJobParameter
StartSigningJobParameter'
            (Maybe Destination
 -> Maybe Text
 -> Maybe SigningProfileParameter
 -> StartSigningJobParameter)
-> Parser (Maybe Destination)
-> Parser
     (Maybe Text
      -> Maybe SigningProfileParameter -> StartSigningJobParameter)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Destination)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"destination")
            Parser
  (Maybe Text
   -> Maybe SigningProfileParameter -> StartSigningJobParameter)
-> Parser (Maybe Text)
-> Parser
     (Maybe SigningProfileParameter -> StartSigningJobParameter)
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
"signingProfileName")
            Parser (Maybe SigningProfileParameter -> StartSigningJobParameter)
-> Parser (Maybe SigningProfileParameter)
-> Parser StartSigningJobParameter
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe SigningProfileParameter)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"signingProfileParameter")
      )

instance Prelude.Hashable StartSigningJobParameter

instance Prelude.NFData StartSigningJobParameter

instance Core.ToJSON StartSigningJobParameter where
  toJSON :: StartSigningJobParameter -> Value
toJSON StartSigningJobParameter' {Maybe Text
Maybe Destination
Maybe SigningProfileParameter
signingProfileParameter :: Maybe SigningProfileParameter
signingProfileName :: Maybe Text
destination :: Maybe Destination
$sel:signingProfileParameter:StartSigningJobParameter' :: StartSigningJobParameter -> Maybe SigningProfileParameter
$sel:signingProfileName:StartSigningJobParameter' :: StartSigningJobParameter -> Maybe Text
$sel:destination:StartSigningJobParameter' :: StartSigningJobParameter -> Maybe Destination
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"destination" Text -> Destination -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Destination -> Pair) -> Maybe Destination -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Destination
destination,
            (Text
"signingProfileName" 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
signingProfileName,
            (Text
"signingProfileParameter" Text -> SigningProfileParameter -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (SigningProfileParameter -> Pair)
-> Maybe SigningProfileParameter -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SigningProfileParameter
signingProfileParameter
          ]
      )