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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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 on 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 concantenated list of the 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 is 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,
    -- | A concantenated 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 is 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
  }
  deriving (ModuleInfo -> ModuleInfo -> Bool
(ModuleInfo -> ModuleInfo -> Bool)
-> (ModuleInfo -> ModuleInfo -> Bool) -> Eq ModuleInfo
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]
(Int -> ReadS ModuleInfo)
-> ReadS [ModuleInfo]
-> ReadPrec ModuleInfo
-> ReadPrec [ModuleInfo]
-> Read 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
(Int -> ModuleInfo -> ShowS)
-> (ModuleInfo -> String)
-> ([ModuleInfo] -> ShowS)
-> Show ModuleInfo
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. ModuleInfo -> Rep ModuleInfo x)
-> (forall x. Rep ModuleInfo x -> ModuleInfo) -> Generic ModuleInfo
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:
--
-- 'typeHierarchy', 'moduleInfo_typeHierarchy' - A concantenated list of the 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 is nested inside a parent module of
-- type @AWS::Second::Example::MODULE@.
--
-- @AWS::First::Example::MODULE\/AWS::Second::Example::MODULE@
--
-- 'logicalIdHierarchy', 'moduleInfo_logicalIdHierarchy' - A concantenated 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 is 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/.
newModuleInfo ::
  ModuleInfo
newModuleInfo :: ModuleInfo
newModuleInfo =
  ModuleInfo' :: Maybe Text -> Maybe Text -> ModuleInfo
ModuleInfo'
    { $sel:typeHierarchy:ModuleInfo' :: Maybe Text
typeHierarchy = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:logicalIdHierarchy:ModuleInfo' :: Maybe Text
logicalIdHierarchy = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | A concantenated list of the 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 is 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 :: (Maybe Text -> f (Maybe Text)) -> ModuleInfo -> f ModuleInfo
moduleInfo_typeHierarchy = (ModuleInfo -> Maybe Text)
-> (ModuleInfo -> Maybe Text -> ModuleInfo)
-> Lens ModuleInfo ModuleInfo (Maybe Text) (Maybe Text)
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)

-- | A concantenated 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 is 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 :: (Maybe Text -> f (Maybe Text)) -> ModuleInfo -> f ModuleInfo
moduleInfo_logicalIdHierarchy = (ModuleInfo -> Maybe Text)
-> (ModuleInfo -> Maybe Text -> ModuleInfo)
-> Lens ModuleInfo ModuleInfo (Maybe Text) (Maybe Text)
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)

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

instance Prelude.Hashable ModuleInfo

instance Prelude.NFData ModuleInfo