{-# 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.ServiceCatalogAppRegistry.Types.TagQueryConfiguration
-- 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.ServiceCatalogAppRegistry.Types.TagQueryConfiguration 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

-- | The definition of @tagQuery@. Specifies which resources are associated
-- with an application.
--
-- /See:/ 'newTagQueryConfiguration' smart constructor.
data TagQueryConfiguration = TagQueryConfiguration'
  { -- | Condition in the IAM policy that associates resources to an application.
    TagQueryConfiguration -> Maybe Text
tagKey :: Prelude.Maybe Prelude.Text
  }
  deriving (TagQueryConfiguration -> TagQueryConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TagQueryConfiguration -> TagQueryConfiguration -> Bool
$c/= :: TagQueryConfiguration -> TagQueryConfiguration -> Bool
== :: TagQueryConfiguration -> TagQueryConfiguration -> Bool
$c== :: TagQueryConfiguration -> TagQueryConfiguration -> Bool
Prelude.Eq, ReadPrec [TagQueryConfiguration]
ReadPrec TagQueryConfiguration
Int -> ReadS TagQueryConfiguration
ReadS [TagQueryConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TagQueryConfiguration]
$creadListPrec :: ReadPrec [TagQueryConfiguration]
readPrec :: ReadPrec TagQueryConfiguration
$creadPrec :: ReadPrec TagQueryConfiguration
readList :: ReadS [TagQueryConfiguration]
$creadList :: ReadS [TagQueryConfiguration]
readsPrec :: Int -> ReadS TagQueryConfiguration
$creadsPrec :: Int -> ReadS TagQueryConfiguration
Prelude.Read, Int -> TagQueryConfiguration -> ShowS
[TagQueryConfiguration] -> ShowS
TagQueryConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TagQueryConfiguration] -> ShowS
$cshowList :: [TagQueryConfiguration] -> ShowS
show :: TagQueryConfiguration -> String
$cshow :: TagQueryConfiguration -> String
showsPrec :: Int -> TagQueryConfiguration -> ShowS
$cshowsPrec :: Int -> TagQueryConfiguration -> ShowS
Prelude.Show, forall x. Rep TagQueryConfiguration x -> TagQueryConfiguration
forall x. TagQueryConfiguration -> Rep TagQueryConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TagQueryConfiguration x -> TagQueryConfiguration
$cfrom :: forall x. TagQueryConfiguration -> Rep TagQueryConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'TagQueryConfiguration' 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:
--
-- 'tagKey', 'tagQueryConfiguration_tagKey' - Condition in the IAM policy that associates resources to an application.
newTagQueryConfiguration ::
  TagQueryConfiguration
newTagQueryConfiguration :: TagQueryConfiguration
newTagQueryConfiguration =
  TagQueryConfiguration' {$sel:tagKey:TagQueryConfiguration' :: Maybe Text
tagKey = forall a. Maybe a
Prelude.Nothing}

-- | Condition in the IAM policy that associates resources to an application.
tagQueryConfiguration_tagKey :: Lens.Lens' TagQueryConfiguration (Prelude.Maybe Prelude.Text)
tagQueryConfiguration_tagKey :: Lens' TagQueryConfiguration (Maybe Text)
tagQueryConfiguration_tagKey = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TagQueryConfiguration' {Maybe Text
tagKey :: Maybe Text
$sel:tagKey:TagQueryConfiguration' :: TagQueryConfiguration -> Maybe Text
tagKey} -> Maybe Text
tagKey) (\s :: TagQueryConfiguration
s@TagQueryConfiguration' {} Maybe Text
a -> TagQueryConfiguration
s {$sel:tagKey:TagQueryConfiguration' :: Maybe Text
tagKey = Maybe Text
a} :: TagQueryConfiguration)

instance Data.FromJSON TagQueryConfiguration where
  parseJSON :: Value -> Parser TagQueryConfiguration
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"TagQueryConfiguration"
      ( \Object
x ->
          Maybe Text -> TagQueryConfiguration
TagQueryConfiguration'
            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
"tagKey")
      )

instance Prelude.Hashable TagQueryConfiguration where
  hashWithSalt :: Int -> TagQueryConfiguration -> Int
hashWithSalt Int
_salt TagQueryConfiguration' {Maybe Text
tagKey :: Maybe Text
$sel:tagKey:TagQueryConfiguration' :: TagQueryConfiguration -> Maybe Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
tagKey

instance Prelude.NFData TagQueryConfiguration where
  rnf :: TagQueryConfiguration -> ()
rnf TagQueryConfiguration' {Maybe Text
tagKey :: Maybe Text
$sel:tagKey:TagQueryConfiguration' :: TagQueryConfiguration -> Maybe Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
tagKey

instance Data.ToJSON TagQueryConfiguration where
  toJSON :: TagQueryConfiguration -> Value
toJSON TagQueryConfiguration' {Maybe Text
tagKey :: Maybe Text
$sel:tagKey:TagQueryConfiguration' :: TagQueryConfiguration -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Key
"tagKey" 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 Text
tagKey]
      )