{-# 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.M2.Types.Definition
-- 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.M2.Types.Definition 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

-- | The application definition for a particular application.
--
-- /See:/ 'newDefinition' smart constructor.
data Definition = Definition'
  { -- | The content of the application definition. This is a JSON object that
    -- contains the resource configuration\/definitions that identify an
    -- application.
    Definition -> Maybe Text
content :: Prelude.Maybe Prelude.Text,
    -- | The S3 bucket that contains the application definition.
    Definition -> Maybe Text
s3Location :: Prelude.Maybe Prelude.Text
  }
  deriving (Definition -> Definition -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Definition -> Definition -> Bool
$c/= :: Definition -> Definition -> Bool
== :: Definition -> Definition -> Bool
$c== :: Definition -> Definition -> Bool
Prelude.Eq, ReadPrec [Definition]
ReadPrec Definition
Int -> ReadS Definition
ReadS [Definition]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Definition]
$creadListPrec :: ReadPrec [Definition]
readPrec :: ReadPrec Definition
$creadPrec :: ReadPrec Definition
readList :: ReadS [Definition]
$creadList :: ReadS [Definition]
readsPrec :: Int -> ReadS Definition
$creadsPrec :: Int -> ReadS Definition
Prelude.Read, Int -> Definition -> ShowS
[Definition] -> ShowS
Definition -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Definition] -> ShowS
$cshowList :: [Definition] -> ShowS
show :: Definition -> String
$cshow :: Definition -> String
showsPrec :: Int -> Definition -> ShowS
$cshowsPrec :: Int -> Definition -> ShowS
Prelude.Show, forall x. Rep Definition x -> Definition
forall x. Definition -> Rep Definition x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Definition x -> Definition
$cfrom :: forall x. Definition -> Rep Definition x
Prelude.Generic)

-- |
-- Create a value of 'Definition' 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:
--
-- 'content', 'definition_content' - The content of the application definition. This is a JSON object that
-- contains the resource configuration\/definitions that identify an
-- application.
--
-- 's3Location', 'definition_s3Location' - The S3 bucket that contains the application definition.
newDefinition ::
  Definition
newDefinition :: Definition
newDefinition =
  Definition'
    { $sel:content:Definition' :: Maybe Text
content = forall a. Maybe a
Prelude.Nothing,
      $sel:s3Location:Definition' :: Maybe Text
s3Location = forall a. Maybe a
Prelude.Nothing
    }

-- | The content of the application definition. This is a JSON object that
-- contains the resource configuration\/definitions that identify an
-- application.
definition_content :: Lens.Lens' Definition (Prelude.Maybe Prelude.Text)
definition_content :: Lens' Definition (Maybe Text)
definition_content = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Definition' {Maybe Text
content :: Maybe Text
$sel:content:Definition' :: Definition -> Maybe Text
content} -> Maybe Text
content) (\s :: Definition
s@Definition' {} Maybe Text
a -> Definition
s {$sel:content:Definition' :: Maybe Text
content = Maybe Text
a} :: Definition)

-- | The S3 bucket that contains the application definition.
definition_s3Location :: Lens.Lens' Definition (Prelude.Maybe Prelude.Text)
definition_s3Location :: Lens' Definition (Maybe Text)
definition_s3Location = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Definition' {Maybe Text
s3Location :: Maybe Text
$sel:s3Location:Definition' :: Definition -> Maybe Text
s3Location} -> Maybe Text
s3Location) (\s :: Definition
s@Definition' {} Maybe Text
a -> Definition
s {$sel:s3Location:Definition' :: Maybe Text
s3Location = Maybe Text
a} :: Definition)

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

instance Prelude.NFData Definition where
  rnf :: Definition -> ()
rnf Definition' {Maybe Text
s3Location :: Maybe Text
content :: Maybe Text
$sel:s3Location:Definition' :: Definition -> Maybe Text
$sel:content:Definition' :: Definition -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
content
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
s3Location

instance Data.ToJSON Definition where
  toJSON :: Definition -> Value
toJSON Definition' {Maybe Text
s3Location :: Maybe Text
content :: Maybe Text
$sel:s3Location:Definition' :: Definition -> Maybe Text
$sel:content:Definition' :: Definition -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"content" 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
content,
            (Key
"s3Location" 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
s3Location
          ]
      )