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

-- | A application verion\'s manifest file. This is a JSON document that has
-- a single key (@PayloadData@) where the value is an escaped string
-- representation of the application manifest (@graph.json@). This file is
-- located in the @graphs@ folder in your application source.
--
-- /See:/ 'newManifestPayload' smart constructor.
data ManifestPayload = ManifestPayload'
  { -- | The application manifest.
    ManifestPayload -> Maybe Text
payloadData :: Prelude.Maybe Prelude.Text
  }
  deriving (ManifestPayload -> ManifestPayload -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ManifestPayload -> ManifestPayload -> Bool
$c/= :: ManifestPayload -> ManifestPayload -> Bool
== :: ManifestPayload -> ManifestPayload -> Bool
$c== :: ManifestPayload -> ManifestPayload -> Bool
Prelude.Eq, ReadPrec [ManifestPayload]
ReadPrec ManifestPayload
Int -> ReadS ManifestPayload
ReadS [ManifestPayload]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ManifestPayload]
$creadListPrec :: ReadPrec [ManifestPayload]
readPrec :: ReadPrec ManifestPayload
$creadPrec :: ReadPrec ManifestPayload
readList :: ReadS [ManifestPayload]
$creadList :: ReadS [ManifestPayload]
readsPrec :: Int -> ReadS ManifestPayload
$creadsPrec :: Int -> ReadS ManifestPayload
Prelude.Read, Int -> ManifestPayload -> ShowS
[ManifestPayload] -> ShowS
ManifestPayload -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ManifestPayload] -> ShowS
$cshowList :: [ManifestPayload] -> ShowS
show :: ManifestPayload -> String
$cshow :: ManifestPayload -> String
showsPrec :: Int -> ManifestPayload -> ShowS
$cshowsPrec :: Int -> ManifestPayload -> ShowS
Prelude.Show, forall x. Rep ManifestPayload x -> ManifestPayload
forall x. ManifestPayload -> Rep ManifestPayload x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ManifestPayload x -> ManifestPayload
$cfrom :: forall x. ManifestPayload -> Rep ManifestPayload x
Prelude.Generic)

-- |
-- Create a value of 'ManifestPayload' 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:
--
-- 'payloadData', 'manifestPayload_payloadData' - The application manifest.
newManifestPayload ::
  ManifestPayload
newManifestPayload :: ManifestPayload
newManifestPayload =
  ManifestPayload' {$sel:payloadData:ManifestPayload' :: Maybe Text
payloadData = forall a. Maybe a
Prelude.Nothing}

-- | The application manifest.
manifestPayload_payloadData :: Lens.Lens' ManifestPayload (Prelude.Maybe Prelude.Text)
manifestPayload_payloadData :: Lens' ManifestPayload (Maybe Text)
manifestPayload_payloadData = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ManifestPayload' {Maybe Text
payloadData :: Maybe Text
$sel:payloadData:ManifestPayload' :: ManifestPayload -> Maybe Text
payloadData} -> Maybe Text
payloadData) (\s :: ManifestPayload
s@ManifestPayload' {} Maybe Text
a -> ManifestPayload
s {$sel:payloadData:ManifestPayload' :: Maybe Text
payloadData = Maybe Text
a} :: ManifestPayload)

instance Data.FromJSON ManifestPayload where
  parseJSON :: Value -> Parser ManifestPayload
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ManifestPayload"
      ( \Object
x ->
          Maybe Text -> ManifestPayload
ManifestPayload'
            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
"PayloadData")
      )

instance Prelude.Hashable ManifestPayload where
  hashWithSalt :: Int -> ManifestPayload -> Int
hashWithSalt Int
_salt ManifestPayload' {Maybe Text
payloadData :: Maybe Text
$sel:payloadData:ManifestPayload' :: ManifestPayload -> Maybe Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
payloadData

instance Prelude.NFData ManifestPayload where
  rnf :: ManifestPayload -> ()
rnf ManifestPayload' {Maybe Text
payloadData :: Maybe Text
$sel:payloadData:ManifestPayload' :: ManifestPayload -> Maybe Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
payloadData

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