{-# 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.Discovery.Types.ConfigurationTag
-- 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.Discovery.Types.ConfigurationTag where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Discovery.Types.ConfigurationItemType
import qualified Amazonka.Prelude as Prelude

-- | Tags for a configuration item. Tags are metadata that help you
-- categorize IT assets.
--
-- /See:/ 'newConfigurationTag' smart constructor.
data ConfigurationTag = ConfigurationTag'
  { -- | The configuration ID for the item to tag. You can specify a list of keys
    -- and values.
    ConfigurationTag -> Maybe Text
configurationId :: Prelude.Maybe Prelude.Text,
    -- | A type of IT asset to tag.
    ConfigurationTag -> Maybe ConfigurationItemType
configurationType :: Prelude.Maybe ConfigurationItemType,
    -- | A type of tag on which to filter. For example, /serverType/.
    ConfigurationTag -> Maybe Text
key :: Prelude.Maybe Prelude.Text,
    -- | The time the configuration tag was created in Coordinated Universal Time
    -- (UTC).
    ConfigurationTag -> Maybe POSIX
timeOfCreation :: Prelude.Maybe Data.POSIX,
    -- | A value on which to filter. For example /key = serverType/ and /value =
    -- web server/.
    ConfigurationTag -> Maybe Text
value :: Prelude.Maybe Prelude.Text
  }
  deriving (ConfigurationTag -> ConfigurationTag -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ConfigurationTag -> ConfigurationTag -> Bool
$c/= :: ConfigurationTag -> ConfigurationTag -> Bool
== :: ConfigurationTag -> ConfigurationTag -> Bool
$c== :: ConfigurationTag -> ConfigurationTag -> Bool
Prelude.Eq, ReadPrec [ConfigurationTag]
ReadPrec ConfigurationTag
Int -> ReadS ConfigurationTag
ReadS [ConfigurationTag]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ConfigurationTag]
$creadListPrec :: ReadPrec [ConfigurationTag]
readPrec :: ReadPrec ConfigurationTag
$creadPrec :: ReadPrec ConfigurationTag
readList :: ReadS [ConfigurationTag]
$creadList :: ReadS [ConfigurationTag]
readsPrec :: Int -> ReadS ConfigurationTag
$creadsPrec :: Int -> ReadS ConfigurationTag
Prelude.Read, Int -> ConfigurationTag -> ShowS
[ConfigurationTag] -> ShowS
ConfigurationTag -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ConfigurationTag] -> ShowS
$cshowList :: [ConfigurationTag] -> ShowS
show :: ConfigurationTag -> String
$cshow :: ConfigurationTag -> String
showsPrec :: Int -> ConfigurationTag -> ShowS
$cshowsPrec :: Int -> ConfigurationTag -> ShowS
Prelude.Show, forall x. Rep ConfigurationTag x -> ConfigurationTag
forall x. ConfigurationTag -> Rep ConfigurationTag x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ConfigurationTag x -> ConfigurationTag
$cfrom :: forall x. ConfigurationTag -> Rep ConfigurationTag x
Prelude.Generic)

-- |
-- Create a value of 'ConfigurationTag' 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:
--
-- 'configurationId', 'configurationTag_configurationId' - The configuration ID for the item to tag. You can specify a list of keys
-- and values.
--
-- 'configurationType', 'configurationTag_configurationType' - A type of IT asset to tag.
--
-- 'key', 'configurationTag_key' - A type of tag on which to filter. For example, /serverType/.
--
-- 'timeOfCreation', 'configurationTag_timeOfCreation' - The time the configuration tag was created in Coordinated Universal Time
-- (UTC).
--
-- 'value', 'configurationTag_value' - A value on which to filter. For example /key = serverType/ and /value =
-- web server/.
newConfigurationTag ::
  ConfigurationTag
newConfigurationTag :: ConfigurationTag
newConfigurationTag =
  ConfigurationTag'
    { $sel:configurationId:ConfigurationTag' :: Maybe Text
configurationId =
        forall a. Maybe a
Prelude.Nothing,
      $sel:configurationType:ConfigurationTag' :: Maybe ConfigurationItemType
configurationType = forall a. Maybe a
Prelude.Nothing,
      $sel:key:ConfigurationTag' :: Maybe Text
key = forall a. Maybe a
Prelude.Nothing,
      $sel:timeOfCreation:ConfigurationTag' :: Maybe POSIX
timeOfCreation = forall a. Maybe a
Prelude.Nothing,
      $sel:value:ConfigurationTag' :: Maybe Text
value = forall a. Maybe a
Prelude.Nothing
    }

-- | The configuration ID for the item to tag. You can specify a list of keys
-- and values.
configurationTag_configurationId :: Lens.Lens' ConfigurationTag (Prelude.Maybe Prelude.Text)
configurationTag_configurationId :: Lens' ConfigurationTag (Maybe Text)
configurationTag_configurationId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfigurationTag' {Maybe Text
configurationId :: Maybe Text
$sel:configurationId:ConfigurationTag' :: ConfigurationTag -> Maybe Text
configurationId} -> Maybe Text
configurationId) (\s :: ConfigurationTag
s@ConfigurationTag' {} Maybe Text
a -> ConfigurationTag
s {$sel:configurationId:ConfigurationTag' :: Maybe Text
configurationId = Maybe Text
a} :: ConfigurationTag)

