{-# 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.CloudFormation.Types.ModuleInfo
-- 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.CloudFormation.Types.ModuleInfo 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

-- | Contains information about the module from which the resource was
-- created, if the resource was created from a module included in the stack
-- template.
--
-- For more information about modules, see
-- <AWSCloudFormation/latest/UserGuide/modules.html Using modules to encapsulate and reuse resource configurations>
-- in the /CloudFormation User Guide/.
--
-- /See:/ 'newModuleInfo' smart constructor.
data ModuleInfo = ModuleInfo'
  { -- | A concatenated list of the logical IDs of the module or modules
    -- containing the resource. Modules are listed starting with the inner-most
    -- nested module, and separated by @\/@.
    --
    -- In the following example, the resource was created from a module,
    -- @moduleA@, that\'s nested inside a parent module, @moduleB@.
    --
    -- @moduleA\/moduleB@
    --
    -- For more information, see
    -- <AWSCloudFormation/latest/UserGuide/modules.html#module-ref-resources Referencing resources in a module>
    -- in the /CloudFormation User Guide/.
    ModuleInfo -> Maybe Text
logicalIdHierarchy :: Prelude.Maybe Prelude.Text,
    -- | A concatenated list of the module type or types containing the resource.
    -- Module types are listed starting with the inner-most nested module, and
    -- separated by @\/@.
    --
    -- In the following example, the resource was created from a module of type
    -- @AWS::First::Example::MODULE@, that\'s nested inside a parent module of
    -- type @AWS::Second::Example::MODULE@.
    --
    -- @AWS::First::Example::MODULE\/AWS::Second::Example::MODULE@
    ModuleInfo -> Maybe Text
typeHierarchy :: Prelude.Maybe Prelude.Text
  }
  deriving (ModuleInfo -> ModuleInfo -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ModuleInfo -> ModuleInfo -> Bool
$c/= :: ModuleInfo -> ModuleInfo -> Bool
== :: ModuleInfo -> ModuleInfo -> Bool
$c== :: ModuleInfo -> ModuleInfo -> Bool
Prelude.Eq, ReadPrec [ModuleInfo]
ReadPrec ModuleInfo
Int -> ReadS ModuleInfo
ReadS [ModuleInfo]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ModuleInfo]
$creadListPrec :: ReadPrec [ModuleInfo]
readPrec :: ReadPrec ModuleInfo
$creadPrec :: ReadPrec ModuleInfo
readList :: ReadS [ModuleInfo]
$creadList :: ReadS [ModuleInfo]
readsPrec :: Int -> ReadS ModuleInfo
$creadsPrec :: Int -> ReadS ModuleInfo
Prelude.Read, Int -> ModuleInfo -> ShowS
[ModuleInfo] -> ShowS
ModuleInfo -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ModuleInfo] -> ShowS
$cshowList :: [ModuleInfo] -> ShowS
show :: ModuleInfo -> String
$cshow :: ModuleInfo -> String
showsPrec :: Int -> ModuleInfo -> ShowS
$cshowsPrec :: Int -> ModuleInfo -> ShowS
Prelude.Show, forall x. Rep ModuleInfo x -> ModuleInfo
forall x. ModuleInfo -> Rep ModuleInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ModuleInfo x -> ModuleInfo
$cfrom :: forall x. ModuleInfo -> Rep ModuleInfo x
Prelude.Generic)

