{-# 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.ResourceIdentifierSummary
-- 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.ResourceIdentifierSummary 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

-- | Describes the target resources of a specific type in your import
-- template (for example, all @AWS::S3::Bucket@ resources) and the
-- properties you can provide during the import to identify resources of
-- that type.
--
-- /See:/ 'newResourceIdentifierSummary' smart constructor.
data ResourceIdentifierSummary = ResourceIdentifierSummary'
  { -- | The logical IDs of the target resources of the specified @ResourceType@,
    -- as defined in the import template.
    ResourceIdentifierSummary -> Maybe (NonEmpty Text)
logicalResourceIds :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text),
    -- | The resource properties you can provide during the import to identify
    -- your target resources. For example, @BucketName@ is a possible
    -- identifier property for @AWS::S3::Bucket@ resources.
    ResourceIdentifierSummary -> Maybe [Text]
resourceIdentifiers :: Prelude.Maybe [Prelude.Text],
    -- | The template resource type of the target resources, such as
    -- @AWS::S3::Bucket@.
    ResourceIdentifierSummary -> Maybe Text
resourceType :: Prelude.Maybe Prelude.Text
  }
  deriving (ResourceIdentifierSummary -> ResourceIdentifierSummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ResourceIdentifierSummary -> ResourceIdentifierSummary -> Bool
$c/= :: ResourceIdentifierSummary -> ResourceIdentifierSummary -> Bool
== :: ResourceIdentifierSummary -> ResourceIdentifierSummary -> Bool
$c== :: ResourceIdentifierSummary -> ResourceIdentifierSummary -> Bool
Prelude.Eq, ReadPrec [ResourceIdentifierSummary]
ReadPrec ResourceIdentifierSummary
Int -> ReadS ResourceIdentifierSummary
ReadS [ResourceIdentifierSummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ResourceIdentifierSummary]
$creadListPrec :: ReadPrec [ResourceIdentifierSummary]
readPrec :: ReadPrec ResourceIdentifierSummary
$creadPrec :: ReadPrec ResourceIdentifierSummary
readList :: ReadS [ResourceIdentifierSummary]
$creadList :: ReadS [ResourceIdentifierSummary]
readsPrec :: Int -> ReadS ResourceIdentifierSummary
$creadsPrec :: Int -> ReadS ResourceIdentifierSummary
Prelude.Read, Int -> ResourceIdentifierSummary -> ShowS
[ResourceIdentifierSummary] -> ShowS
ResourceIdentifierSummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ResourceIdentifierSummary] -> ShowS
$cshowList :: [ResourceIdentifierSummary] -> ShowS
show :: ResourceIdentifierSummary -> String
$cshow :: ResourceIdentifierSummary -> String
showsPrec :: Int -> ResourceIdentifierSummary -> ShowS
$cshowsPrec :: Int -> ResourceIdentifierSummary -> ShowS
Prelude.Show, forall x.
Rep ResourceIdentifierSummary x -> ResourceIdentifierSummary
forall x.
ResourceIdentifierSummary -> Rep ResourceIdentifierSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ResourceIdentifierSummary x -> ResourceIdentifierSummary
$cfrom :: forall x.
ResourceIdentifierSummary -> Rep ResourceIdentifierSummary x
Prelude.Generic)

-- |
-- Create a value of 'ResourceIdentifierSummary' 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:
--
-- 'logicalResourceIds', 'resourceIdentifierSummary_logicalResourceIds' - The logical IDs of the target resources of the specified @ResourceType@,
-- as defined in the import template.
--
-- 'resourceIdentifiers', 'resourceIdentifierSummary_resourceIdentifiers' - The resource properties you can provide during the import to identify
-- your target resources. For example, @BucketName@ is a possible
-- identifier property for @AWS::S3::Bucket@ resources.
--
-- 'resourceType', 'resourceIdentifierSummary_resourceType' - The template resource type of the target resources, such as
-- @AWS::S3::Bucket@.
newResourceIdentifierSummary ::
  ResourceIdentifierSummary
newResourceIdentifierSummary :: ResourceIdentifierSummary
newResourceIdentifierSummary =
  ResourceIdentifierSummary'
    { $sel:logicalResourceIds:ResourceIdentifierSummary' :: Maybe (NonEmpty Text)
logicalResourceIds =
        forall a. Maybe a
Prelude.Nothing,
      $sel:resourceIdentifiers:ResourceIdentifierSummary' :: Maybe [Text]
resourceIdentifiers = forall a. Maybe a
Prelude.Nothing,
      $sel:resourceType:ResourceIdentifierSummary' :: Maybe Text
resourceType = forall a. Maybe a
Prelude.Nothing
    }

