{-# 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.ResourceGroupsTagging.Types.Summary
-- 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.ResourceGroupsTagging.Types.Summary 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
import Amazonka.ResourceGroupsTagging.Types.TargetIdType

-- | A count of noncompliant resources.
--
-- /See:/ 'newSummary' smart constructor.
data Summary = Summary'
  { -- | The timestamp that shows when this summary was generated in this Region.
    Summary -> Maybe Text
lastUpdated :: Prelude.Maybe Prelude.Text,
    -- | The count of noncompliant resources.
    Summary -> Maybe Integer
nonCompliantResources :: Prelude.Maybe Prelude.Integer,
    -- | The Amazon Web Services Region that the summary applies to.
    Summary -> Maybe Text
region :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Web Services resource type.
    Summary -> Maybe Text
resourceType :: Prelude.Maybe Prelude.Text,
    -- | The account identifier or the root identifier of the organization. If
    -- you don\'t know the root ID, you can call the Organizations
    -- <https://docs.aws.amazon.com/organizations/latest/APIReference/API_ListRoots.html ListRoots>
    -- API.
    Summary -> Maybe Text
targetId :: Prelude.Maybe Prelude.Text,
    -- | Whether the target is an account, an OU, or the organization root.
    Summary -> Maybe TargetIdType
targetIdType :: Prelude.Maybe TargetIdType
  }
  deriving (Summary -> Summary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Summary -> Summary -> Bool
$c/= :: Summary -> Summary -> Bool
== :: Summary -> Summary -> Bool
$c== :: Summary -> Summary -> Bool
Prelude.Eq, ReadPrec [Summary]
ReadPrec Summary
Int -> ReadS Summary
ReadS [Summary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Summary]
$creadListPrec :: ReadPrec [Summary]
readPrec :: ReadPrec Summary
$creadPrec :: ReadPrec Summary
readList :: ReadS [Summary]
$creadList :: ReadS [Summary]
readsPrec :: Int -> ReadS Summary
$creadsPrec :: Int -> ReadS Summary
Prelude.Read, Int -> Summary -> ShowS
[Summary] -> ShowS
Summary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Summary] -> ShowS
$cshowList :: [Summary] -> ShowS
show :: Summary -> String
$cshow :: Summary -> String
showsPrec :: Int -> Summary -> ShowS
$cshowsPrec :: Int -> Summary -> ShowS
Prelude.Show, forall x. Rep Summary x -> Summary
forall x. Summary -> Rep Summary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Summary x -> Summary
$cfrom :: forall x. Summary -> Rep Summary x
Prelude.Generic)

-- |
-- Create a value of 'Summary' 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:
--
-- 'lastUpdated', 'summary_lastUpdated' - The timestamp that shows when this summary was generated in this Region.
--
-- 'nonCompliantResources', 'summary_nonCompliantResources' - The count of noncompliant resources.
--
-- 'region', 'summary_region' - The Amazon Web Services Region that the summary applies to.
--
-- 'resourceType', 'summary_resourceType' - The Amazon Web Services resource type.
--
-- 'targetId', 'summary_targetId' - The account identifier or the root identifier of the organization. If
-- you don\'t know the root ID, you can call the Organizations
-- <https://docs.aws.amazon.com/organizations/latest/APIReference/API_ListRoots.html ListRoots>
-- API.
--
-- 'targetIdType', 'summary_targetIdType' - Whether the target is an account, an OU, or the organization root.
newSummary ::
  Summary
newSummary :: Summary
newSummary =
  Summary'
    { $sel:lastUpdated:Summary' :: Maybe Text
lastUpdated = forall a. Maybe a
Prelude.Nothing,
      $sel:nonCompliantResources:Summary' :: Maybe Integer
nonCompliantResources = forall a. Maybe a
Prelude.Nothing,
      $sel:region:Summary' :: Maybe Text
region = forall a. Maybe a
Prelude.Nothing,
      $sel:resourceType:Summary' :: Maybe Text
resourceType = forall a. Maybe a
Prelude.Nothing,
      $sel:targetId:Summary' :: Maybe Text
targetId = forall a. Maybe a
Prelude.Nothing,
      $sel:targetIdType:Summary' :: Maybe TargetIdType
targetIdType = forall a. Maybe a
Prelude.Nothing
    }

-- | The timestamp that shows when this summary was generated in this Region.
summary_lastUpdated :: Lens.Lens' Summary (Prelude.Maybe Prelude.Text)
summary_lastUpdated :: Lens' Summary (Maybe Text)
summary_lastUpdated = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Summary' {Maybe Text
lastUpdated :: Maybe Text
$sel:lastUpdated:Summary' :: Summary -> Maybe Text
lastUpdated} -> Maybe Text
lastUpdated) (\s :: Summary
s@Summary' {} Maybe Text
a -> Summary
s {$sel:lastUpdated:Summary' :: Maybe Text
lastUpdated = Maybe Text
a} :: Summary)

