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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | A package object.
--
-- /See:/ 'newPackageObject' smart constructor.
data PackageObject = PackageObject'
  { -- | The object\'s name.
    PackageObject -> Text
name :: Prelude.Text,
    -- | The object\'s package version.
    PackageObject -> Text
packageVersion :: Prelude.Text,
    -- | The object\'s patch version.
    PackageObject -> Text
patchVersion :: Prelude.Text
  }
  deriving (PackageObject -> PackageObject -> Bool
(PackageObject -> PackageObject -> Bool)
-> (PackageObject -> PackageObject -> Bool) -> Eq PackageObject
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PackageObject -> PackageObject -> Bool
$c/= :: PackageObject -> PackageObject -> Bool
== :: PackageObject -> PackageObject -> Bool
$c== :: PackageObject -> PackageObject -> Bool
Prelude.Eq, ReadPrec [PackageObject]
ReadPrec PackageObject
Int -> ReadS PackageObject
ReadS [PackageObject]
(Int -> ReadS PackageObject)
-> ReadS [PackageObject]
-> ReadPrec PackageObject
-> ReadPrec [PackageObject]
-> Read PackageObject
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PackageObject]
$creadListPrec :: ReadPrec [PackageObject]
readPrec :: ReadPrec PackageObject
$creadPrec :: ReadPrec PackageObject
readList :: ReadS [PackageObject]
$creadList :: ReadS [PackageObject]
readsPrec :: Int -> ReadS PackageObject
$creadsPrec :: Int -> ReadS PackageObject
Prelude.Read, Int -> PackageObject -> ShowS
[PackageObject] -> ShowS
PackageObject -> String
(Int -> PackageObject -> ShowS)
-> (PackageObject -> String)
-> ([PackageObject] -> ShowS)
-> Show PackageObject
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PackageObject] -> ShowS
$cshowList :: [PackageObject] -> ShowS
show :: PackageObject -> String
$cshow :: PackageObject -> String
showsPrec :: Int -> PackageObject -> ShowS
$cshowsPrec :: Int -> PackageObject -> ShowS
Prelude.Show, (forall x. PackageObject -> Rep PackageObject x)
-> (forall x. Rep PackageObject x -> PackageObject)
-> Generic PackageObject
forall x. Rep PackageObject x -> PackageObject
forall x. PackageObject -> Rep PackageObject x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PackageObject x -> PackageObject
$cfrom :: forall x. PackageObject -> Rep PackageObject x
Prelude.Generic)

-- |
-- Create a value of 'PackageObject' 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:
--
-- 'name', 'packageObject_name' - The object\'s name.
--
-- 'packageVersion', 'packageObject_packageVersion' - The object\'s package version.
--
-- 'patchVersion', 'packageObject_patchVersion' - The object\'s patch version.
newPackageObject ::
  -- | 'name'
  Prelude.Text ->
  -- | 'packageVersion'
  Prelude.Text ->
  -- | 'patchVersion'
  Prelude.Text ->
  PackageObject
newPackageObject :: Text -> Text -> Text -> PackageObject
newPackageObject
  Text
pName_
  Text
pPackageVersion_
  Text
pPatchVersion_ =
    PackageObject' :: Text -> Text -> Text -> PackageObject
PackageObject'
      { $sel:name:PackageObject' :: Text
name = Text
pName_,
        $sel:packageVersion:PackageObject' :: Text
packageVersion = Text
pPackageVersion_,
        $sel:patchVersion:PackageObject' :: Text
patchVersion = Text
pPatchVersion_
      }

-- | The object\'s name.
packageObject_name :: Lens.Lens' PackageObject Prelude.Text
packageObject_name :: (Text -> f Text) -> PackageObject -> f PackageObject
packageObject_name = (PackageObject -> Text)
-> (PackageObject -> Text -> PackageObject)
-> Lens PackageObject PackageObject Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PackageObject' {Text
name :: Text
$sel:name:PackageObject' :: PackageObject -> Text
name} -> Text
name) (\s :: PackageObject
s@PackageObject' {} Text
a -> PackageObject
s {$sel:name:PackageObject' :: Text
name = Text
a} :: PackageObject)

-- | The object\'s package version.
packageObject_packageVersion :: Lens.Lens' PackageObject Prelude.Text
packageObject_packageVersion :: (Text -> f Text) -> PackageObject -> f PackageObject
packageObject_packageVersion = (PackageObject -> Text)
-> (PackageObject -> Text -> PackageObject)
-> Lens PackageObject PackageObject Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PackageObject' {Text
packageVersion :: Text
$sel:packageVersion:PackageObject' :: PackageObject -> Text
packageVersion} -> Text
packageVersion) (\s :: PackageObject
s@PackageObject' {} Text
a -> PackageObject
s {$sel:packageVersion:PackageObject' :: Text
packageVersion = Text
a} :: PackageObject)

-- | The object\'s patch version.
packageObject_patchVersion :: Lens.Lens' PackageObject Prelude.Text
packageObject_patchVersion :: (Text -> f Text) -> PackageObject -> f PackageObject
packageObject_patchVersion = (PackageObject -> Text)
-> (PackageObject -> Text -> PackageObject)
-> Lens PackageObject PackageObject Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PackageObject' {Text
patchVersion :: Text
$sel:patchVersion:PackageObject' :: PackageObject -> Text
patchVersion} -> Text
patchVersion) (\s :: PackageObject
s@PackageObject' {} Text
a -> PackageObject
s {$sel:patchVersion:PackageObject' :: Text
patchVersion = Text
a} :: PackageObject)

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

instance Prelude.Hashable PackageObject

instance Prelude.NFData PackageObject