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

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.DevOpsGuru.Types.CloudFormationCollectionFilter
import Amazonka.DevOpsGuru.Types.TagCollectionFilter
import qualified Amazonka.Prelude as Prelude

-- | Information about a filter used to specify which Amazon Web Services
-- resources are analyzed for anomalous behavior by DevOps Guru.
--
-- /See:/ 'newResourceCollectionFilter' smart constructor.
data ResourceCollectionFilter = ResourceCollectionFilter'
  { -- | Information about Amazon Web Services CloudFormation stacks. You can use
    -- up to 500 stacks to specify which Amazon Web Services resources in your
    -- account to analyze. For more information, see
    -- <https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/stacks.html Stacks>
    -- in the /Amazon Web Services CloudFormation User Guide/.
    ResourceCollectionFilter -> Maybe CloudFormationCollectionFilter
cloudFormation :: Prelude.Maybe CloudFormationCollectionFilter,
    -- | The Amazon Web Services tags used to filter the resources in the
    -- resource collection.
    --
    -- Tags help you identify and organize your Amazon Web Services resources.
    -- Many Amazon Web Services services support tagging, so you can assign the
    -- same tag to resources from different services to indicate that the
    -- resources are related. For example, you can assign the same tag to an
    -- Amazon DynamoDB table resource that you assign to an Lambda function.
    -- For more information about using tags, see the
    -- <https://d1.awsstatic.com/whitepapers/aws-tagging-best-practices.pdf Tagging best practices>
    -- whitepaper.
    --
    -- Each Amazon Web Services tag has two parts.
    --
    -- -   A tag /key/ (for example, @CostCenter@, @Environment@, @Project@, or
    --     @Secret@). Tag /keys/ are case-sensitive.
    --
    -- -   An optional field known as a tag /value/ (for example,
    --     @111122223333@, @Production@, or a team name). Omitting the tag
    --     /value/ is the same as using an empty string. Like tag /keys/, tag
    --     /values/ are case-sensitive.
    --
    -- Together these are known as /key/-/value/ pairs.
    --
    -- The string used for a /key/ in a tag that you use to define your
    -- resource coverage must begin with the prefix @Devops-guru-@. The tag
    -- /key/ might be @DevOps-Guru-deployment-application@ or
    -- @devops-guru-rds-application@. When you create a /key/, the case of
    -- characters in the /key/ can be whatever you choose. After you create a
    -- /key/, it is case-sensitive. For example, DevOps Guru works with a /key/
    -- named @devops-guru-rds@ and a /key/ named @DevOps-Guru-RDS@, and these
    -- act as two different /keys/. Possible /key/\//value/ pairs in your
    -- application might be @Devops-Guru-production-application\/RDS@ or
    -- @Devops-Guru-production-application\/containers@.
    ResourceCollectionFilter -> Maybe [TagCollectionFilter]
tags :: Prelude.Maybe [TagCollectionFilter]
  }
  deriving (ResourceCollectionFilter -> ResourceCollectionFilter -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ResourceCollectionFilter -> ResourceCollectionFilter -> Bool
$c/= :: ResourceCollectionFilter -> ResourceCollectionFilter -> Bool
== :: ResourceCollectionFilter -> ResourceCollectionFilter -> Bool
$c== :: ResourceCollectionFilter -> ResourceCollectionFilter -> Bool
Prelude.Eq, ReadPrec [ResourceCollectionFilter]
ReadPrec ResourceCollectionFilter
Int -> ReadS ResourceCollectionFilter
ReadS [ResourceCollectionFilter]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ResourceCollectionFilter]
$creadListPrec :: ReadPrec [ResourceCollectionFilter]
readPrec :: ReadPrec ResourceCollectionFilter
$creadPrec :: ReadPrec ResourceCollectionFilter
readList :: ReadS [ResourceCollectionFilter]
$creadList :: ReadS [ResourceCollectionFilter]
readsPrec :: Int -> ReadS ResourceCollectionFilter
$creadsPrec :: Int -> ReadS ResourceCollectionFilter
Prelude.Read, Int -> ResourceCollectionFilter -> ShowS
[ResourceCollectionFilter] -> ShowS
ResourceCollectionFilter -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ResourceCollectionFilter] -> ShowS
$cshowList :: [ResourceCollectionFilter] -> ShowS
show :: ResourceCollectionFilter -> String
$cshow :: ResourceCollectionFilter -> String
showsPrec :: Int -> ResourceCollectionFilter -> ShowS
$cshowsPrec :: Int -> ResourceCollectionFilter -> ShowS
Prelude.Show, forall x.
Rep ResourceCollectionFilter x -> ResourceCollectionFilter
forall x.
ResourceCollectionFilter -> Rep ResourceCollectionFilter x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ResourceCollectionFilter x -> ResourceCollectionFilter
$cfrom :: forall x.
ResourceCollectionFilter -> Rep ResourceCollectionFilter x
Prelude.Generic)