-- |
-- Create a value of 'ModuleInfo' 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:
--
-- 'logicalIdHierarchy', 'moduleInfo_logicalIdHierarchy' - A concatenated list of the logical IDs of the module or modules
-- containing the resource. Modules are listed starting with the inner-most
-- nested module, and separated by @\/@.
--
-- In the following example, the resource was created from a module,
-- @moduleA@, that\'s nested inside a parent module, @moduleB@.
--
-- @moduleA\/moduleB@
--
-- For more information, see
-- <AWSCloudFormation/latest/UserGuide/modules.html#module-ref-resources Referencing resources in a module>
-- in the /CloudFormation User Guide/.
--
-- 'typeHierarchy', 'moduleInfo_typeHierarchy' - A concatenated list of the module type or types containing the resource.
-- Module types are listed starting with the inner-most nested module, and
-- separated by @\/@.
--
-- In the following example, the resource was created from a module of type
-- @AWS::First::Example::MODULE@, that\'s nested inside a parent module of
-- type @AWS::Second::Example::MODULE@.
--
-- @AWS::First::Example::MODULE\/AWS::Second::Example::MODULE@
newModuleInfo ::
  ModuleInfo
newModuleInfo :: ModuleInfo
newModuleInfo =
  ModuleInfo'
    { $sel:logicalIdHierarchy:ModuleInfo' :: Maybe Text
logicalIdHierarchy = forall a. Maybe a
Prelude.Nothing,
      $sel:typeHierarchy:ModuleInfo' :: Maybe Text
typeHierarchy = forall a. Maybe a
Prelude.Nothing
    }

-- | A concatenated list of the logical IDs of the module or modules
-- containing the resource. Modules are listed starting with the inner-most
-- nested module, and separated by @\/@.
--
-- In the following example, the resource was created from a module,
-- @moduleA@, that\'s nested inside a parent module, @moduleB@.
--
-- @moduleA\/moduleB@
--
-- For more information, see
-- <AWSCloudFormation/latest/UserGuide/modules.html#module-ref-resources Referencing resources in a module>
-- in the /CloudFormation User Guide/.
moduleInfo_logicalIdHierarchy :: Lens.Lens' ModuleInfo (Prelude.Maybe Prelude.Text)
moduleInfo_logicalIdHierarchy :: Lens' ModuleInfo (Maybe Text)
moduleInfo_logicalIdHierarchy = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModuleInfo' {Maybe Text
logicalIdHierarchy :: Maybe Text
$sel:logicalIdHierarchy:ModuleInfo' :: ModuleInfo -> Maybe Text
logicalIdHierarchy} -> Maybe Text
logicalIdHierarchy) (\s :: ModuleInfo
s@ModuleInfo' {} Maybe Text
a -> ModuleInfo
s {$sel:logicalIdHierarchy:ModuleInfo' :: Maybe Text
logicalIdHierarchy = Maybe Text
a} :: ModuleInfo)

-- | A concatenated list of the module type or types containing the resource.
-- Module types are listed starting with the inner-most nested module, and
-- separated by @\/@.
--
-- In the following example, the resource was created from a module of type
-- @AWS::First::Example::MODULE@, that\'s nested inside a parent module of
-- type @AWS::Second::Example::MODULE@.
--
-- @AWS::First::Example::MODULE\/AWS::Second::Example::MODULE@
moduleInfo_typeHierarchy :: Lens.Lens' ModuleInfo (Prelude.Maybe Prelude.Text)
moduleInfo_typeHierarchy :: Lens' ModuleInfo (Maybe Text)
moduleInfo_typeHierarchy = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModuleInfo' {Maybe Text
typeHierarchy :: Maybe Text
$sel:typeHierarchy:ModuleInfo' :: ModuleInfo -> Maybe Text
typeHierarchy} -> Maybe Text
typeHierarchy) (\s :: ModuleInfo
s@ModuleInfo' {} Maybe Text
a -> ModuleInfo
s {$sel:typeHierarchy:ModuleInfo' :: Maybe Text
typeHierarchy = Maybe Text
a} :: ModuleInfo)

instance Data.FromXML ModuleInfo where
  parseXML :: [Node] -> Either String ModuleInfo
parseXML [Node]
x =
    Maybe Text -> Maybe Text -> ModuleInfo
ModuleInfo'
      forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"LogicalIdHierarchy")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"TypeHierarchy")

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

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