{-# 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.IoT.Types.NonCompliantResource
-- 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.IoT.Types.NonCompliantResource where

import qualified Amazonka.Core as Core
import Amazonka.IoT.Types.ResourceIdentifier
import Amazonka.IoT.Types.ResourceType
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Information about the resource that was noncompliant with the audit
-- check.
--
-- /See:/ 'newNonCompliantResource' smart constructor.
data NonCompliantResource = NonCompliantResource'
  { -- | Other information about the noncompliant resource.
    NonCompliantResource -> Maybe (HashMap Text Text)
additionalInfo :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The type of the noncompliant resource.
    NonCompliantResource -> Maybe ResourceType
resourceType :: Prelude.Maybe ResourceType,
    -- | Information that identifies the noncompliant resource.
    NonCompliantResource -> Maybe ResourceIdentifier
resourceIdentifier :: Prelude.Maybe ResourceIdentifier
  }
  deriving (NonCompliantResource -> NonCompliantResource -> Bool
(NonCompliantResource -> NonCompliantResource -> Bool)
-> (NonCompliantResource -> NonCompliantResource -> Bool)
-> Eq NonCompliantResource
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NonCompliantResource -> NonCompliantResource -> Bool
$c/= :: NonCompliantResource -> NonCompliantResource -> Bool
== :: NonCompliantResource -> NonCompliantResource -> Bool
$c== :: NonCompliantResource -> NonCompliantResource -> Bool
Prelude.Eq, ReadPrec [NonCompliantResource]
ReadPrec NonCompliantResource
Int -> ReadS NonCompliantResource
ReadS [NonCompliantResource]
(Int -> ReadS NonCompliantResource)
-> ReadS [NonCompliantResource]
-> ReadPrec NonCompliantResource
-> ReadPrec [NonCompliantResource]
-> Read NonCompliantResource
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NonCompliantResource]
$creadListPrec :: ReadPrec [NonCompliantResource]
readPrec :: ReadPrec NonCompliantResource
$creadPrec :: ReadPrec NonCompliantResource
readList :: ReadS [NonCompliantResource]
$creadList :: ReadS [NonCompliantResource]
readsPrec :: Int -> ReadS NonCompliantResource
$creadsPrec :: Int -> ReadS NonCompliantResource
Prelude.Read, Int -> NonCompliantResource -> ShowS
[NonCompliantResource] -> ShowS
NonCompliantResource -> String
(Int -> NonCompliantResource -> ShowS)
-> (NonCompliantResource -> String)
-> ([NonCompliantResource] -> ShowS)
-> Show NonCompliantResource
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NonCompliantResource] -> ShowS
$cshowList :: [NonCompliantResource] -> ShowS
show :: NonCompliantResource -> String
$cshow :: NonCompliantResource -> String
showsPrec :: Int -> NonCompliantResource -> ShowS
$cshowsPrec :: Int -> NonCompliantResource -> ShowS
Prelude.Show, (forall x. NonCompliantResource -> Rep NonCompliantResource x)
-> (forall x. Rep NonCompliantResource x -> NonCompliantResource)
-> Generic NonCompliantResource
forall x. Rep NonCompliantResource x -> NonCompliantResource
forall x. NonCompliantResource -> Rep NonCompliantResource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep NonCompliantResource x -> NonCompliantResource
$cfrom :: forall x. NonCompliantResource -> Rep NonCompliantResource x
Prelude.Generic)

-- |
-- Create a value of 'NonCompliantResource' 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:
--
-- 'additionalInfo', 'nonCompliantResource_additionalInfo' - Other information about the noncompliant resource.
--
-- 'resourceType', 'nonCompliantResource_resourceType' - The type of the noncompliant resource.
--
-- 'resourceIdentifier', 'nonCompliantResource_resourceIdentifier' - Information that identifies the noncompliant resource.
newNonCompliantResource ::
  NonCompliantResource
newNonCompliantResource :: NonCompliantResource
newNonCompliantResource =
  NonCompliantResource' :: Maybe (HashMap Text Text)
-> Maybe ResourceType
-> Maybe ResourceIdentifier
-> NonCompliantResource
NonCompliantResource'
    { $sel:additionalInfo:NonCompliantResource' :: Maybe (HashMap Text Text)
additionalInfo =
        Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:resourceType:NonCompliantResource' :: Maybe ResourceType
resourceType = Maybe ResourceType
forall a. Maybe a
Prelude.Nothing,
      $sel:resourceIdentifier:NonCompliantResource' :: Maybe ResourceIdentifier
resourceIdentifier = Maybe ResourceIdentifier
forall a. Maybe a
Prelude.Nothing
    }

-- | Other information about the noncompliant resource.
nonCompliantResource_additionalInfo :: Lens.Lens' NonCompliantResource (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
nonCompliantResource_additionalInfo :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> NonCompliantResource -> f NonCompliantResource
nonCompliantResource_additionalInfo = (NonCompliantResource -> Maybe (HashMap Text Text))
-> (NonCompliantResource
    -> Maybe (HashMap Text Text) -> NonCompliantResource)