-- |
-- Create a value of 'ResourceCollectionFilter' 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:
--
-- 'cloudFormation', 'resourceCollectionFilter_cloudFormation' - Information about Amazon Web Services CloudFormation stacks. You can use
-- up to 500 stacks to specify which Amazon Web Services resources in your
-- account to analyze. For more information, see
-- <https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/stacks.html Stacks>
-- in the /Amazon Web Services CloudFormation User Guide/.
--
-- 'tags', 'resourceCollectionFilter_tags' - The Amazon Web Services tags used to filter the resources in the
-- resource collection.
--
-- Tags help you identify and organize your Amazon Web Services resources.
-- Many Amazon Web Services services support tagging, so you can assign the
-- same tag to resources from different services to indicate that the
-- resources are related. For example, you can assign the same tag to an
-- Amazon DynamoDB table resource that you assign to an Lambda function.
-- For more information about using tags, see the
-- <https://d1.awsstatic.com/whitepapers/aws-tagging-best-practices.pdf Tagging best practices>
-- whitepaper.
--
-- Each Amazon Web Services tag has two parts.
--
-- -   A tag /key/ (for example, @CostCenter@, @Environment@, @Project@, or
--     @Secret@). Tag /keys/ are case-sensitive.
--
-- -   An optional field known as a tag /value/ (for example,
--     @111122223333@, @Production@, or a team name). Omitting the tag
--     /value/ is the same as using an empty string. Like tag /keys/, tag
--     /values/ are case-sensitive.
--
-- Together these are known as /key/-/value/ pairs.
--
-- The string used for a /key/ in a tag that you use to define your
-- resource coverage must begin with the prefix @Devops-guru-@. The tag
-- /key/ might be @DevOps-Guru-deployment-application@ or
-- @devops-guru-rds-application@. When you create a /key/, the case of
-- characters in the /key/ can be whatever you choose. After you create a
-- /key/, it is case-sensitive. For example, DevOps Guru works with a /key/
-- named @devops-guru-rds@ and a /key/ named @DevOps-Guru-RDS@, and these
-- act as two different /keys/. Possible /key/\//value/ pairs in your
-- application might be @Devops-Guru-production-application\/RDS@ or
-- @Devops-Guru-production-application\/containers@.
newResourceCollectionFilter ::
  ResourceCollectionFilter
newResourceCollectionFilter :: ResourceCollectionFilter
newResourceCollectionFilter =
  ResourceCollectionFilter'
    { $sel:cloudFormation:ResourceCollectionFilter' :: Maybe CloudFormationCollectionFilter
cloudFormation =
        forall a. Maybe a
Prelude.Nothing,
      $sel:tags:ResourceCollectionFilter' :: Maybe [TagCollectionFilter]
tags = forall a. Maybe a
Prelude.Nothing
    }

-- | Information about Amazon Web Services CloudFormation stacks. You can use
-- up to 500 stacks to specify which Amazon Web Services resources in your
-- account to analyze. For more information, see
-- <https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/stacks.html Stacks>
-- in the /Amazon Web Services CloudFormation User Guide/.
resourceCollectionFilter_cloudFormation :: Lens.Lens' ResourceCollectionFilter (Prelude.Maybe CloudFormationCollectionFilter)
resourceCollectionFilter_cloudFormation :: Lens'
  ResourceCollectionFilter (Maybe CloudFormationCollectionFilter)
resourceCollectionFilter_cloudFormation = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResourceCollectionFilter' {Maybe CloudFormationCollectionFilter
cloudFormation :: Maybe CloudFormationCollectionFilter
$sel:cloudFormation:ResourceCollectionFilter' :: ResourceCollectionFilter -> Maybe CloudFormationCollectionFilter
cloudFormation} -> Maybe CloudFormationCollectionFilter
cloudFormation) (\s :: ResourceCollectionFilter
s@ResourceCollectionFilter' {} Maybe CloudFormationCollectionFilter
a -> ResourceCollectionFilter
s {$sel:cloudFormation:ResourceCollectionFilter' :: Maybe CloudFormationCollectionFilter
cloudFormation = Maybe CloudFormationCollectionFilter
a} :: ResourceCollectionFilter)

