{-# 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-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.ResourceGroupsTagging.Types.Summary where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.ResourceGroupsTagging.Types.TargetIdType

-- | A count of noncompliant resources.
--
-- /See:/ 'newSummary' smart constructor.
data Summary = Summary'
  { -- | The account identifier or the root identifier of the organization. If
    -- you don\'t know the root ID, you can call the AWS Organizations
    -- <http://docs.aws.amazon.com/organizations/latest/APIReference/API_ListRoots.html ListRoots>
    -- API.
    Summary -> Maybe Text
targetId :: Prelude.Maybe Prelude.Text,
    -- | The timestamp that shows when this summary was generated in this Region.
    Summary -> Maybe Text
lastUpdated :: Prelude.Maybe Prelude.Text,
    -- | The AWS resource type.
    Summary -> Maybe Text
resourceType :: Prelude.Maybe Prelude.Text,
    -- | The count of noncompliant resources.
    Summary -> Maybe Integer
nonCompliantResources :: Prelude.Maybe Prelude.Integer,
    -- | Whether the target is an account, an OU, or the organization root.
    Summary -> Maybe TargetIdType
targetIdType :: Prelude.Maybe TargetIdType,
    -- | The AWS Region that the summary applies to.
    Summary -> Maybe Text
region :: Prelude.Maybe Prelude.Text
  }
  deriving (Summary -> Summary -> Bool
(Summary -> Summary -> Bool)
-> (Summary -> Summary -> Bool) -> Eq Summary
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]
(Int -> ReadS Summary)
-> ReadS [Summary]
-> ReadPrec Summary
-> ReadPrec [Summary]
-> Read 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
(Int -> Summary -> ShowS)
-> (Summary -> String) -> ([Summary] -> ShowS) -> Show Summary
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. Summary -> Rep Summary x)
-> (forall x. Rep Summary x -> Summary) -> Generic Summary
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:
--
-- '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 AWS Organizations
-- <http://docs.aws.amazon.com/organizations/latest/APIReference/API_ListRoots.html ListRoots>
-- API.
--
-- 'lastUpdated', 'summary_lastUpdated' - The timestamp that shows when this summary was generated in this Region.
--
-- 'resourceType', 'summary_resourceType' - The AWS resource type.
--
-- 'nonCompliantResources', 'summary_nonCompliantResources' - The count of noncompliant resources.
--
-- 'targetIdType', 'summary_targetIdType' - Whether the target is an account, an OU, or the organization root.
--
-- 'region', 'summary_region' - The AWS Region that the summary applies to.
newSummary ::
  Summary
newSummary :: Summary
newSummary =
  Summary' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Integer
-> Maybe TargetIdType
-> Maybe Text
-> Summary
Summary'
    { $sel:targetId:Summary' :: Maybe Text
targetId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:lastUpdated:Summary' :: Maybe Text
lastUpdated = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:resourceType:Summary' :: Maybe Text
resourceType = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:nonCompliantResources:Summary' :: Maybe Integer
nonCompliantResources = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:targetIdType:Summary' :: Maybe TargetIdType
targetIdType = Maybe TargetIdType
forall a. Maybe a
Prelude.Nothing,
      $sel:region:Summary' :: Maybe Text
region = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The account identifier or the root identifier of the organization. If
-- you don\'t know the root ID, you can call the AWS Organizations
-- <http://docs.aws.amazon.com/organizations/latest/APIReference/API_ListRoots.html ListRoots>
-- API.
summary_targetId :: Lens.Lens' Summary (Prelude.Maybe Prelude.Text)
summary_targetId :: (Maybe Text -> f (Maybe Text)) -> Summary -> f Summary
summary_targetId = (Summary -> Maybe Text)
-> (Summary -> Maybe Text -> Summary)
-> Lens Summary Summary (Maybe Text) (Maybe Text)
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)

-- | The timestamp that shows when this summary was generated in this Region.
summary_lastUpdated :: Lens.Lens' Summary (Prelude.Maybe Prelude.Text)
summary_lastUpdated :: (Maybe Text -> f (Maybe Text)) -> Summary -> f Summary
summary_lastUpdated = (Summary -> Maybe Text)
-> (Summary -> Maybe Text -> Summary)
-> Lens Summary Summary (Maybe Text) (Maybe Text)
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 AWS resource type.
summary_resourceType :: Lens.Lens' Summary (Prelude.Maybe Prelude.Text)
summary_resourceType :: (Maybe Text -> f (Maybe Text)) -> Summary -> f Summary
summary_resourceType = (Summary -> Maybe Text)
-> (Summary -> Maybe Text -> Summary)
-> Lens Summary Summary (Maybe Text) (Maybe Text)
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 count of noncompliant resources.
summary_nonCompliantResources :: Lens.Lens' Summary (Prelude.Maybe Prelude.Integer)
summary_nonCompliantResources :: (Maybe Integer -> f (Maybe Integer)) -> Summary -> f Summary
summary_nonCompliantResources = (Summary -> Maybe Integer)
-> (Summary -> Maybe Integer -> Summary)
-> Lens Summary Summary (Maybe Integer) (Maybe Integer)
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)

-- | Whether the target is an account, an OU, or the organization root.
summary_targetIdType :: Lens.Lens' Summary (Prelude.Maybe TargetIdType)
summary_targetIdType :: (Maybe TargetIdType -> f (Maybe TargetIdType))
-> Summary -> f Summary
summary_targetIdType = (Summary -> Maybe TargetIdType)
-> (Summary -> Maybe TargetIdType -> Summary)
-> Lens Summary Summary (Maybe TargetIdType) (Maybe 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)

-- | The AWS Region that the summary applies to.
summary_region :: Lens.Lens' Summary (Prelude.Maybe Prelude.Text)
summary_region :: (Maybe Text -> f (Maybe Text)) -> Summary -> f Summary
summary_region = (Summary -> Maybe Text)
-> (Summary -> Maybe Text -> Summary)
-> Lens Summary Summary (Maybe Text) (Maybe Text)
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)

instance Core.FromJSON Summary where
  parseJSON :: Value -> Parser Summary
parseJSON =
    String -> (Object -> Parser Summary) -> Value -> Parser Summary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Summary"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Integer
-> Maybe TargetIdType
-> Maybe Text
-> Summary
Summary'
            (Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Integer
 -> Maybe TargetIdType
 -> Maybe Text
 -> Summary)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Integer
      -> Maybe TargetIdType
      -> Maybe Text
      -> Summary)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"TargetId")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Integer
   -> Maybe TargetIdType
   -> Maybe Text
   -> Summary)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Integer -> Maybe TargetIdType -> Maybe Text -> Summary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"LastUpdated")
            Parser
  (Maybe Text
   -> Maybe Integer -> Maybe TargetIdType -> Maybe Text -> Summary)
-> Parser (Maybe Text)
-> Parser
     (Maybe Integer -> Maybe TargetIdType -> Maybe Text -> Summary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ResourceType")
            Parser
  (Maybe Integer -> Maybe TargetIdType -> Maybe Text -> Summary)
-> Parser (Maybe Integer)
-> Parser (Maybe TargetIdType -> Maybe Text -> Summary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"NonCompliantResources")
            Parser (Maybe TargetIdType -> Maybe Text -> Summary)
-> Parser (Maybe TargetIdType) -> Parser (Maybe Text -> Summary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe TargetIdType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"TargetIdType")
            Parser (Maybe Text -> Summary)
-> Parser (Maybe Text) -> Parser Summary
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Region")
      )

instance Prelude.Hashable Summary

instance Prelude.NFData Summary