-- | The count of noncompliant resources.
summary_nonCompliantResources :: Lens.Lens' Summary (Prelude.Maybe Prelude.Integer)
summary_nonCompliantResources :: Lens' Summary (Maybe Integer)
summary_nonCompliantResources = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Summary' {Maybe Integer
nonCompliantResources :: Maybe Integer
$sel:nonCompliantResources:Summary' :: Summary -> Maybe Integer
nonCompliantResources} -> Maybe Integer
nonCompliantResources) (\s :: Summary
s@Summary' {} Maybe Integer
a -> Summary
s {$sel:nonCompliantResources:Summary' :: Maybe Integer
nonCompliantResources = Maybe Integer
a} :: Summary)

-- | The Amazon Web Services Region that the summary applies to.
summary_region :: Lens.Lens' Summary (Prelude.Maybe Prelude.Text)
summary_region :: Lens' Summary (Maybe Text)
summary_region = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Summary' {Maybe Text
region :: Maybe Text
$sel:region:Summary' :: Summary -> Maybe Text
region} -> Maybe Text
region) (\s :: Summary
s@Summary' {} Maybe Text
a -> Summary
s {$sel:region:Summary' :: Maybe Text
region = Maybe Text
a} :: Summary)

-- | The Amazon Web Services resource type.
summary_resourceType :: Lens.Lens' Summary (Prelude.Maybe Prelude.Text)
summary_resourceType :: Lens' Summary (Maybe Text)
summary_resourceType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Summary' {Maybe Text
resourceType :: Maybe Text
$sel:resourceType:Summary' :: Summary -> Maybe Text
resourceType} -> Maybe Text
resourceType) (\s :: Summary
s@Summary' {} Maybe Text
a -> Summary
s {$sel:resourceType:Summary' :: Maybe Text
resourceType = Maybe Text
a} :: Summary)

-- | The account identifier or the root identifier of the organization. If
-- you don\'t know the root ID, you can call the Organizations
-- <https://docs.aws.amazon.com/organizations/latest/APIReference/API_ListRoots.html ListRoots>
-- API.
summary_targetId :: Lens.Lens' Summary (Prelude.Maybe Prelude.Text)
summary_targetId :: Lens' Summary (Maybe Text)
summary_targetId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Summary' {Maybe Text
targetId :: Maybe Text
$sel:targetId:Summary' :: Summary -> Maybe Text
targetId} -> Maybe Text
targetId) (\s :: Summary
s@Summary' {} Maybe Text
a -> Summary
s {$sel:targetId:Summary' :: Maybe Text
targetId = Maybe Text
a} :: Summary)

-- | Whether the target is an account, an OU, or the organization root.
summary_targetIdType :: Lens.Lens' Summary (Prelude.Maybe TargetIdType)
summary_targetIdType :: Lens' Summary (Maybe TargetIdType)
summary_targetIdType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Summary' {Maybe TargetIdType
targetIdType :: Maybe TargetIdType
$sel:targetIdType:Summary' :: Summary -> Maybe TargetIdType
targetIdType} -> Maybe TargetIdType
targetIdType) (\s :: Summary
s@Summary' {} Maybe TargetIdType
a -> Summary
s {$sel:targetIdType:Summary' :: Maybe TargetIdType
targetIdType = Maybe TargetIdType
a} :: Summary)

instance Data.FromJSON Summary where
  parseJSON :: Value -> Parser Summary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Summary"
      ( \Object
x ->
          Maybe Text
-> Maybe Integer
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe TargetIdType
-> Summary
Summary'
            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
"LastUpdated")
            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
"NonCompliantResources")
            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
"Region")
            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
"ResourceType")
            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
"TargetId")
            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
"TargetIdType")
      )

instance Prelude.Hashable Summary where
  hashWithSalt :: Int -> Summary -> Int
hashWithSalt Int
_salt Summary' {Maybe Integer
Maybe Text
Maybe TargetIdType
targetIdType :: Maybe TargetIdType
targetId :: Maybe Text
resourceType :: Maybe Text
region :: Maybe Text
nonCompliantResources :: Maybe Integer
lastUpdated :: Maybe Text
$sel:targetIdType:Summary' :: Summary -> Maybe TargetIdType
$sel:targetId:Summary' :: Summary -> Maybe Text
$sel:resourceType:Summary' :: Summary -> Maybe Text
$sel:region:Summary' :: Summary -> Maybe Text
$sel:nonCompliantResources:Summary' :: Summary -> Maybe Integer
$sel:lastUpdated:Summary' :: Summary -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
lastUpdated
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
nonCompliantResources
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
region
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
resourceType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
targetId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe TargetIdType
targetIdType

instance Prelude.NFData Summary where
  rnf :: Summary -> ()
rnf Summary' {Maybe Integer
Maybe Text
Maybe TargetIdType
targetIdType :: Maybe TargetIdType
targetId :: Maybe Text
resourceType :: Maybe Text
region :: Maybe Text
nonCompliantResources :: Maybe Integer
lastUpdated :: Maybe Text
$sel:targetIdType:Summary' :: Summary -> Maybe TargetIdType
$sel:targetId:Summary' :: Summary -> Maybe Text
$sel:resourceType:Summary' :: Summary -> Maybe Text
$sel:region:Summary' :: Summary -> Maybe Text
$sel:nonCompliantResources:Summary' :: Summary -> Maybe Integer
$sel:lastUpdated:Summary' :: Summary -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
lastUpdated
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
nonCompliantResources
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
region
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
resourceType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
targetId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe TargetIdType
targetIdType