{-# 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.ComplianceDetails
-- 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.ComplianceDetails where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Information that shows whether a resource is compliant with the
-- effective tag policy, including details on any noncompliant tag keys.
--
-- /See:/ 'newComplianceDetails' smart constructor.
data ComplianceDetails = ComplianceDetails'
  { -- | These are keys defined in the effective policy that are on the resource
    -- with either incorrect case treatment or noncompliant values.
    ComplianceDetails -> Maybe [Text]
keysWithNoncompliantValues :: Prelude.Maybe [Prelude.Text],
    -- | Whether a resource is compliant with the effective tag policy.
    ComplianceDetails -> Maybe Bool
complianceStatus :: Prelude.Maybe Prelude.Bool,
    -- | These tag keys on the resource are noncompliant with the effective tag
    -- policy.
    ComplianceDetails -> Maybe [Text]
noncompliantKeys :: Prelude.Maybe [Prelude.Text]
  }
  deriving (ComplianceDetails -> ComplianceDetails -> Bool
(ComplianceDetails -> ComplianceDetails -> Bool)
-> (ComplianceDetails -> ComplianceDetails -> Bool)
-> Eq ComplianceDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ComplianceDetails -> ComplianceDetails -> Bool
$c/= :: ComplianceDetails -> ComplianceDetails -> Bool
== :: ComplianceDetails -> ComplianceDetails -> Bool
$c== :: ComplianceDetails -> ComplianceDetails -> Bool
Prelude.Eq, ReadPrec [ComplianceDetails]
ReadPrec ComplianceDetails
Int -> ReadS ComplianceDetails
ReadS [ComplianceDetails]
(Int -> ReadS ComplianceDetails)
-> ReadS [ComplianceDetails]
-> ReadPrec ComplianceDetails
-> ReadPrec [ComplianceDetails]
-> Read ComplianceDetails
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ComplianceDetails]
$creadListPrec :: ReadPrec [ComplianceDetails]
readPrec :: ReadPrec ComplianceDetails
$creadPrec :: ReadPrec ComplianceDetails
readList :: ReadS [ComplianceDetails]
$creadList :: ReadS [ComplianceDetails]
readsPrec :: Int -> ReadS ComplianceDetails
$creadsPrec :: Int -> ReadS ComplianceDetails
Prelude.Read, Int -> ComplianceDetails -> ShowS
[ComplianceDetails] -> ShowS
ComplianceDetails -> String
(Int -> ComplianceDetails -> ShowS)
-> (ComplianceDetails -> String)
-> ([ComplianceDetails] -> ShowS)
-> Show ComplianceDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ComplianceDetails] -> ShowS
$cshowList :: [ComplianceDetails] -> ShowS
show :: ComplianceDetails -> String
$cshow :: ComplianceDetails -> String
showsPrec :: Int -> ComplianceDetails -> ShowS
$cshowsPrec :: Int -> ComplianceDetails -> ShowS
Prelude.Show, (forall x. ComplianceDetails -> Rep ComplianceDetails x)
-> (forall x. Rep ComplianceDetails x -> ComplianceDetails)
-> Generic ComplianceDetails
forall x. Rep ComplianceDetails x -> ComplianceDetails
forall x. ComplianceDetails -> Rep ComplianceDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ComplianceDetails x -> ComplianceDetails
$cfrom :: forall x. ComplianceDetails -> Rep ComplianceDetails x
Prelude.Generic)

-- |
-- Create a value of 'ComplianceDetails' 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:
--
-- 'keysWithNoncompliantValues', 'complianceDetails_keysWithNoncompliantValues' - These are keys defined in the effective policy that are on the resource
-- with either incorrect case treatment or noncompliant values.
--
-- 'complianceStatus', 'complianceDetails_complianceStatus' - Whether a resource is compliant with the effective tag policy.
--
-- 'noncompliantKeys', 'complianceDetails_noncompliantKeys' - These tag keys on the resource are noncompliant with the effective tag
-- policy.
newComplianceDetails ::
  ComplianceDetails
newComplianceDetails :: ComplianceDetails
newComplianceDetails =
  ComplianceDetails' :: Maybe [Text] -> Maybe Bool -> Maybe [Text] -> ComplianceDetails
ComplianceDetails'
    { $sel:keysWithNoncompliantValues:ComplianceDetails' :: Maybe [Text]
keysWithNoncompliantValues =
        Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:complianceStatus:ComplianceDetails' :: Maybe Bool
complianceStatus = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:noncompliantKeys:ComplianceDetails' :: Maybe [Text]
noncompliantKeys = Maybe [Text]
forall a. Maybe a
Prelude.Nothing
    }

