{-# 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.CostExplorer.Types.CostAllocationTagStatusEntry
-- 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.CostExplorer.Types.CostAllocationTagStatusEntry where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import Amazonka.CostExplorer.Types.CostAllocationTagStatus
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | The cost allocation tag status. The status of a key can either be active
-- or inactive.
--
-- /See:/ 'newCostAllocationTagStatusEntry' smart constructor.
data CostAllocationTagStatusEntry = CostAllocationTagStatusEntry'
  { -- | The key for the cost allocation tag.
    CostAllocationTagStatusEntry -> Text
tagKey :: Prelude.Text,
    -- | The status of a cost allocation tag.
    CostAllocationTagStatusEntry -> CostAllocationTagStatus
status :: CostAllocationTagStatus
  }
  deriving (CostAllocationTagStatusEntry
-> CostAllocationTagStatusEntry -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CostAllocationTagStatusEntry
-> CostAllocationTagStatusEntry -> Bool
$c/= :: CostAllocationTagStatusEntry
-> CostAllocationTagStatusEntry -> Bool
== :: CostAllocationTagStatusEntry
-> CostAllocationTagStatusEntry -> Bool
$c== :: CostAllocationTagStatusEntry
-> CostAllocationTagStatusEntry -> Bool
Prelude.Eq, ReadPrec [CostAllocationTagStatusEntry]
ReadPrec CostAllocationTagStatusEntry
Int -> ReadS CostAllocationTagStatusEntry
ReadS [CostAllocationTagStatusEntry]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CostAllocationTagStatusEntry]
$creadListPrec :: ReadPrec [CostAllocationTagStatusEntry]
readPrec :: ReadPrec CostAllocationTagStatusEntry
$creadPrec :: ReadPrec CostAllocationTagStatusEntry
readList :: ReadS [CostAllocationTagStatusEntry]
$creadList :: ReadS [CostAllocationTagStatusEntry]
readsPrec :: Int -> ReadS CostAllocationTagStatusEntry
$creadsPrec :: Int -> ReadS CostAllocationTagStatusEntry
Prelude.Read, Int -> CostAllocationTagStatusEntry -> ShowS
[CostAllocationTagStatusEntry] -> ShowS
CostAllocationTagStatusEntry -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CostAllocationTagStatusEntry] -> ShowS
$cshowList :: [CostAllocationTagStatusEntry] -> ShowS
show :: CostAllocationTagStatusEntry -> String
$cshow :: CostAllocationTagStatusEntry -> String
showsPrec :: Int -> CostAllocationTagStatusEntry -> ShowS
$cshowsPrec :: Int -> CostAllocationTagStatusEntry -> ShowS
Prelude.Show, forall x.
Rep CostAllocationTagStatusEntry x -> CostAllocationTagStatusEntry
forall x.
CostAllocationTagStatusEntry -> Rep CostAllocationTagStatusEntry x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CostAllocationTagStatusEntry x -> CostAllocationTagStatusEntry
$cfrom :: forall x.
CostAllocationTagStatusEntry -> Rep CostAllocationTagStatusEntry x
Prelude.Generic)

-- |
-- Create a value of 'CostAllocationTagStatusEntry' 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', 'costAllocationTagStatusEntry_tagKey' - The key for the cost allocation tag.
--
-- 'status', 'costAllocationTagStatusEntry_status' - The status of a cost allocation tag.
newCostAllocationTagStatusEntry ::
  -- | 'tagKey'
  Prelude.Text ->
  -- | 'status'
  CostAllocationTagStatus ->
  CostAllocationTagStatusEntry
newCostAllocationTagStatusEntry :: Text -> CostAllocationTagStatus -> CostAllocationTagStatusEntry
newCostAllocationTagStatusEntry Text
pTagKey_ CostAllocationTagStatus
pStatus_ =
  CostAllocationTagStatusEntry'
    { $sel:tagKey:CostAllocationTagStatusEntry' :: Text
tagKey = Text
pTagKey_,
      $sel:status:CostAllocationTagStatusEntry' :: CostAllocationTagStatus
status = CostAllocationTagStatus
pStatus_
    }

-- | The key for the cost allocation tag.
costAllocationTagStatusEntry_tagKey :: Lens.Lens' CostAllocationTagStatusEntry Prelude.Text
costAllocationTagStatusEntry_tagKey :: Lens' CostAllocationTagStatusEntry Text
costAllocationTagStatusEntry_tagKey = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CostAllocationTagStatusEntry' {Text
tagKey :: Text
$sel:tagKey:CostAllocationTagStatusEntry' :: CostAllocationTagStatusEntry -> Text
tagKey} -> Text
tagKey) (\s :: CostAllocationTagStatusEntry
s@CostAllocationTagStatusEntry' {} Text
a -> CostAllocationTagStatusEntry
s {$sel:tagKey:CostAllocationTagStatusEntry' :: Text
tagKey = Text
a} :: CostAllocationTagStatusEntry)

-- | The status of a cost allocation tag.
costAllocationTagStatusEntry_status :: Lens.Lens' CostAllocationTagStatusEntry CostAllocationTagStatus
costAllocationTagStatusEntry_status :: Lens' CostAllocationTagStatusEntry CostAllocationTagStatus
costAllocationTagStatusEntry_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CostAllocationTagStatusEntry' {CostAllocationTagStatus
status :: CostAllocationTagStatus
$sel:status:CostAllocationTagStatusEntry' :: CostAllocationTagStatusEntry -> CostAllocationTagStatus
status} -> CostAllocationTagStatus
status) (\s :: CostAllocationTagStatusEntry
s@CostAllocationTagStatusEntry' {} CostAllocationTagStatus
a -> CostAllocationTagStatusEntry
s {$sel:status:CostAllocationTagStatusEntry' :: CostAllocationTagStatus
status = CostAllocationTagStatus
a} :: CostAllocationTagStatusEntry)

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

instance Prelude.NFData CostAllocationTagStatusEntry where
  rnf :: CostAllocationTagStatusEntry -> ()
rnf CostAllocationTagStatusEntry' {Text
CostAllocationTagStatus
status :: CostAllocationTagStatus
tagKey :: Text
$sel:status:CostAllocationTagStatusEntry' :: CostAllocationTagStatusEntry -> CostAllocationTagStatus
$sel:tagKey:CostAllocationTagStatusEntry' :: CostAllocationTagStatusEntry -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
tagKey seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf CostAllocationTagStatus
status

instance Data.ToJSON CostAllocationTagStatusEntry where
  toJSON :: CostAllocationTagStatusEntry -> Value
toJSON CostAllocationTagStatusEntry' {Text
CostAllocationTagStatus
status :: CostAllocationTagStatus
tagKey :: Text
$sel:status:CostAllocationTagStatusEntry' :: CostAllocationTagStatusEntry -> CostAllocationTagStatus
$sel:tagKey:CostAllocationTagStatusEntry' :: CostAllocationTagStatusEntry -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just (Key
"TagKey" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
tagKey),
            forall a. a -> Maybe a
Prelude.Just (Key
"Status" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= CostAllocationTagStatus
status)
          ]
      )