{-# 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.CostEstimationResourceCollectionFilter
-- 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.CostEstimationResourceCollectionFilter 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.CloudFormationCostEstimationResourceCollectionFilter
import Amazonka.DevOpsGuru.Types.TagCostEstimationResourceCollectionFilter
import qualified Amazonka.Prelude as Prelude

-- | Information about a filter used to specify which Amazon Web Services
-- resources are analyzed to create a monthly DevOps Guru cost estimate.
-- For more information, see
-- <https://docs.aws.amazon.com/devops-guru/latest/userguide/cost-estimate.html Estimate your Amazon DevOps Guru costs>
-- and
-- <http://aws.amazon.com/devops-guru/pricing/ Amazon DevOps Guru pricing>.
--
-- /See:/ 'newCostEstimationResourceCollectionFilter' smart constructor.
data CostEstimationResourceCollectionFilter = CostEstimationResourceCollectionFilter'
  { -- | An object that specifies the CloudFormation stack that defines the
    -- Amazon Web Services resources used to create a monthly estimate for
    -- DevOps Guru.
    CostEstimationResourceCollectionFilter
-> Maybe CloudFormationCostEstimationResourceCollectionFilter
cloudFormation :: Prelude.Maybe CloudFormationCostEstimationResourceCollectionFilter,
    -- | The Amazon Web Services tags used to filter the resource collection that
    -- is used for a cost estimate.
    --
    -- 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@.
    CostEstimationResourceCollectionFilter
-> Maybe [TagCostEstimationResourceCollectionFilter]
tags :: Prelude.Maybe [TagCostEstimationResourceCollectionFilter]
  }
  deriving (CostEstimationResourceCollectionFilter
-> CostEstimationResourceCollectionFilter -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CostEstimationResourceCollectionFilter
-> CostEstimationResourceCollectionFilter -> Bool
$c/= :: CostEstimationResourceCollectionFilter
-> CostEstimationResourceCollectionFilter -> Bool
== :: CostEstimationResourceCollectionFilter
-> CostEstimationResourceCollectionFilter -> Bool
$c== :: CostEstimationResourceCollectionFilter
-> CostEstimationResourceCollectionFilter -> Bool
Prelude.Eq, ReadPrec [CostEstimationResourceCollectionFilter]
ReadPrec CostEstimationResourceCollectionFilter
Int -> ReadS CostEstimationResourceCollectionFilter
ReadS [CostEstimationResourceCollectionFilter]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CostEstimationResourceCollectionFilter]
$creadListPrec :: ReadPrec [CostEstimationResourceCollectionFilter]
readPrec :: ReadPrec CostEstimationResourceCollectionFilter
$creadPrec :: ReadPrec CostEstimationResourceCollectionFilter
readList :: ReadS [CostEstimationResourceCollectionFilter]
$creadList :: ReadS [CostEstimationResourceCollectionFilter]
readsPrec :: Int -> ReadS CostEstimationResourceCollectionFilter
$creadsPrec :: Int -> ReadS CostEstimationResourceCollectionFilter
Prelude.Read, Int -> CostEstimationResourceCollectionFilter -> ShowS
[CostEstimationResourceCollectionFilter] -> ShowS
CostEstimationResourceCollectionFilter -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CostEstimationResourceCollectionFilter] -> ShowS
$cshowList :: [CostEstimationResourceCollectionFilter] -> ShowS
show :: CostEstimationResourceCollectionFilter -> String
$cshow :: CostEstimationResourceCollectionFilter -> String
showsPrec :: Int -> CostEstimationResourceCollectionFilter -> ShowS
$cshowsPrec :: Int -> CostEstimationResourceCollectionFilter -> ShowS
Prelude.Show, forall x.
Rep CostEstimationResourceCollectionFilter x
-> CostEstimationResourceCollectionFilter
forall x.
CostEstimationResourceCollectionFilter
-> Rep CostEstimationResourceCollectionFilter x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CostEstimationResourceCollectionFilter x
-> CostEstimationResourceCollectionFilter
$cfrom :: forall x.
CostEstimationResourceCollectionFilter
-> Rep CostEstimationResourceCollectionFilter x
Prelude.Generic)

-- |
-- Create a value of 'CostEstimationResourceCollectionFilter' 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', 'costEstimationResourceCollectionFilter_cloudFormation' - An object that specifies the CloudFormation stack that defines the
-- Amazon Web Services resources used to create a monthly estimate for
-- DevOps Guru.
--
-- 'tags', 'costEstimationResourceCollectionFilter_tags' - The Amazon Web Services tags used to filter the resource collection that
-- is used for a cost estimate.
--
-- 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@.
newCostEstimationResourceCollectionFilter ::
  CostEstimationResourceCollectionFilter
newCostEstimationResourceCollectionFilter :: CostEstimationResourceCollectionFilter
newCostEstimationResourceCollectionFilter =
  CostEstimationResourceCollectionFilter'
    { $sel:cloudFormation:CostEstimationResourceCollectionFilter' :: Maybe CloudFormationCostEstimationResourceCollectionFilter
cloudFormation =
        forall a. Maybe a
Prelude.Nothing,
      $sel:tags:CostEstimationResourceCollectionFilter' :: Maybe [TagCostEstimationResourceCollectionFilter]
tags = forall a. Maybe a
Prelude.Nothing
    }

