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

import qualified Amazonka.Core as Core
import Amazonka.IoT.Types.AuditTaskStatus
import Amazonka.IoT.Types.AuditTaskType
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The audits that were performed.
--
-- /See:/ 'newAuditTaskMetadata' smart constructor.
data AuditTaskMetadata = AuditTaskMetadata'
  { -- | The type of this audit. One of \"ON_DEMAND_AUDIT_TASK\" or
    -- \"SCHEDULED_AUDIT_TASK\".
    AuditTaskMetadata -> Maybe AuditTaskType
taskType :: Prelude.Maybe AuditTaskType,
    -- | The ID of this audit.
    AuditTaskMetadata -> Maybe Text
taskId :: Prelude.Maybe Prelude.Text,
    -- | The status of this audit. One of \"IN_PROGRESS\", \"COMPLETED\",
    -- \"FAILED\", or \"CANCELED\".
    AuditTaskMetadata -> Maybe AuditTaskStatus
taskStatus :: Prelude.Maybe AuditTaskStatus
  }
  deriving (AuditTaskMetadata -> AuditTaskMetadata -> Bool
(AuditTaskMetadata -> AuditTaskMetadata -> Bool)
-> (AuditTaskMetadata -> AuditTaskMetadata -> Bool)
-> Eq AuditTaskMetadata
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AuditTaskMetadata -> AuditTaskMetadata -> Bool
$c/= :: AuditTaskMetadata -> AuditTaskMetadata -> Bool
== :: AuditTaskMetadata -> AuditTaskMetadata -> Bool
$c== :: AuditTaskMetadata -> AuditTaskMetadata -> Bool
Prelude.Eq, ReadPrec [AuditTaskMetadata]
ReadPrec AuditTaskMetadata
Int -> ReadS AuditTaskMetadata
ReadS [AuditTaskMetadata]
(Int -> ReadS AuditTaskMetadata)
-> ReadS [AuditTaskMetadata]
-> ReadPrec AuditTaskMetadata
-> ReadPrec [AuditTaskMetadata]
-> Read AuditTaskMetadata
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AuditTaskMetadata]
$creadListPrec :: ReadPrec [AuditTaskMetadata]
readPrec :: ReadPrec AuditTaskMetadata
$creadPrec :: ReadPrec AuditTaskMetadata
readList :: ReadS [AuditTaskMetadata]
$creadList :: ReadS [AuditTaskMetadata]
readsPrec :: Int -> ReadS AuditTaskMetadata
$creadsPrec :: Int -> ReadS AuditTaskMetadata
Prelude.Read, Int -> AuditTaskMetadata -> ShowS
[AuditTaskMetadata] -> ShowS
AuditTaskMetadata -> String
(Int -> AuditTaskMetadata -> ShowS)
-> (AuditTaskMetadata -> String)
-> ([AuditTaskMetadata] -> ShowS)
-> Show AuditTaskMetadata
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AuditTaskMetadata] -> ShowS
$cshowList :: [AuditTaskMetadata] -> ShowS
show :: AuditTaskMetadata -> String
$cshow :: AuditTaskMetadata -> String
showsPrec :: Int -> AuditTaskMetadata -> ShowS
$cshowsPrec :: Int -> AuditTaskMetadata -> ShowS
Prelude.Show, (forall x. AuditTaskMetadata -> Rep AuditTaskMetadata x)
-> (forall x. Rep AuditTaskMetadata x -> AuditTaskMetadata)
-> Generic AuditTaskMetadata
forall x. Rep AuditTaskMetadata x -> AuditTaskMetadata
forall x. AuditTaskMetadata -> Rep AuditTaskMetadata x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AuditTaskMetadata x -> AuditTaskMetadata
$cfrom :: forall x. AuditTaskMetadata -> Rep AuditTaskMetadata x
Prelude.Generic)

-- |
-- Create a value of 'AuditTaskMetadata' 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:
--
-- 'taskType', 'auditTaskMetadata_taskType' - The type of this audit. One of \"ON_DEMAND_AUDIT_TASK\" or
-- \"SCHEDULED_AUDIT_TASK\".
--
-- 'taskId', 'auditTaskMetadata_taskId' - The ID of this audit.
--
-- 'taskStatus', 'auditTaskMetadata_taskStatus' - The status of this audit. One of \"IN_PROGRESS\", \"COMPLETED\",
-- \"FAILED\", or \"CANCELED\".
newAuditTaskMetadata ::
  AuditTaskMetadata
newAuditTaskMetadata :: AuditTaskMetadata
newAuditTaskMetadata =
  AuditTaskMetadata' :: Maybe AuditTaskType
-> Maybe Text -> Maybe AuditTaskStatus -> AuditTaskMetadata
AuditTaskMetadata'
    { $sel:taskType:AuditTaskMetadata' :: Maybe AuditTaskType
taskType = Maybe AuditTaskType
forall a. Maybe a
Prelude.Nothing,
      $sel:taskId:AuditTaskMetadata' :: Maybe Text
taskId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:taskStatus:AuditTaskMetadata' :: Maybe AuditTaskStatus
taskStatus = Maybe AuditTaskStatus
forall a. Maybe a
Prelude.Nothing
    }

