{-# 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 #-}
module Amazonka.CodeDeploy.Types.AppSpecContent where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data AppSpecContent = AppSpecContent'
{
AppSpecContent -> Maybe Text
content :: Prelude.Maybe Prelude.Text,
AppSpecContent -> Maybe Text
sha256 :: Prelude.Maybe Prelude.Text
}
deriving (AppSpecContent -> AppSpecContent -> Bool
(AppSpecContent -> AppSpecContent -> Bool)
-> (AppSpecContent -> AppSpecContent -> Bool) -> Eq AppSpecContent
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AppSpecContent -> AppSpecContent -> Bool
$c/= :: AppSpecContent -> AppSpecContent -> Bool
== :: AppSpecContent -> AppSpecContent -> Bool
$c== :: AppSpecContent -> AppSpecContent -> Bool
Prelude.Eq, ReadPrec [AppSpecContent]
ReadPrec AppSpecContent
Int -> ReadS AppSpecContent
ReadS [AppSpecContent]
(Int -> ReadS AppSpecContent)
-> ReadS [AppSpecContent]
-> ReadPrec AppSpecContent
-> ReadPrec [AppSpecContent]
-> Read AppSpecContent
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AppSpecContent]
$creadListPrec :: ReadPrec [AppSpecContent]
readPrec :: ReadPrec AppSpecContent
$creadPrec :: ReadPrec AppSpecContent
readList :: ReadS [AppSpecContent]
$creadList :: ReadS [AppSpecContent]
readsPrec :: Int -> ReadS AppSpecContent
$creadsPrec :: Int -> ReadS AppSpecContent
Prelude.Read, Int -> AppSpecContent -> ShowS
[AppSpecContent] -> ShowS
AppSpecContent -> String
(Int -> AppSpecContent -> ShowS)
-> (AppSpecContent -> String)
-> ([AppSpecContent] -> ShowS)
-> Show AppSpecContent
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AppSpecContent] -> ShowS
$cshowList :: [AppSpecContent] -> ShowS
show :: AppSpecContent -> String
$cshow :: AppSpecContent -> String
showsPrec :: Int -> AppSpecContent -> ShowS
$cshowsPrec :: Int -> AppSpecContent -> ShowS
Prelude.Show, (forall x. AppSpecContent -> Rep AppSpecContent x)
-> (forall x. Rep AppSpecContent x -> AppSpecContent)
-> Generic AppSpecContent
forall x. Rep AppSpecContent x -> AppSpecContent
forall x. AppSpecContent -> Rep AppSpecContent x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AppSpecContent x -> AppSpecContent
$cfrom :: forall x. AppSpecContent -> Rep AppSpecContent x
Prelude.Generic)
newAppSpecContent ::
AppSpecContent
newAppSpecContent :: AppSpecContent
newAppSpecContent =
AppSpecContent' :: Maybe Text -> Maybe Text -> AppSpecContent
AppSpecContent'
{ $sel:content:AppSpecContent' :: Maybe Text
content = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:sha256:AppSpecContent' :: Maybe Text
sha256 = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
appSpecContent_content :: Lens.Lens' AppSpecContent (Prelude.Maybe Prelude.Text)
appSpecContent_content :: (Maybe Text -> f (Maybe Text))
-> AppSpecContent -> f AppSpecContent
appSpecContent_content = (AppSpecContent -> Maybe Text)
-> (AppSpecContent -> Maybe Text -> AppSpecContent)
-> Lens AppSpecContent AppSpecContent (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AppSpecContent' {Maybe Text
content :: Maybe Text
$sel:content:AppSpecContent' :: AppSpecContent -> Maybe Text
content} -> Maybe Text
content) (\s :: AppSpecContent
s@AppSpecContent' {} Maybe Text
a -> AppSpecContent
s {$sel:content:AppSpecContent' :: Maybe Text
content = Maybe Text
a} :: AppSpecContent)
appSpecContent_sha256 :: Lens.Lens' AppSpecContent (Prelude.Maybe Prelude.Text)
appSpecContent_sha256 :: (Maybe Text -> f (Maybe Text))
-> AppSpecContent -> f AppSpecContent
appSpecContent_sha256 = (AppSpecContent -> Maybe Text)
-> (AppSpecContent -> Maybe Text -> AppSpecContent)
-> Lens AppSpecContent AppSpecContent (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AppSpecContent' {Maybe Text
sha256 :: Maybe Text
$sel:sha256:AppSpecContent' :: AppSpecContent -> Maybe Text
sha256} -> Maybe Text
sha256) (\s :: AppSpecContent
s@AppSpecContent' {} Maybe Text
a -> AppSpecContent
s {$sel:sha256:AppSpecContent' :: Maybe Text
sha256 = Maybe Text
a} :: AppSpecContent)
instance Core.FromJSON AppSpecContent where
parseJSON :: Value -> Parser AppSpecContent
parseJSON =
String
-> (Object -> Parser AppSpecContent)
-> Value
-> Parser AppSpecContent
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"AppSpecContent"
( \Object
x ->
Maybe Text -> Maybe Text -> AppSpecContent
AppSpecContent'
(Maybe Text -> Maybe Text -> AppSpecContent)
-> Parser (Maybe Text) -> Parser (Maybe Text -> AppSpecContent)
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
"content")
Parser (Maybe Text -> AppSpecContent)
-> Parser (Maybe Text) -> Parser AppSpecContent
forall (f :: * -> *) a b. Applicative f => 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
"sha256")
)
instance Prelude.Hashable AppSpecContent
instance Prelude.NFData AppSpecContent
instance Core.ToJSON AppSpecContent where
toJSON :: AppSpecContent -> Value
toJSON AppSpecContent' {Maybe Text
sha256 :: Maybe Text
content :: Maybe Text
$sel:sha256:AppSpecContent' :: AppSpecContent -> Maybe Text
$sel:content:AppSpecContent' :: AppSpecContent -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"content" 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
content,
(Text
"sha256" 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
sha256
]
)