{-# 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.ResilienceHub.Types.LogicalResourceId
-- 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.ResilienceHub.Types.LogicalResourceId 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

-- | Defines a logical resource identifier.
--
-- /See:/ 'newLogicalResourceId' smart constructor.
data LogicalResourceId = LogicalResourceId'
  { -- | The name of the CloudFormation stack this resource belongs to.
    LogicalResourceId -> Maybe Text
logicalStackName :: Prelude.Maybe Prelude.Text,
    -- | The name of the resource group that this resource belongs to.
    LogicalResourceId -> Maybe Text
resourceGroupName :: Prelude.Maybe Prelude.Text,
    -- | The name of the Terraform S3 state file this resource belongs to.
    LogicalResourceId -> Maybe Text
terraformSourceName :: Prelude.Maybe Prelude.Text,
    -- | The identifier of the resource.
    LogicalResourceId -> Text
identifier :: Prelude.Text
  }
  deriving (LogicalResourceId -> LogicalResourceId -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LogicalResourceId -> LogicalResourceId -> Bool
$c/= :: LogicalResourceId -> LogicalResourceId -> Bool
== :: LogicalResourceId -> LogicalResourceId -> Bool
$c== :: LogicalResourceId -> LogicalResourceId -> Bool
Prelude.Eq, ReadPrec [LogicalResourceId]
ReadPrec LogicalResourceId
Int -> ReadS LogicalResourceId
ReadS [LogicalResourceId]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LogicalResourceId]
$creadListPrec :: ReadPrec [LogicalResourceId]
readPrec :: ReadPrec LogicalResourceId
$creadPrec :: ReadPrec LogicalResourceId
readList :: ReadS [LogicalResourceId]
$creadList :: ReadS [LogicalResourceId]
readsPrec :: Int -> ReadS LogicalResourceId
$creadsPrec :: Int -> ReadS LogicalResourceId
Prelude.Read, Int -> LogicalResourceId -> ShowS
[LogicalResourceId] -> ShowS
LogicalResourceId -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LogicalResourceId] -> ShowS
$cshowList :: [LogicalResourceId] -> ShowS
show :: LogicalResourceId -> String
$cshow :: LogicalResourceId -> String
showsPrec :: Int -> LogicalResourceId -> ShowS
$cshowsPrec :: Int -> LogicalResourceId -> ShowS
Prelude.Show, forall x. Rep LogicalResourceId x -> LogicalResourceId
forall x. LogicalResourceId -> Rep LogicalResourceId x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LogicalResourceId x -> LogicalResourceId
$cfrom :: forall x. LogicalResourceId -> Rep LogicalResourceId x
Prelude.Generic)

-- |
-- Create a value of 'LogicalResourceId' 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:
--
-- 'logicalStackName', 'logicalResourceId_logicalStackName' - The name of the CloudFormation stack this resource belongs to.
--
-- 'resourceGroupName', 'logicalResourceId_resourceGroupName' - The name of the resource group that this resource belongs to.
--
-- 'terraformSourceName', 'logicalResourceId_terraformSourceName' - The name of the Terraform S3 state file this resource belongs to.
--
-- 'identifier', 'logicalResourceId_identifier' - The identifier of the resource.
newLogicalResourceId ::
  -- | 'identifier'
  Prelude.Text ->
  LogicalResourceId
newLogicalResourceId :: Text -> LogicalResourceId
newLogicalResourceId Text
pIdentifier_ =
  LogicalResourceId'
    { $sel:logicalStackName:LogicalResourceId' :: Maybe Text
logicalStackName =
        forall a. Maybe a
Prelude.Nothing,
      $sel:resourceGroupName:LogicalResourceId' :: Maybe Text
resourceGroupName = forall a. Maybe a
Prelude.Nothing,
      $sel:terraformSourceName:LogicalResourceId' :: Maybe Text
terraformSourceName = forall a. Maybe a
Prelude.Nothing,
      $sel:identifier:LogicalResourceId' :: Text
identifier = Text
pIdentifier_
    }

-- | The name of the CloudFormation stack this resource belongs to.
logicalResourceId_logicalStackName :: Lens.Lens' LogicalResourceId (Prelude.Maybe Prelude.Text)
logicalResourceId_logicalStackName :: Lens' LogicalResourceId (Maybe Text)
logicalResourceId_logicalStackName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LogicalResourceId' {Maybe Text
logicalStackName :: Maybe Text
$sel:logicalStackName:LogicalResourceId' :: LogicalResourceId -> Maybe Text
logicalStackName} -> Maybe Text
logicalStackName) (\s :: LogicalResourceId
s@LogicalResourceId' {} Maybe Text
a -> LogicalResourceId
s {$sel:logicalStackName:LogicalResourceId' :: Maybe Text
logicalStackName = Maybe Text
a} :: LogicalResourceId)