-- | These are keys defined in the effective policy that are on the resource
-- with either incorrect case treatment or noncompliant values.
complianceDetails_keysWithNoncompliantValues :: Lens.Lens' ComplianceDetails (Prelude.Maybe [Prelude.Text])
complianceDetails_keysWithNoncompliantValues :: (Maybe [Text] -> f (Maybe [Text]))
-> ComplianceDetails -> f ComplianceDetails
complianceDetails_keysWithNoncompliantValues = (ComplianceDetails -> Maybe [Text])
-> (ComplianceDetails -> Maybe [Text] -> ComplianceDetails)
-> Lens
     ComplianceDetails ComplianceDetails (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ComplianceDetails' {Maybe [Text]
keysWithNoncompliantValues :: Maybe [Text]
$sel:keysWithNoncompliantValues:ComplianceDetails' :: ComplianceDetails -> Maybe [Text]
keysWithNoncompliantValues} -> Maybe [Text]
keysWithNoncompliantValues) (\s :: ComplianceDetails
s@ComplianceDetails' {} Maybe [Text]
a -> ComplianceDetails
s {$sel:keysWithNoncompliantValues:ComplianceDetails' :: Maybe [Text]
keysWithNoncompliantValues = Maybe [Text]
a} :: ComplianceDetails) ((Maybe [Text] -> f (Maybe [Text]))
 -> ComplianceDetails -> f ComplianceDetails)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> ComplianceDetails
-> f ComplianceDetails
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 AnIso [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Whether a resource is compliant with the effective tag policy.
complianceDetails_complianceStatus :: Lens.Lens' ComplianceDetails (Prelude.Maybe Prelude.Bool)
complianceDetails_complianceStatus :: (Maybe Bool -> f (Maybe Bool))
-> ComplianceDetails -> f ComplianceDetails
complianceDetails_complianceStatus = (ComplianceDetails -> Maybe Bool)
-> (ComplianceDetails -> Maybe Bool -> ComplianceDetails)
-> Lens
     ComplianceDetails ComplianceDetails (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ComplianceDetails' {Maybe Bool
complianceStatus :: Maybe Bool
$sel:complianceStatus:ComplianceDetails' :: ComplianceDetails -> Maybe Bool
complianceStatus} -> Maybe Bool
complianceStatus) (\s :: ComplianceDetails
s@ComplianceDetails' {} Maybe Bool
a -> ComplianceDetails
s {$sel:complianceStatus:ComplianceDetails' :: Maybe Bool
complianceStatus = Maybe Bool
a} :: ComplianceDetails)

-- | These tag keys on the resource are noncompliant with the effective tag
-- policy.
complianceDetails_noncompliantKeys :: Lens.Lens' ComplianceDetails (Prelude.Maybe [Prelude.Text])
complianceDetails_noncompliantKeys :: (Maybe [Text] -> f (Maybe [Text]))
-> ComplianceDetails -> f ComplianceDetails
complianceDetails_noncompliantKeys = (ComplianceDetails -> Maybe [Text])
-> (ComplianceDetails -> Maybe [Text] -> ComplianceDetails)
-> Lens
     ComplianceDetails ComplianceDetails (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ComplianceDetails' {Maybe [Text]
noncompliantKeys :: Maybe [Text]
$sel:noncompliantKeys:ComplianceDetails' :: ComplianceDetails -> Maybe [Text]
noncompliantKeys} -> Maybe [Text]
noncompliantKeys) (\s :: ComplianceDetails
s@ComplianceDetails' {} Maybe [Text]
a -> ComplianceDetails
s {$sel:noncompliantKeys:ComplianceDetails' :: Maybe [Text]
noncompliantKeys = Maybe [Text]
a} :: ComplianceDetails) ((Maybe [Text] -> f (Maybe [Text]))
 -> ComplianceDetails -> f ComplianceDetails)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> ComplianceDetails
-> f ComplianceDetails
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 AnIso [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON ComplianceDetails where
  parseJSON :: Value -> Parser ComplianceDetails
parseJSON =
    String
-> (Object -> Parser ComplianceDetails)
-> Value
-> Parser ComplianceDetails
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ComplianceDetails"
      ( \Object
x ->
          Maybe [Text] -> Maybe Bool -> Maybe [Text] -> ComplianceDetails
ComplianceDetails'
            (Maybe [Text] -> Maybe Bool -> Maybe [Text] -> ComplianceDetails)
-> Parser (Maybe [Text])
-> Parser (Maybe Bool -> Maybe [Text] -> ComplianceDetails)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"KeysWithNoncompliantValues"
                            Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser (Maybe Bool -> Maybe [Text] -> ComplianceDetails)
-> Parser (Maybe Bool)
-> Parser (Maybe [Text] -> ComplianceDetails)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ComplianceStatus")
            Parser (Maybe [Text] -> ComplianceDetails)
-> Parser (Maybe [Text]) -> Parser ComplianceDetails
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"NoncompliantKeys"
                            Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance Prelude.Hashable ComplianceDetails

instance Prelude.NFData ComplianceDetails