-- | An object that specifies the CloudFormation stack that defines the
-- Amazon Web Services resources used to create a monthly estimate for
-- DevOps Guru.
costEstimationResourceCollectionFilter_cloudFormation :: Lens.Lens' CostEstimationResourceCollectionFilter (Prelude.Maybe CloudFormationCostEstimationResourceCollectionFilter)
costEstimationResourceCollectionFilter_cloudFormation :: Lens'
  CostEstimationResourceCollectionFilter
  (Maybe CloudFormationCostEstimationResourceCollectionFilter)
costEstimationResourceCollectionFilter_cloudFormation = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CostEstimationResourceCollectionFilter' {Maybe CloudFormationCostEstimationResourceCollectionFilter
cloudFormation :: Maybe CloudFormationCostEstimationResourceCollectionFilter
$sel:cloudFormation:CostEstimationResourceCollectionFilter' :: CostEstimationResourceCollectionFilter
-> Maybe CloudFormationCostEstimationResourceCollectionFilter
cloudFormation} -> Maybe CloudFormationCostEstimationResourceCollectionFilter
cloudFormation) (\s :: CostEstimationResourceCollectionFilter
s@CostEstimationResourceCollectionFilter' {} Maybe CloudFormationCostEstimationResourceCollectionFilter
a -> CostEstimationResourceCollectionFilter
s {$sel:cloudFormation:CostEstimationResourceCollectionFilter' :: Maybe CloudFormationCostEstimationResourceCollectionFilter
cloudFormation = Maybe CloudFormationCostEstimationResourceCollectionFilter
a} :: CostEstimationResourceCollectionFilter)

-- | The Amazon Web Services tags used to filter the resource collection that
-- is used for a cost estimate.
--
-- 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@.
costEstimationResourceCollectionFilter_tags :: Lens.Lens' CostEstimationResourceCollectionFilter (Prelude.Maybe [TagCostEstimationResourceCollectionFilter])
costEstimationResourceCollectionFilter_tags :: Lens'
  CostEstimationResourceCollectionFilter
  (Maybe [TagCostEstimationResourceCollectionFilter])
costEstimationResourceCollectionFilter_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CostEstimationResourceCollectionFilter' {Maybe [TagCostEstimationResourceCollectionFilter]
tags :: Maybe [TagCostEstimationResourceCollectionFilter]
$sel:tags:CostEstimationResourceCollectionFilter' :: CostEstimationResourceCollectionFilter
-> Maybe [TagCostEstimationResourceCollectionFilter]
tags} -> Maybe [TagCostEstimationResourceCollectionFilter]
tags) (\s :: CostEstimationResourceCollectionFilter
s@CostEstimationResourceCollectionFilter' {} Maybe [TagCostEstimationResourceCollectionFilter]
a -> CostEstimationResourceCollectionFilter
s {$sel:tags:CostEstimationResourceCollectionFilter' :: Maybe [TagCostEstimationResourceCollectionFilter]
tags = Maybe [TagCostEstimationResourceCollectionFilter]
a} :: CostEstimationResourceCollectionFilter) 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
    CostEstimationResourceCollectionFilter
  where
  parseJSON :: Value -> Parser CostEstimationResourceCollectionFilter
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"CostEstimationResourceCollectionFilter"
      ( \Object
x ->
          Maybe CloudFormationCostEstimationResourceCollectionFilter
-> Maybe [TagCostEstimationResourceCollectionFilter]
-> CostEstimationResourceCollectionFilter
CostEstimationResourceCollectionFilter'
            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
    CostEstimationResourceCollectionFilter
  where
  hashWithSalt :: Int -> CostEstimationResourceCollectionFilter -> Int
hashWithSalt
    Int
_salt
    CostEstimationResourceCollectionFilter' {Maybe [TagCostEstimationResourceCollectionFilter]
Maybe CloudFormationCostEstimationResourceCollectionFilter
tags :: Maybe [TagCostEstimationResourceCollectionFilter]
cloudFormation :: Maybe CloudFormationCostEstimationResourceCollectionFilter
$sel:tags:CostEstimationResourceCollectionFilter' :: CostEstimationResourceCollectionFilter
-> Maybe [TagCostEstimationResourceCollectionFilter]
$sel:cloudFormation:CostEstimationResourceCollectionFilter' :: CostEstimationResourceCollectionFilter
-> Maybe CloudFormationCostEstimationResourceCollectionFilter
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe CloudFormationCostEstimationResourceCollectionFilter
cloudFormation
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [TagCostEstimationResourceCollectionFilter]
tags

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

instance
  Data.ToJSON
    CostEstimationResourceCollectionFilter
  where
  toJSON :: CostEstimationResourceCollectionFilter -> Value
toJSON CostEstimationResourceCollectionFilter' {Maybe [TagCostEstimationResourceCollectionFilter]
Maybe CloudFormationCostEstimationResourceCollectionFilter
tags :: Maybe [TagCostEstimationResourceCollectionFilter]
cloudFormation :: Maybe CloudFormationCostEstimationResourceCollectionFilter
$sel:tags:CostEstimationResourceCollectionFilter' :: CostEstimationResourceCollectionFilter
-> Maybe [TagCostEstimationResourceCollectionFilter]
$sel:cloudFormation:CostEstimationResourceCollectionFilter' :: CostEstimationResourceCollectionFilter
-> Maybe CloudFormationCostEstimationResourceCollectionFilter
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"CloudFormation" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe CloudFormationCostEstimationResourceCollectionFilter
cloudFormation,
            (Key
"Tags" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [TagCostEstimationResourceCollectionFilter]
tags
          ]
      )