{-# 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.Panorama.Types.PackageImportJobOutputConfig
-- 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.Panorama.Types.PackageImportJobOutputConfig where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Panorama.Types.PackageVersionOutputConfig
import qualified Amazonka.Prelude as Prelude

-- | An output configuration for a package import job.
--
-- /See:/ 'newPackageImportJobOutputConfig' smart constructor.
data PackageImportJobOutputConfig = PackageImportJobOutputConfig'
  { -- | The package version\'s output configuration.
    PackageImportJobOutputConfig -> Maybe PackageVersionOutputConfig
packageVersionOutputConfig :: Prelude.Maybe PackageVersionOutputConfig
  }
  deriving (PackageImportJobOutputConfig
-> PackageImportJobOutputConfig -> Bool
(PackageImportJobOutputConfig
 -> PackageImportJobOutputConfig -> Bool)
-> (PackageImportJobOutputConfig
    -> PackageImportJobOutputConfig -> Bool)
-> Eq PackageImportJobOutputConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PackageImportJobOutputConfig
-> PackageImportJobOutputConfig -> Bool
$c/= :: PackageImportJobOutputConfig
-> PackageImportJobOutputConfig -> Bool
== :: PackageImportJobOutputConfig
-> PackageImportJobOutputConfig -> Bool
$c== :: PackageImportJobOutputConfig
-> PackageImportJobOutputConfig -> Bool
Prelude.Eq, ReadPrec [PackageImportJobOutputConfig]
ReadPrec PackageImportJobOutputConfig
Int -> ReadS PackageImportJobOutputConfig
ReadS [PackageImportJobOutputConfig]
(Int -> ReadS PackageImportJobOutputConfig)
-> ReadS [PackageImportJobOutputConfig]
-> ReadPrec PackageImportJobOutputConfig
-> ReadPrec [PackageImportJobOutputConfig]
-> Read PackageImportJobOutputConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PackageImportJobOutputConfig]
$creadListPrec :: ReadPrec [PackageImportJobOutputConfig]
readPrec :: ReadPrec PackageImportJobOutputConfig
$creadPrec :: ReadPrec PackageImportJobOutputConfig
readList :: ReadS [PackageImportJobOutputConfig]
$creadList :: ReadS [PackageImportJobOutputConfig]
readsPrec :: Int -> ReadS PackageImportJobOutputConfig
$creadsPrec :: Int -> ReadS PackageImportJobOutputConfig
Prelude.Read, Int -> PackageImportJobOutputConfig -> ShowS
[PackageImportJobOutputConfig] -> ShowS
PackageImportJobOutputConfig -> String
(Int -> PackageImportJobOutputConfig -> ShowS)
-> (PackageImportJobOutputConfig -> String)
-> ([PackageImportJobOutputConfig] -> ShowS)
-> Show PackageImportJobOutputConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PackageImportJobOutputConfig] -> ShowS
$cshowList :: [PackageImportJobOutputConfig] -> ShowS
show :: PackageImportJobOutputConfig -> String
$cshow :: PackageImportJobOutputConfig -> String
showsPrec :: Int -> PackageImportJobOutputConfig -> ShowS
$cshowsPrec :: Int -> PackageImportJobOutputConfig -> ShowS
Prelude.Show, (forall x.
 PackageImportJobOutputConfig -> Rep PackageImportJobOutputConfig x)
-> (forall x.
    Rep PackageImportJobOutputConfig x -> PackageImportJobOutputConfig)
-> Generic PackageImportJobOutputConfig
forall x.
Rep PackageImportJobOutputConfig x -> PackageImportJobOutputConfig
forall x.
PackageImportJobOutputConfig -> Rep PackageImportJobOutputConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PackageImportJobOutputConfig x -> PackageImportJobOutputConfig
$cfrom :: forall x.
PackageImportJobOutputConfig -> Rep PackageImportJobOutputConfig x
Prelude.Generic)

-- |
-- Create a value of 'PackageImportJobOutputConfig' 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:
--
-- 'packageVersionOutputConfig', 'packageImportJobOutputConfig_packageVersionOutputConfig' - The package version\'s output configuration.
newPackageImportJobOutputConfig ::
  PackageImportJobOutputConfig
newPackageImportJobOutputConfig :: PackageImportJobOutputConfig
newPackageImportJobOutputConfig =
  PackageImportJobOutputConfig' :: Maybe PackageVersionOutputConfig -> PackageImportJobOutputConfig
PackageImportJobOutputConfig'
    { $sel:packageVersionOutputConfig:PackageImportJobOutputConfig' :: Maybe PackageVersionOutputConfig
packageVersionOutputConfig =
        Maybe PackageVersionOutputConfig
forall a. Maybe a
Prelude.Nothing
    }

-- | The package version\'s output configuration.
packageImportJobOutputConfig_packageVersionOutputConfig :: Lens.Lens' PackageImportJobOutputConfig (Prelude.Maybe PackageVersionOutputConfig)
packageImportJobOutputConfig_packageVersionOutputConfig :: (Maybe PackageVersionOutputConfig
 -> f (Maybe PackageVersionOutputConfig))
-> PackageImportJobOutputConfig -> f PackageImportJobOutputConfig
packageImportJobOutputConfig_packageVersionOutputConfig = (PackageImportJobOutputConfig -> Maybe PackageVersionOutputConfig)
-> (PackageImportJobOutputConfig
    -> Maybe PackageVersionOutputConfig
    -> PackageImportJobOutputConfig)
-> Lens
     PackageImportJobOutputConfig
     PackageImportJobOutputConfig
     (Maybe PackageVersionOutputConfig)
     (Maybe PackageVersionOutputConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PackageImportJobOutputConfig' {Maybe PackageVersionOutputConfig
packageVersionOutputConfig :: Maybe PackageVersionOutputConfig
$sel:packageVersionOutputConfig:PackageImportJobOutputConfig' :: PackageImportJobOutputConfig -> Maybe PackageVersionOutputConfig
packageVersionOutputConfig} -> Maybe PackageVersionOutputConfig
packageVersionOutputConfig) (\s :: PackageImportJobOutputConfig
s@PackageImportJobOutputConfig' {} Maybe PackageVersionOutputConfig
a -> PackageImportJobOutputConfig
s {$sel:packageVersionOutputConfig:PackageImportJobOutputConfig' :: Maybe PackageVersionOutputConfig
packageVersionOutputConfig = Maybe PackageVersionOutputConfig
a} :: PackageImportJobOutputConfig)

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

instance
  Prelude.Hashable
    PackageImportJobOutputConfig

instance Prelude.NFData PackageImportJobOutputConfig

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