-- | The Amazon Web Services tags used to filter the resources in the
-- resource collection.
--
-- Tags help you identify and organize your Amazon Web Services resources.
-- Many Amazon Web Services services support tagging, so you can assign the
-- same tag to resources from different services to indicate that the
-- resources are related. For example, you can assign the same tag to an
-- Amazon DynamoDB table resource that you assign to an Lambda function.
-- For more information about using tags, see the
-- <https://d1.awsstatic.com/whitepapers/aws-tagging-best-practices.pdf Tagging best practices>
-- whitepaper.
--
-- Each Amazon Web Services tag has two parts.
--
-- -   A tag /key/ (for example, @CostCenter@, @Environment@, @Project@, or
--     @Secret@). Tag /keys/ are case-sensitive.
--
-- -   An optional field known as a tag /value/ (for example,
--     @111122223333@, @Production@, or a team name). Omitting the tag
--     /value/ is the same as using an empty string. Like tag /keys/, tag
--     /values/ are case-sensitive.
--
-- Together these are known as /key/-/value/ pairs.
--
-- The string used for a /key/ in a tag that you use to define your
-- resource coverage must begin with the prefix @Devops-guru-@. The tag
-- /key/ might be @DevOps-Guru-deployment-application@ or
-- @devops-guru-rds-application@. When you create a /key/, the case of
-- characters in the /key/ can be whatever you choose. After you create a
-- /key/, it is case-sensitive. For example, DevOps Guru works with a /key/
-- named @devops-guru-rds@ and a /key/ named @DevOps-Guru-RDS@, and these
-- act as two different /keys/. Possible /key/\//value/ pairs in your
-- application might be @Devops-Guru-production-application\/RDS@ or
-- @Devops-Guru-production-application\/containers@.
resourceCollectionFilter_tags :: Lens.Lens' ResourceCollectionFilter (Prelude.Maybe [TagCollectionFilter])
resourceCollectionFilter_tags :: Lens' ResourceCollectionFilter (Maybe [TagCollectionFilter])
resourceCollectionFilter_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResourceCollectionFilter' {Maybe [TagCollectionFilter]
tags :: Maybe [TagCollectionFilter]
$sel:tags:ResourceCollectionFilter' :: ResourceCollectionFilter -> Maybe [TagCollectionFilter]
tags} -> Maybe [TagCollectionFilter]
tags) (\s :: ResourceCollectionFilter
s@ResourceCollectionFilter' {} Maybe [TagCollectionFilter]
a -> ResourceCollectionFilter
s {$sel:tags:ResourceCollectionFilter' :: Maybe [TagCollectionFilter]
tags = Maybe [TagCollectionFilter]
a} :: ResourceCollectionFilter) 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

instance Data.FromJSON ResourceCollectionFilter where
  parseJSON :: Value -> Parser ResourceCollectionFilter
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ResourceCollectionFilter"
      ( \Object
x ->
          Maybe CloudFormationCollectionFilter
-> Maybe [TagCollectionFilter] -> ResourceCollectionFilter
ResourceCollectionFilter'
            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
"CloudFormation")
            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
"Tags" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable ResourceCollectionFilter where
  hashWithSalt :: Int -> ResourceCollectionFilter -> Int
hashWithSalt Int
_salt ResourceCollectionFilter' {Maybe [TagCollectionFilter]
Maybe CloudFormationCollectionFilter
tags :: Maybe [TagCollectionFilter]
cloudFormation :: Maybe CloudFormationCollectionFilter
$sel:tags:ResourceCollectionFilter' :: ResourceCollectionFilter -> Maybe [TagCollectionFilter]
$sel:cloudFormation:ResourceCollectionFilter' :: ResourceCollectionFilter -> Maybe CloudFormationCollectionFilter
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe CloudFormationCollectionFilter
cloudFormation
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [TagCollectionFilter]
tags

instance Prelude.NFData ResourceCollectionFilter where
  rnf :: ResourceCollectionFilter -> ()
rnf ResourceCollectionFilter' {Maybe [TagCollectionFilter]
Maybe CloudFormationCollectionFilter
tags :: Maybe [TagCollectionFilter]
cloudFormation :: Maybe CloudFormationCollectionFilter
$sel:tags:ResourceCollectionFilter' :: ResourceCollectionFilter -> Maybe [TagCollectionFilter]
$sel:cloudFormation:ResourceCollectionFilter' :: ResourceCollectionFilter -> Maybe CloudFormationCollectionFilter
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe CloudFormationCollectionFilter
cloudFormation
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [TagCollectionFilter]
tags