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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(ManifestPayload -> ManifestPayload -> Bool)
-> (ManifestPayload -> ManifestPayload -> Bool)
-> Eq ManifestPayload
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]
(Int -> ReadS ManifestPayload)
-> ReadS [ManifestPayload]
-> ReadPrec ManifestPayload
-> ReadPrec [ManifestPayload]
-> Read 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
(Int -> ManifestPayload -> ShowS)
-> (ManifestPayload -> String)
-> ([ManifestPayload] -> ShowS)
-> Show ManifestPayload
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. ManifestPayload -> Rep ManifestPayload x)
-> (forall x. Rep ManifestPayload x -> ManifestPayload)
-> Generic ManifestPayload
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' :: Maybe Text -> ManifestPayload
ManifestPayload' {$sel:payloadData:ManifestPayload' :: Maybe Text
payloadData = Maybe Text
forall a. Maybe a
Prelude.Nothing}

-- | The application manifest.
manifestPayload_payloadData :: Lens.Lens' ManifestPayload (Prelude.Maybe Prelude.Text)
manifestPayload_payloadData :: (Maybe Text -> f (Maybe Text))
-> ManifestPayload -> f ManifestPayload
manifestPayload_payloadData = (ManifestPayload -> Maybe Text)
-> (ManifestPayload -> Maybe Text -> ManifestPayload)
-> Lens ManifestPayload ManifestPayload (Maybe Text) (Maybe Text)
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 Core.FromJSON ManifestPayload where
  parseJSON :: Value -> Parser ManifestPayload
parseJSON =
    String
-> (Object -> Parser ManifestPayload)
-> Value
-> Parser ManifestPayload
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ManifestPayload"
      ( \Object
x ->
          Maybe Text -> ManifestPayload
ManifestPayload'
            (Maybe Text -> ManifestPayload)
-> Parser (Maybe Text) -> Parser ManifestPayload
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"PayloadData")
      )

instance Prelude.Hashable ManifestPayload

instance Prelude.NFData ManifestPayload

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