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

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

-- | A package version input configuration.
--
-- /See:/ 'newPackageVersionInputConfig' smart constructor.
data PackageVersionInputConfig = PackageVersionInputConfig'
  { -- | A location in Amazon S3.
    PackageVersionInputConfig -> S3Location
s3Location :: S3Location
  }
  deriving (PackageVersionInputConfig -> PackageVersionInputConfig -> Bool
(PackageVersionInputConfig -> PackageVersionInputConfig -> Bool)
-> (PackageVersionInputConfig -> PackageVersionInputConfig -> Bool)
-> Eq PackageVersionInputConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PackageVersionInputConfig -> PackageVersionInputConfig -> Bool
$c/= :: PackageVersionInputConfig -> PackageVersionInputConfig -> Bool
== :: PackageVersionInputConfig -> PackageVersionInputConfig -> Bool
$c== :: PackageVersionInputConfig -> PackageVersionInputConfig -> Bool
Prelude.Eq, ReadPrec [PackageVersionInputConfig]
ReadPrec PackageVersionInputConfig
Int -> ReadS PackageVersionInputConfig
ReadS [PackageVersionInputConfig]
(Int -> ReadS PackageVersionInputConfig)
-> ReadS [PackageVersionInputConfig]
-> ReadPrec PackageVersionInputConfig
-> ReadPrec [PackageVersionInputConfig]
-> Read PackageVersionInputConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PackageVersionInputConfig]
$creadListPrec :: ReadPrec [PackageVersionInputConfig]
readPrec :: ReadPrec PackageVersionInputConfig
$creadPrec :: ReadPrec PackageVersionInputConfig
readList :: ReadS [PackageVersionInputConfig]
$creadList :: ReadS [PackageVersionInputConfig]
readsPrec :: Int -> ReadS PackageVersionInputConfig
$creadsPrec :: Int -> ReadS PackageVersionInputConfig
Prelude.Read, Int -> PackageVersionInputConfig -> ShowS
[PackageVersionInputConfig] -> ShowS
PackageVersionInputConfig -> String
(Int -> PackageVersionInputConfig -> ShowS)
-> (PackageVersionInputConfig -> String)
-> ([PackageVersionInputConfig] -> ShowS)
-> Show PackageVersionInputConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PackageVersionInputConfig] -> ShowS
$cshowList :: [PackageVersionInputConfig] -> ShowS
show :: PackageVersionInputConfig -> String
$cshow :: PackageVersionInputConfig -> String
showsPrec :: Int -> PackageVersionInputConfig -> ShowS
$cshowsPrec :: Int -> PackageVersionInputConfig -> ShowS
Prelude.Show, (forall x.
 PackageVersionInputConfig -> Rep PackageVersionInputConfig x)
-> (forall x.
    Rep PackageVersionInputConfig x -> PackageVersionInputConfig)
-> Generic PackageVersionInputConfig
forall x.
Rep PackageVersionInputConfig x -> PackageVersionInputConfig
forall x.
PackageVersionInputConfig -> Rep PackageVersionInputConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PackageVersionInputConfig x -> PackageVersionInputConfig
$cfrom :: forall x.
PackageVersionInputConfig -> Rep PackageVersionInputConfig x
Prelude.Generic)

-- |
-- Create a value of 'PackageVersionInputConfig' 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:
--
-- 's3Location', 'packageVersionInputConfig_s3Location' - A location in Amazon S3.
newPackageVersionInputConfig ::
  -- | 's3Location'
  S3Location ->
  PackageVersionInputConfig
newPackageVersionInputConfig :: S3Location -> PackageVersionInputConfig
newPackageVersionInputConfig S3Location
pS3Location_ =
  PackageVersionInputConfig' :: S3Location -> PackageVersionInputConfig
PackageVersionInputConfig'
    { $sel:s3Location:PackageVersionInputConfig' :: S3Location
s3Location =
        S3Location
pS3Location_
    }

-- | A location in Amazon S3.
packageVersionInputConfig_s3Location :: Lens.Lens' PackageVersionInputConfig S3Location
packageVersionInputConfig_s3Location :: (S3Location -> f S3Location)
-> PackageVersionInputConfig -> f PackageVersionInputConfig
packageVersionInputConfig_s3Location = (PackageVersionInputConfig -> S3Location)
-> (PackageVersionInputConfig
    -> S3Location -> PackageVersionInputConfig)
-> Lens
     PackageVersionInputConfig
     PackageVersionInputConfig
     S3Location
     S3Location
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PackageVersionInputConfig' {S3Location
s3Location :: S3Location
$sel:s3Location:PackageVersionInputConfig' :: PackageVersionInputConfig -> S3Location
s3Location} -> S3Location
s3Location) (\s :: PackageVersionInputConfig
s@PackageVersionInputConfig' {} S3Location
a -> PackageVersionInputConfig
s {$sel:s3Location:PackageVersionInputConfig' :: S3Location
s3Location = S3Location
a} :: PackageVersionInputConfig)

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

instance Prelude.Hashable PackageVersionInputConfig

instance Prelude.NFData PackageVersionInputConfig

instance Core.ToJSON PackageVersionInputConfig where
  toJSON :: PackageVersionInputConfig -> Value
toJSON PackageVersionInputConfig' {S3Location
s3Location :: S3Location
$sel:s3Location:PackageVersionInputConfig' :: PackageVersionInputConfig -> S3Location
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"S3Location" Text -> S3Location -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= S3Location
s3Location)]
      )