{-# 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.DevOpsGuru.Types.CloudFormationCollection
-- 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.DevOpsGuru.Types.CloudFormationCollection where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Information about AWS CloudFormation stacks. You can use up to 500
-- stacks to specify which AWS resources in your account to analyze. For
-- more information, see
-- <https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/stacks.html Stacks>
-- in the /AWS CloudFormation User Guide/.
--
-- /See:/ 'newCloudFormationCollection' smart constructor.
data CloudFormationCollection = CloudFormationCollection'
  { -- | An array of CloudFormation stack names.
    CloudFormationCollection -> Maybe [Text]
stackNames :: Prelude.Maybe [Prelude.Text]
  }
  deriving (CloudFormationCollection -> CloudFormationCollection -> Bool
(CloudFormationCollection -> CloudFormationCollection -> Bool)
-> (CloudFormationCollection -> CloudFormationCollection -> Bool)
-> Eq CloudFormationCollection
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CloudFormationCollection -> CloudFormationCollection -> Bool
$c/= :: CloudFormationCollection -> CloudFormationCollection -> Bool
== :: CloudFormationCollection -> CloudFormationCollection -> Bool
$c== :: CloudFormationCollection -> CloudFormationCollection -> Bool
Prelude.Eq, ReadPrec [CloudFormationCollection]
ReadPrec CloudFormationCollection
Int -> ReadS CloudFormationCollection
ReadS [CloudFormationCollection]
(Int -> ReadS CloudFormationCollection)
-> ReadS [CloudFormationCollection]
-> ReadPrec CloudFormationCollection
-> ReadPrec [CloudFormationCollection]
-> Read CloudFormationCollection
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CloudFormationCollection]
$creadListPrec :: ReadPrec [CloudFormationCollection]
readPrec :: ReadPrec CloudFormationCollection
$creadPrec :: ReadPrec CloudFormationCollection
readList :: ReadS [CloudFormationCollection]
$creadList :: ReadS [CloudFormationCollection]
readsPrec :: Int -> ReadS CloudFormationCollection
$creadsPrec :: Int -> ReadS CloudFormationCollection
Prelude.Read, Int -> CloudFormationCollection -> ShowS
[CloudFormationCollection] -> ShowS
CloudFormationCollection -> String
(Int -> CloudFormationCollection -> ShowS)
-> (CloudFormationCollection -> String)
-> ([CloudFormationCollection] -> ShowS)
-> Show CloudFormationCollection
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CloudFormationCollection] -> ShowS
$cshowList :: [CloudFormationCollection] -> ShowS
show :: CloudFormationCollection -> String
$cshow :: CloudFormationCollection -> String
showsPrec :: Int -> CloudFormationCollection -> ShowS
$cshowsPrec :: Int -> CloudFormationCollection -> ShowS
Prelude.Show, (forall x.
 CloudFormationCollection -> Rep CloudFormationCollection x)
-> (forall x.
    Rep CloudFormationCollection x -> CloudFormationCollection)
-> Generic CloudFormationCollection
forall x.
Rep CloudFormationCollection x -> CloudFormationCollection
forall x.
CloudFormationCollection -> Rep CloudFormationCollection x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CloudFormationCollection x -> CloudFormationCollection
$cfrom :: forall x.
CloudFormationCollection -> Rep CloudFormationCollection x
Prelude.Generic)

-- |
-- Create a value of 'CloudFormationCollection' 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:
--
-- 'stackNames', 'cloudFormationCollection_stackNames' - An array of CloudFormation stack names.
newCloudFormationCollection ::
  CloudFormationCollection
newCloudFormationCollection :: CloudFormationCollection
newCloudFormationCollection =
  CloudFormationCollection' :: Maybe [Text] -> CloudFormationCollection
CloudFormationCollection'
    { $sel:stackNames:CloudFormationCollection' :: Maybe [Text]
stackNames =
        Maybe [Text]
forall a. Maybe a
Prelude.Nothing
    }

-- | An array of CloudFormation stack names.
cloudFormationCollection_stackNames :: Lens.Lens' CloudFormationCollection (Prelude.Maybe [Prelude.Text])
cloudFormationCollection_stackNames :: (Maybe [Text] -> f (Maybe [Text]))
-> CloudFormationCollection -> f CloudFormationCollection
cloudFormationCollection_stackNames = (CloudFormationCollection -> Maybe [Text])
-> (CloudFormationCollection
    -> Maybe [Text] -> CloudFormationCollection)
-> Lens
     CloudFormationCollection
     CloudFormationCollection
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloudFormationCollection' {Maybe [Text]
stackNames :: Maybe [Text]
$sel:stackNames:CloudFormationCollection' :: CloudFormationCollection -> Maybe [Text]
stackNames} -> Maybe [Text]
stackNames) (\s :: CloudFormationCollection
s@CloudFormationCollection' {} Maybe [Text]
a -> CloudFormationCollection
s {$sel:stackNames:CloudFormationCollection' :: Maybe [Text]
stackNames = Maybe [Text]
a} :: CloudFormationCollection) ((Maybe [Text] -> f (Maybe [Text]))
 -> CloudFormationCollection -> f CloudFormationCollection)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> CloudFormationCollection
-> f CloudFormationCollection
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 AnIso [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON CloudFormationCollection where
  parseJSON :: Value -> Parser CloudFormationCollection
parseJSON =
    String
-> (Object -> Parser CloudFormationCollection)
-> Value
-> Parser CloudFormationCollection
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"CloudFormationCollection"
      ( \Object
x ->
          Maybe [Text] -> CloudFormationCollection
CloudFormationCollection'
            (Maybe [Text] -> CloudFormationCollection)
-> Parser (Maybe [Text]) -> Parser CloudFormationCollection
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"StackNames" Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable CloudFormationCollection

instance Prelude.NFData CloudFormationCollection

instance Core.ToJSON CloudFormationCollection where
  toJSON :: CloudFormationCollection -> Value
toJSON CloudFormationCollection' {Maybe [Text]
stackNames :: Maybe [Text]
$sel:stackNames:CloudFormationCollection' :: CloudFormationCollection -> Maybe [Text]
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Text
"StackNames" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Text] -> Pair) -> Maybe [Text] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
stackNames]
      )