-- | The name of the resource group that this resource belongs to.
logicalResourceId_resourceGroupName :: Lens.Lens' LogicalResourceId (Prelude.Maybe Prelude.Text)
logicalResourceId_resourceGroupName :: Lens' LogicalResourceId (Maybe Text)
logicalResourceId_resourceGroupName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LogicalResourceId' {Maybe Text
resourceGroupName :: Maybe Text
$sel:resourceGroupName:LogicalResourceId' :: LogicalResourceId -> Maybe Text
resourceGroupName} -> Maybe Text
resourceGroupName) (\s :: LogicalResourceId
s@LogicalResourceId' {} Maybe Text
a -> LogicalResourceId
s {$sel:resourceGroupName:LogicalResourceId' :: Maybe Text
resourceGroupName = Maybe Text
a} :: LogicalResourceId)

-- | The name of the Terraform S3 state file this resource belongs to.
logicalResourceId_terraformSourceName :: Lens.Lens' LogicalResourceId (Prelude.Maybe Prelude.Text)
logicalResourceId_terraformSourceName :: Lens' LogicalResourceId (Maybe Text)
logicalResourceId_terraformSourceName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LogicalResourceId' {Maybe Text
terraformSourceName :: Maybe Text
$sel:terraformSourceName:LogicalResourceId' :: LogicalResourceId -> Maybe Text
terraformSourceName} -> Maybe Text
terraformSourceName) (\s :: LogicalResourceId
s@LogicalResourceId' {} Maybe Text
a -> LogicalResourceId
s {$sel:terraformSourceName:LogicalResourceId' :: Maybe Text
terraformSourceName = Maybe Text
a} :: LogicalResourceId)

-- | The identifier of the resource.
logicalResourceId_identifier :: Lens.Lens' LogicalResourceId Prelude.Text
logicalResourceId_identifier :: Lens' LogicalResourceId Text
logicalResourceId_identifier = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LogicalResourceId' {Text
identifier :: Text
$sel:identifier:LogicalResourceId' :: LogicalResourceId -> Text
identifier} -> Text
identifier) (\s :: LogicalResourceId
s@LogicalResourceId' {} Text
a -> LogicalResourceId
s {$sel:identifier:LogicalResourceId' :: Text
identifier = Text
a} :: LogicalResourceId)

instance Data.FromJSON LogicalResourceId where
  parseJSON :: Value -> Parser LogicalResourceId
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"LogicalResourceId"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> Maybe Text -> Text -> LogicalResourceId
LogicalResourceId'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"logicalStackName")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"resourceGroupName")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"terraformSourceName")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"identifier")
      )

instance Prelude.Hashable LogicalResourceId where
  hashWithSalt :: Int -> LogicalResourceId -> Int
hashWithSalt Int
_salt LogicalResourceId' {Maybe Text
Text
identifier :: Text
terraformSourceName :: Maybe Text
resourceGroupName :: Maybe Text
logicalStackName :: Maybe Text
$sel:identifier:LogicalResourceId' :: LogicalResourceId -> Text
$sel:terraformSourceName:LogicalResourceId' :: LogicalResourceId -> Maybe Text
$sel:resourceGroupName:LogicalResourceId' :: LogicalResourceId -> Maybe Text
$sel:logicalStackName:LogicalResourceId' :: LogicalResourceId -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
logicalStackName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
resourceGroupName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
terraformSourceName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
identifier

instance Prelude.NFData LogicalResourceId where
  rnf :: LogicalResourceId -> ()
rnf LogicalResourceId' {Maybe Text
Text
identifier :: Text
terraformSourceName :: Maybe Text
resourceGroupName :: Maybe Text
logicalStackName :: Maybe Text
$sel:identifier:LogicalResourceId' :: LogicalResourceId -> Text
$sel:terraformSourceName:LogicalResourceId' :: LogicalResourceId -> Maybe Text
$sel:resourceGroupName:LogicalResourceId' :: LogicalResourceId -> Maybe Text
$sel:logicalStackName:LogicalResourceId' :: LogicalResourceId -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
logicalStackName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
resourceGroupName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
terraformSourceName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
identifier