{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Signer.Types.SigningImageFormat where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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. 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'
    { $sel:supportedFormats:SigningImageFormat' :: [ImageFormat]
supportedFormats =
        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 :: Lens' SigningImageFormat [ImageFormat]
signingImageFormat_supportedFormats = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 :: Lens' SigningImageFormat ImageFormat
signingImageFormat_defaultFormat = 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 Data.FromJSON SigningImageFormat where
  parseJSON :: Value -> Parser SigningImageFormat
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"SigningImageFormat"
      ( \Object
x ->
          [ImageFormat] -> ImageFormat -> SigningImageFormat
SigningImageFormat'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x
                            forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"supportedFormats"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"defaultFormat")
      )

instance Prelude.Hashable SigningImageFormat where
  hashWithSalt :: Int -> SigningImageFormat -> Int
hashWithSalt Int
_salt SigningImageFormat' {[ImageFormat]
ImageFormat
defaultFormat :: ImageFormat
supportedFormats :: [ImageFormat]
$sel:defaultFormat:SigningImageFormat' :: SigningImageFormat -> ImageFormat
$sel:supportedFormats:SigningImageFormat' :: SigningImageFormat -> [ImageFormat]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [ImageFormat]
supportedFormats
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ImageFormat
defaultFormat

instance Prelude.NFData SigningImageFormat where
  rnf :: SigningImageFormat -> ()
rnf SigningImageFormat' {[ImageFormat]
ImageFormat
defaultFormat :: ImageFormat
supportedFormats :: [ImageFormat]
$sel:defaultFormat:SigningImageFormat' :: SigningImageFormat -> ImageFormat
$sel:supportedFormats:SigningImageFormat' :: SigningImageFormat -> [ImageFormat]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf [ImageFormat]
supportedFormats
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ImageFormat
defaultFormat