-- | The logical IDs of the target resources of the specified @ResourceType@,
-- as defined in the import template.
resourceIdentifierSummary_logicalResourceIds :: Lens.Lens' ResourceIdentifierSummary (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
resourceIdentifierSummary_logicalResourceIds :: Lens' ResourceIdentifierSummary (Maybe (NonEmpty Text))
resourceIdentifierSummary_logicalResourceIds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResourceIdentifierSummary' {Maybe (NonEmpty Text)
logicalResourceIds :: Maybe (NonEmpty Text)
$sel:logicalResourceIds:ResourceIdentifierSummary' :: ResourceIdentifierSummary -> Maybe (NonEmpty Text)
logicalResourceIds} -> Maybe (NonEmpty Text)
logicalResourceIds) (\s :: ResourceIdentifierSummary
s@ResourceIdentifierSummary' {} Maybe (NonEmpty Text)
a -> ResourceIdentifierSummary
s {$sel:logicalResourceIds:ResourceIdentifierSummary' :: Maybe (NonEmpty Text)
logicalResourceIds = Maybe (NonEmpty Text)
a} :: ResourceIdentifierSummary) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The resource properties you can provide during the import to identify
-- your target resources. For example, @BucketName@ is a possible
-- identifier property for @AWS::S3::Bucket@ resources.
resourceIdentifierSummary_resourceIdentifiers :: Lens.Lens' ResourceIdentifierSummary (Prelude.Maybe [Prelude.Text])
resourceIdentifierSummary_resourceIdentifiers :: Lens' ResourceIdentifierSummary (Maybe [Text])
resourceIdentifierSummary_resourceIdentifiers = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResourceIdentifierSummary' {Maybe [Text]
resourceIdentifiers :: Maybe [Text]
$sel:resourceIdentifiers:ResourceIdentifierSummary' :: ResourceIdentifierSummary -> Maybe [Text]
resourceIdentifiers} -> Maybe [Text]
resourceIdentifiers) (\s :: ResourceIdentifierSummary
s@ResourceIdentifierSummary' {} Maybe [Text]
a -> ResourceIdentifierSummary
s {$sel:resourceIdentifiers:ResourceIdentifierSummary' :: Maybe [Text]
resourceIdentifiers = Maybe [Text]
a} :: ResourceIdentifierSummary) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The template resource type of the target resources, such as
-- @AWS::S3::Bucket@.
resourceIdentifierSummary_resourceType :: Lens.Lens' ResourceIdentifierSummary (Prelude.Maybe Prelude.Text)
resourceIdentifierSummary_resourceType :: Lens' ResourceIdentifierSummary (Maybe Text)
resourceIdentifierSummary_resourceType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResourceIdentifierSummary' {Maybe Text
resourceType :: Maybe Text
$sel:resourceType:ResourceIdentifierSummary' :: ResourceIdentifierSummary -> Maybe Text
resourceType} -> Maybe Text
resourceType) (\s :: ResourceIdentifierSummary
s@ResourceIdentifierSummary' {} Maybe Text
a -> ResourceIdentifierSummary
s {$sel:resourceType:ResourceIdentifierSummary' :: Maybe Text
resourceType = Maybe Text
a} :: ResourceIdentifierSummary)

instance Data.FromXML ResourceIdentifierSummary where
  parseXML :: [Node] -> Either String ResourceIdentifierSummary
parseXML [Node]
x =
    Maybe (NonEmpty Text)
-> Maybe [Text] -> Maybe Text -> ResourceIdentifierSummary
ResourceIdentifierSummary'
      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
"LogicalResourceIds"
                      forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
                      forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (forall a. FromXML a => Text -> [Node] -> Either String (NonEmpty a)
Data.parseXMLList1 Text
"member")
                  )
      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
"ResourceIdentifiers"
                      forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
                      forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (forall a. FromXML a => Text -> [Node] -> Either String [a]
Data.parseXMLList Text
"member")
                  )
      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
"ResourceType")

instance Prelude.Hashable ResourceIdentifierSummary where
  hashWithSalt :: Int -> ResourceIdentifierSummary -> Int
hashWithSalt Int
_salt ResourceIdentifierSummary' {Maybe [Text]
Maybe (NonEmpty Text)
Maybe Text
resourceType :: Maybe Text
resourceIdentifiers :: Maybe [Text]
logicalResourceIds :: Maybe (NonEmpty Text)
$sel:resourceType:ResourceIdentifierSummary' :: ResourceIdentifierSummary -> Maybe Text
$sel:resourceIdentifiers:ResourceIdentifierSummary' :: ResourceIdentifierSummary -> Maybe [Text]
$sel:logicalResourceIds:ResourceIdentifierSummary' :: ResourceIdentifierSummary -> Maybe (NonEmpty Text)
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty Text)
logicalResourceIds
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
resourceIdentifiers
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
resourceType

instance Prelude.NFData ResourceIdentifierSummary where
  rnf :: ResourceIdentifierSummary -> ()
rnf ResourceIdentifierSummary' {Maybe [Text]
Maybe (NonEmpty Text)
Maybe Text
resourceType :: Maybe Text
resourceIdentifiers :: Maybe [Text]
logicalResourceIds :: Maybe (NonEmpty Text)
$sel:resourceType:ResourceIdentifierSummary' :: ResourceIdentifierSummary -> Maybe Text
$sel:resourceIdentifiers:ResourceIdentifierSummary' :: ResourceIdentifierSummary -> Maybe [Text]
$sel:logicalResourceIds:ResourceIdentifierSummary' :: ResourceIdentifierSummary -> Maybe (NonEmpty Text)
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty Text)
logicalResourceIds
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
resourceIdentifiers
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
resourceType