-- | A type of IT asset to tag.
configurationTag_configurationType :: Lens.Lens' ConfigurationTag (Prelude.Maybe ConfigurationItemType)
configurationTag_configurationType :: Lens' ConfigurationTag (Maybe ConfigurationItemType)
configurationTag_configurationType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfigurationTag' {Maybe ConfigurationItemType
configurationType :: Maybe ConfigurationItemType
$sel:configurationType:ConfigurationTag' :: ConfigurationTag -> Maybe ConfigurationItemType
configurationType} -> Maybe ConfigurationItemType
configurationType) (\s :: ConfigurationTag
s@ConfigurationTag' {} Maybe ConfigurationItemType
a -> ConfigurationTag
s {$sel:configurationType:ConfigurationTag' :: Maybe ConfigurationItemType
configurationType = Maybe ConfigurationItemType
a} :: ConfigurationTag)

-- | A type of tag on which to filter. For example, /serverType/.
configurationTag_key :: Lens.Lens' ConfigurationTag (Prelude.Maybe Prelude.Text)
configurationTag_key :: Lens' ConfigurationTag (Maybe Text)
configurationTag_key = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfigurationTag' {Maybe Text
key :: Maybe Text
$sel:key:ConfigurationTag' :: ConfigurationTag -> Maybe Text
key} -> Maybe Text
key) (\s :: ConfigurationTag
s@ConfigurationTag' {} Maybe Text
a -> ConfigurationTag
s {$sel:key:ConfigurationTag' :: Maybe Text
key = Maybe Text
a} :: ConfigurationTag)

-- | The time the configuration tag was created in Coordinated Universal Time
-- (UTC).
configurationTag_timeOfCreation :: Lens.Lens' ConfigurationTag (Prelude.Maybe Prelude.UTCTime)
configurationTag_timeOfCreation :: Lens' ConfigurationTag (Maybe UTCTime)
configurationTag_timeOfCreation = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfigurationTag' {Maybe POSIX
timeOfCreation :: Maybe POSIX
$sel:timeOfCreation:ConfigurationTag' :: ConfigurationTag -> Maybe POSIX
timeOfCreation} -> Maybe POSIX
timeOfCreation) (\s :: ConfigurationTag
s@ConfigurationTag' {} Maybe POSIX
a -> ConfigurationTag
s {$sel:timeOfCreation:ConfigurationTag' :: Maybe POSIX
timeOfCreation = Maybe POSIX
a} :: ConfigurationTag) 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 (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | A value on which to filter. For example /key = serverType/ and /value =
-- web server/.
configurationTag_value :: Lens.Lens' ConfigurationTag (Prelude.Maybe Prelude.Text)
configurationTag_value :: Lens' ConfigurationTag (Maybe Text)
configurationTag_value = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfigurationTag' {Maybe Text
value :: Maybe Text
$sel:value:ConfigurationTag' :: ConfigurationTag -> Maybe Text
value} -> Maybe Text
value) (\s :: ConfigurationTag
s@ConfigurationTag' {} Maybe Text
a -> ConfigurationTag
s {$sel:value:ConfigurationTag' :: Maybe Text
value = Maybe Text
a} :: ConfigurationTag)

instance Data.FromJSON ConfigurationTag where
  parseJSON :: Value -> Parser ConfigurationTag
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ConfigurationTag"
      ( \Object
x ->
          Maybe Text
-> Maybe ConfigurationItemType
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> ConfigurationTag
ConfigurationTag'
            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
"configurationId")
            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
"configurationType")
            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
"key")
            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
"timeOfCreation")
            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
"value")
      )

instance Prelude.Hashable ConfigurationTag where
  hashWithSalt :: Int -> ConfigurationTag -> Int
hashWithSalt Int
_salt ConfigurationTag' {Maybe Text
Maybe POSIX
Maybe ConfigurationItemType
value :: Maybe Text
timeOfCreation :: Maybe POSIX
key :: Maybe Text
configurationType :: Maybe ConfigurationItemType
configurationId :: Maybe Text
$sel:value:ConfigurationTag' :: ConfigurationTag -> Maybe Text
$sel:timeOfCreation:ConfigurationTag' :: ConfigurationTag -> Maybe POSIX
$sel:key:ConfigurationTag' :: ConfigurationTag -> Maybe Text
$sel:configurationType:ConfigurationTag' :: ConfigurationTag -> Maybe ConfigurationItemType
$sel:configurationId:ConfigurationTag' :: ConfigurationTag -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
configurationId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ConfigurationItemType
configurationType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
key
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
timeOfCreation
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
value

instance Prelude.NFData ConfigurationTag where
  rnf :: ConfigurationTag -> ()
rnf ConfigurationTag' {Maybe Text
Maybe POSIX
Maybe ConfigurationItemType
value :: Maybe Text
timeOfCreation :: Maybe POSIX
key :: Maybe Text
configurationType :: Maybe ConfigurationItemType
configurationId :: Maybe Text
$sel:value:ConfigurationTag' :: ConfigurationTag -> Maybe Text
$sel:timeOfCreation:ConfigurationTag' :: ConfigurationTag -> Maybe POSIX
$sel:key:ConfigurationTag' :: ConfigurationTag -> Maybe Text
$sel:configurationType:ConfigurationTag' :: ConfigurationTag -> Maybe ConfigurationItemType
$sel:configurationId:ConfigurationTag' :: ConfigurationTag -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
configurationId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ConfigurationItemType
configurationType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
key
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
timeOfCreation
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
value