{-# 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.SigningImageFormat
-- 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.SigningImageFormat where

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

-- | The image format of a code signing platform or profile.
--
-- /See:/ 'newSigningImageFormat' smart constructor.
data SigningImageFormat = SigningImageFormat'
  { -- | The supported formats of a code signing image.
    SigningImageFormat -> [ImageFormat]
supportedFormats :: [ImageFormat],
    -- | The default format of a code signing image.
    SigningImageFormat -> ImageFormat
defaultFormat :: ImageFormat
  }
  deriving (SigningImageFormat -> SigningImageFormat -> Bool
(SigningImageFormat -> SigningImageFormat -> Bool)
-> (SigningImageFormat -> SigningImageFormat -> Bool)
-> Eq SigningImageFormat
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SigningImageFormat -> SigningImageFormat -> Bool
$c/= :: SigningImageFormat -> SigningImageFormat -> Bool
== :: SigningImageFormat -> SigningImageFormat -> Bool
$c== :: SigningImageFormat -> SigningImageFormat -> Bool
Prelude.Eq, ReadPrec [SigningImageFormat]
ReadPrec SigningImageFormat
Int -> ReadS SigningImageFormat
ReadS [SigningImageFormat]
(Int -> ReadS SigningImageFormat)
-> ReadS [SigningImageFormat]
-> ReadPrec SigningImageFormat
-> ReadPrec [SigningImageFormat]
-> Read SigningImageFormat
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SigningImageFormat]
$creadListPrec :: ReadPrec [SigningImageFormat]
readPrec :: ReadPrec SigningImageFormat
$creadPrec :: ReadPrec SigningImageFormat
readList :: ReadS [SigningImageFormat]
$creadList :: ReadS [SigningImageFormat]
readsPrec :: Int -> ReadS SigningImageFormat
$creadsPrec :: Int -> ReadS SigningImageFormat
Prelude.Read, Int -> SigningImageFormat -> ShowS
[SigningImageFormat] -> ShowS
SigningImageFormat -> String
(Int -> SigningImageFormat -> ShowS)
-> (SigningImageFormat -> String)
-> ([SigningImageFormat] -> ShowS)
-> Show SigningImageFormat
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SigningImageFormat] -> ShowS
$cshowList :: [SigningImageFormat] -> ShowS
show :: SigningImageFormat -> String
$cshow :: SigningImageFormat -> String
showsPrec :: Int -> SigningImageFormat -> ShowS
$cshowsPrec :: Int -> SigningImageFormat -> ShowS
Prelude.Show, (forall x. SigningImageFormat -> Rep SigningImageFormat x)
-> (forall x. Rep SigningImageFormat x -> SigningImageFormat)
-> Generic SigningImageFormat
forall x. Rep SigningImageFormat x -> SigningImageFormat
forall x. SigningImageFormat -> Rep SigningImageFormat x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SigningImageFormat x -> SigningImageFormat
$cfrom :: forall x. SigningImageFormat -> Rep SigningImageFormat x
Prelude.Generic)

-- |
-- Create a value of 'SigningImageFormat' 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:
--
-- 'supportedFormats', 'signingImageFormat_supportedFormats' - The supported formats of a code signing image.
--
-- 'defaultFormat', 'signingImageFormat_defaultFormat' - The default format of a code signing image.
newSigningImageFormat ::
  -- | 'defaultFormat'
  ImageFormat ->
  SigningImageFormat
newSigningImageFormat :: ImageFormat -> SigningImageFormat
newSigningImageFormat ImageFormat
pDefaultFormat_ =
  SigningImageFormat' :: [ImageFormat] -> ImageFormat -> SigningImageFormat
SigningImageFormat'
    { $sel:supportedFormats:SigningImageFormat' :: [ImageFormat]
supportedFormats =
        [ImageFormat]
forall a. Monoid a => a
Prelude.mempty,
      $sel:defaultFormat:SigningImageFormat' :: ImageFormat
defaultFormat = ImageFormat
pDefaultFormat_
    }

-- | The supported formats of a code signing image.
signingImageFormat_supportedFormats :: Lens.Lens' SigningImageFormat [ImageFormat]
signingImageFormat_supportedFormats :: ([ImageFormat] -> f [ImageFormat])
-> SigningImageFormat -> f SigningImageFormat
signingImageFormat_supportedFormats = (SigningImageFormat -> [ImageFormat])
-> (SigningImageFormat -> [ImageFormat] -> SigningImageFormat)
-> Lens
     SigningImageFormat SigningImageFormat [ImageFormat] [ImageFormat]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SigningImageFormat' {[ImageFormat]
supportedFormats :: [ImageFormat]
$sel:supportedFormats:SigningImageFormat' :: SigningImageFormat -> [ImageFormat]
supportedFormats} -> [ImageFormat]
supportedFormats) (\s :: SigningImageFormat
s@SigningImageFormat' {} [ImageFormat]
a -> SigningImageFormat
s {$sel:supportedFormats:SigningImageFormat' :: [ImageFormat]
supportedFormats = [ImageFormat]
a} :: SigningImageFormat) (([ImageFormat] -> f [ImageFormat])
 -> SigningImageFormat -> f SigningImageFormat)
-> (([ImageFormat] -> f [ImageFormat])
    -> [ImageFormat] -> f [ImageFormat])
-> ([ImageFormat] -> f [ImageFormat])
-> SigningImageFormat
-> f SigningImageFormat
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([ImageFormat] -> f [ImageFormat])
-> [ImageFormat] -> f [ImageFormat]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The default format of a code signing image.
signingImageFormat_defaultFormat :: Lens.Lens' SigningImageFormat ImageFormat
signingImageFormat_defaultFormat :: (ImageFormat -> f ImageFormat)
-> SigningImageFormat -> f SigningImageFormat
signingImageFormat_defaultFormat = (SigningImageFormat -> ImageFormat)
-> (SigningImageFormat -> ImageFormat -> SigningImageFormat)
-> Lens
     SigningImageFormat SigningImageFormat ImageFormat ImageFormat
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SigningImageFormat' {ImageFormat
defaultFormat :: ImageFormat
$sel:defaultFormat:SigningImageFormat' :: SigningImageFormat -> ImageFormat
defaultFormat} -> ImageFormat
defaultFormat) (\s :: SigningImageFormat
s@SigningImageFormat' {} ImageFormat
a -> SigningImageFormat
s {$sel:defaultFormat:SigningImageFormat' :: ImageFormat
defaultFormat = ImageFormat
a} :: SigningImageFormat)

instance Core.FromJSON SigningImageFormat where
  parseJSON :: Value -> Parser SigningImageFormat
parseJSON =
    String
-> (Object -> Parser SigningImageFormat)
-> Value
-> Parser SigningImageFormat
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"SigningImageFormat"
      ( \Object
x ->
          [ImageFormat] -> ImageFormat -> SigningImageFormat
SigningImageFormat'
            ([ImageFormat] -> ImageFormat -> SigningImageFormat)
-> Parser [ImageFormat]
-> Parser (ImageFormat -> SigningImageFormat)
forall (f :: * -> *) a b. Functor 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
"supportedFormats"
                            Parser (Maybe [ImageFormat])
-> [ImageFormat] -> Parser [ImageFormat]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [ImageFormat]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser (ImageFormat -> SigningImageFormat)
-> Parser ImageFormat -> Parser SigningImageFormat
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser ImageFormat
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"defaultFormat")
      )

instance Prelude.Hashable SigningImageFormat

instance Prelude.NFData SigningImageFormat