-- | The type of this audit. One of \"ON_DEMAND_AUDIT_TASK\" or
-- \"SCHEDULED_AUDIT_TASK\".
auditTaskMetadata_taskType :: Lens.Lens' AuditTaskMetadata (Prelude.Maybe AuditTaskType)
auditTaskMetadata_taskType :: (Maybe AuditTaskType -> f (Maybe AuditTaskType))
-> AuditTaskMetadata -> f AuditTaskMetadata
auditTaskMetadata_taskType = (AuditTaskMetadata -> Maybe AuditTaskType)
-> (AuditTaskMetadata -> Maybe AuditTaskType -> AuditTaskMetadata)
-> Lens
     AuditTaskMetadata
     AuditTaskMetadata
     (Maybe AuditTaskType)
     (Maybe AuditTaskType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AuditTaskMetadata' {Maybe AuditTaskType
taskType :: Maybe AuditTaskType
$sel:taskType:AuditTaskMetadata' :: AuditTaskMetadata -> Maybe AuditTaskType
taskType} -> Maybe AuditTaskType
taskType) (\s :: AuditTaskMetadata
s@AuditTaskMetadata' {} Maybe AuditTaskType
a -> AuditTaskMetadata
s {$sel:taskType:AuditTaskMetadata' :: Maybe AuditTaskType
taskType = Maybe AuditTaskType
a} :: AuditTaskMetadata)

-- | The ID of this audit.
auditTaskMetadata_taskId :: Lens.Lens' AuditTaskMetadata (Prelude.Maybe Prelude.Text)
auditTaskMetadata_taskId :: (Maybe Text -> f (Maybe Text))
-> AuditTaskMetadata -> f AuditTaskMetadata
auditTaskMetadata_taskId = (AuditTaskMetadata -> Maybe Text)
-> (AuditTaskMetadata -> Maybe Text -> AuditTaskMetadata)
-> Lens
     AuditTaskMetadata AuditTaskMetadata (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AuditTaskMetadata' {Maybe Text
taskId :: Maybe Text
$sel:taskId:AuditTaskMetadata' :: AuditTaskMetadata -> Maybe Text
taskId} -> Maybe Text
taskId) (\s :: AuditTaskMetadata
s@AuditTaskMetadata' {} Maybe Text
a -> AuditTaskMetadata
s {$sel:taskId:AuditTaskMetadata' :: Maybe Text
taskId = Maybe Text
a} :: AuditTaskMetadata)

-- | The status of this audit. One of \"IN_PROGRESS\", \"COMPLETED\",
-- \"FAILED\", or \"CANCELED\".
auditTaskMetadata_taskStatus :: Lens.Lens' AuditTaskMetadata (Prelude.Maybe AuditTaskStatus)
auditTaskMetadata_taskStatus :: (Maybe AuditTaskStatus -> f (Maybe AuditTaskStatus))
-> AuditTaskMetadata -> f AuditTaskMetadata
auditTaskMetadata_taskStatus = (AuditTaskMetadata -> Maybe AuditTaskStatus)
-> (AuditTaskMetadata
    -> Maybe AuditTaskStatus -> AuditTaskMetadata)
-> Lens
     AuditTaskMetadata
     AuditTaskMetadata
     (Maybe AuditTaskStatus)
     (Maybe AuditTaskStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AuditTaskMetadata' {Maybe AuditTaskStatus
taskStatus :: Maybe AuditTaskStatus
$sel:taskStatus:AuditTaskMetadata' :: AuditTaskMetadata -> Maybe AuditTaskStatus
taskStatus} -> Maybe AuditTaskStatus
taskStatus) (\s :: AuditTaskMetadata
s@AuditTaskMetadata' {} Maybe AuditTaskStatus
a -> AuditTaskMetadata
s {$sel:taskStatus:AuditTaskMetadata' :: Maybe AuditTaskStatus
taskStatus = Maybe AuditTaskStatus
a} :: AuditTaskMetadata)

instance Core.FromJSON AuditTaskMetadata where
  parseJSON :: Value -> Parser AuditTaskMetadata
parseJSON =
    String
-> (Object -> Parser AuditTaskMetadata)
-> Value
-> Parser AuditTaskMetadata
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AuditTaskMetadata"
      ( \Object
x ->
          Maybe AuditTaskType
-> Maybe Text -> Maybe AuditTaskStatus -> AuditTaskMetadata
AuditTaskMetadata'
            (Maybe AuditTaskType
 -> Maybe Text -> Maybe AuditTaskStatus -> AuditTaskMetadata)
-> Parser (Maybe AuditTaskType)
-> Parser
     (Maybe Text -> Maybe AuditTaskStatus -> AuditTaskMetadata)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe AuditTaskType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"taskType")
            Parser (Maybe Text -> Maybe AuditTaskStatus -> AuditTaskMetadata)
-> Parser (Maybe Text)
-> Parser (Maybe AuditTaskStatus -> AuditTaskMetadata)
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
"taskId")
            Parser (Maybe AuditTaskStatus -> AuditTaskMetadata)
-> Parser (Maybe AuditTaskStatus) -> Parser AuditTaskMetadata
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe AuditTaskStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"taskStatus")
      )

instance Prelude.Hashable AuditTaskMetadata

instance Prelude.NFData AuditTaskMetadata