-> Lens
     NonCompliantResource
     NonCompliantResource
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NonCompliantResource' {Maybe (HashMap Text Text)
additionalInfo :: Maybe (HashMap Text Text)
$sel:additionalInfo:NonCompliantResource' :: NonCompliantResource -> Maybe (HashMap Text Text)
additionalInfo} -> Maybe (HashMap Text Text)
additionalInfo) (\s :: NonCompliantResource
s@NonCompliantResource' {} Maybe (HashMap Text Text)
a -> NonCompliantResource
s {$sel:additionalInfo:NonCompliantResource' :: Maybe (HashMap Text Text)
additionalInfo = Maybe (HashMap Text Text)
a} :: NonCompliantResource) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> NonCompliantResource -> f NonCompliantResource)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> NonCompliantResource
-> f NonCompliantResource
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text 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
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The type of the noncompliant resource.
nonCompliantResource_resourceType :: Lens.Lens' NonCompliantResource (Prelude.Maybe ResourceType)
nonCompliantResource_resourceType :: (Maybe ResourceType -> f (Maybe ResourceType))
-> NonCompliantResource -> f NonCompliantResource
nonCompliantResource_resourceType = (NonCompliantResource -> Maybe ResourceType)
-> (NonCompliantResource
    -> Maybe ResourceType -> NonCompliantResource)
-> Lens
     NonCompliantResource
     NonCompliantResource
     (Maybe ResourceType)
     (Maybe ResourceType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NonCompliantResource' {Maybe ResourceType
resourceType :: Maybe ResourceType
$sel:resourceType:NonCompliantResource' :: NonCompliantResource -> Maybe ResourceType
resourceType} -> Maybe ResourceType
resourceType) (\s :: NonCompliantResource
s@NonCompliantResource' {} Maybe ResourceType
a -> NonCompliantResource
s {$sel:resourceType:NonCompliantResource' :: Maybe ResourceType
resourceType = Maybe ResourceType
a} :: NonCompliantResource)

-- | Information that identifies the noncompliant resource.
nonCompliantResource_resourceIdentifier :: Lens.Lens' NonCompliantResource (Prelude.Maybe ResourceIdentifier)
nonCompliantResource_resourceIdentifier :: (Maybe ResourceIdentifier -> f (Maybe ResourceIdentifier))
-> NonCompliantResource -> f NonCompliantResource
nonCompliantResource_resourceIdentifier = (NonCompliantResource -> Maybe ResourceIdentifier)
-> (NonCompliantResource
    -> Maybe ResourceIdentifier -> NonCompliantResource)
-> Lens
     NonCompliantResource
     NonCompliantResource
     (Maybe ResourceIdentifier)
     (Maybe ResourceIdentifier)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NonCompliantResource' {Maybe ResourceIdentifier
resourceIdentifier :: Maybe ResourceIdentifier
$sel:resourceIdentifier:NonCompliantResource' :: NonCompliantResource -> Maybe ResourceIdentifier
resourceIdentifier} -> Maybe ResourceIdentifier
resourceIdentifier) (\s :: NonCompliantResource
s@NonCompliantResource' {} Maybe ResourceIdentifier
a -> NonCompliantResource
s {$sel:resourceIdentifier:NonCompliantResource' :: Maybe ResourceIdentifier
resourceIdentifier = Maybe ResourceIdentifier
a} :: NonCompliantResource)

instance Core.FromJSON NonCompliantResource where
  parseJSON :: Value -> Parser NonCompliantResource
parseJSON =
    String
-> (Object -> Parser NonCompliantResource)
-> Value
-> Parser NonCompliantResource
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"NonCompliantResource"
      ( \Object
x ->
          Maybe (HashMap Text Text)
-> Maybe ResourceType
-> Maybe ResourceIdentifier
-> NonCompliantResource
NonCompliantResource'
            (Maybe (HashMap Text Text)
 -> Maybe ResourceType
 -> Maybe ResourceIdentifier
 -> NonCompliantResource)
-> Parser (Maybe (HashMap Text Text))
-> Parser
     (Maybe ResourceType
      -> Maybe ResourceIdentifier -> NonCompliantResource)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Maybe (HashMap Text Text)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"additionalInfo" Parser (Maybe (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> Parser (Maybe (HashMap Text Text))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text Text)
forall a. Monoid a => a
Prelude.mempty)
            Parser
  (Maybe ResourceType
   -> Maybe ResourceIdentifier -> NonCompliantResource)
-> Parser (Maybe ResourceType)
-> Parser (Maybe ResourceIdentifier -> NonCompliantResource)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ResourceType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"resourceType")
            Parser (Maybe ResourceIdentifier -> NonCompliantResource)
-> Parser (Maybe ResourceIdentifier) -> Parser NonCompliantResource
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ResourceIdentifier)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"resourceIdentifier")
      )

instance Prelude.Hashable NonCompliantResource

instance Prelude.NFData NonCompliantResource