{-# 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.SecurityHub.Types.WorkflowUpdate
-- 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.SecurityHub.Types.WorkflowUpdate where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SecurityHub.Types.WorkflowStatus

-- | Used to update information about the investigation into the finding.
--
-- /See:/ 'newWorkflowUpdate' smart constructor.
data WorkflowUpdate = WorkflowUpdate'
  { -- | The status of the investigation into the finding. The workflow status is
    -- specific to an individual finding. It does not affect the generation of
    -- new findings. For example, setting the workflow status to @SUPPRESSED@
    -- or @RESOLVED@ does not prevent a new finding for the same issue.
    --
    -- The allowed values are the following.
    --
    -- -   @NEW@ - The initial state of a finding, before it is reviewed.
    --
    --     Security Hub also resets @WorkFlowStatus@ from @NOTIFIED@ or
    --     @RESOLVED@ to @NEW@ in the following cases:
    --
    --     -   The record state changes from @ARCHIVED@ to @ACTIVE@.
    --
    --     -   The compliance status changes from @PASSED@ to either @WARNING@,
    --         @FAILED@, or @NOT_AVAILABLE@.
    --
    -- -   @NOTIFIED@ - Indicates that you notified the resource owner about
    --     the security issue. Used when the initial reviewer is not the
    --     resource owner, and needs intervention from the resource owner.
    --
    -- -   @RESOLVED@ - The finding was reviewed and remediated and is now
    --     considered resolved.
    --
    -- -   @SUPPRESSED@ - Indicates that you reviewed the finding and do not
    --     believe that any action is needed. The finding is no longer updated.
    WorkflowUpdate -> Maybe WorkflowStatus
status :: Prelude.Maybe WorkflowStatus
  }
  deriving (WorkflowUpdate -> WorkflowUpdate -> Bool
(WorkflowUpdate -> WorkflowUpdate -> Bool)
-> (WorkflowUpdate -> WorkflowUpdate -> Bool) -> Eq WorkflowUpdate
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WorkflowUpdate -> WorkflowUpdate -> Bool
$c/= :: WorkflowUpdate -> WorkflowUpdate -> Bool
== :: WorkflowUpdate -> WorkflowUpdate -> Bool
$c== :: WorkflowUpdate -> WorkflowUpdate -> Bool
Prelude.Eq, ReadPrec [WorkflowUpdate]
ReadPrec WorkflowUpdate
Int -> ReadS WorkflowUpdate
ReadS [WorkflowUpdate]
(Int -> ReadS WorkflowUpdate)
-> ReadS [WorkflowUpdate]
-> ReadPrec WorkflowUpdate
-> ReadPrec [WorkflowUpdate]
-> Read WorkflowUpdate
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [WorkflowUpdate]
$creadListPrec :: ReadPrec [WorkflowUpdate]
readPrec :: ReadPrec WorkflowUpdate
$creadPrec :: ReadPrec WorkflowUpdate
readList :: ReadS [WorkflowUpdate]
$creadList :: ReadS [WorkflowUpdate]
readsPrec :: Int -> ReadS WorkflowUpdate
$creadsPrec :: Int -> ReadS WorkflowUpdate
Prelude.Read, Int -> WorkflowUpdate -> ShowS
[WorkflowUpdate] -> ShowS
WorkflowUpdate -> String
(Int -> WorkflowUpdate -> ShowS)
-> (WorkflowUpdate -> String)
-> ([WorkflowUpdate] -> ShowS)
-> Show WorkflowUpdate
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WorkflowUpdate] -> ShowS
$cshowList :: [WorkflowUpdate] -> ShowS
show :: WorkflowUpdate -> String
$cshow :: WorkflowUpdate -> String
showsPrec :: Int -> WorkflowUpdate -> ShowS
$cshowsPrec :: Int -> WorkflowUpdate -> ShowS
Prelude.Show, (forall x. WorkflowUpdate -> Rep WorkflowUpdate x)
-> (forall x. Rep WorkflowUpdate x -> WorkflowUpdate)
-> Generic WorkflowUpdate
forall x. Rep WorkflowUpdate x -> WorkflowUpdate
forall x. WorkflowUpdate -> Rep WorkflowUpdate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep WorkflowUpdate x -> WorkflowUpdate
$cfrom :: forall x. WorkflowUpdate -> Rep WorkflowUpdate x
Prelude.Generic)

-- |
-- Create a value of 'WorkflowUpdate' 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:
--
-- 'status', 'workflowUpdate_status' - The status of the investigation into the finding. The workflow status is
-- specific to an individual finding. It does not affect the generation of
-- new findings. For example, setting the workflow status to @SUPPRESSED@
-- or @RESOLVED@ does not prevent a new finding for the same issue.
--
-- The allowed values are the following.
--
-- -   @NEW@ - The initial state of a finding, before it is reviewed.
--
--     Security Hub also resets @WorkFlowStatus@ from @NOTIFIED@ or
--     @RESOLVED@ to @NEW@ in the following cases:
--
--     -   The record state changes from @ARCHIVED@ to @ACTIVE@.
--
--     -   The compliance status changes from @PASSED@ to either @WARNING@,
--         @FAILED@, or @NOT_AVAILABLE@.
--
-- -   @NOTIFIED@ - Indicates that you notified the resource owner about
--     the security issue. Used when the initial reviewer is not the
--     resource owner, and needs intervention from the resource owner.
--
-- -   @RESOLVED@ - The finding was reviewed and remediated and is now
--     considered resolved.
--
-- -   @SUPPRESSED@ - Indicates that you reviewed the finding and do not
--     believe that any action is needed. The finding is no longer updated.
newWorkflowUpdate ::
  WorkflowUpdate
newWorkflowUpdate :: WorkflowUpdate
newWorkflowUpdate =
  WorkflowUpdate' :: Maybe WorkflowStatus -> WorkflowUpdate
WorkflowUpdate' {$sel:status:WorkflowUpdate' :: Maybe WorkflowStatus
status = Maybe WorkflowStatus
forall a. Maybe a
Prelude.Nothing}

-- | The status of the investigation into the finding. The workflow status is
-- specific to an individual finding. It does not affect the generation of
-- new findings. For example, setting the workflow status to @SUPPRESSED@
-- or @RESOLVED@ does not prevent a new finding for the same issue.
--
-- The allowed values are the following.
--
-- -   @NEW@ - The initial state of a finding, before it is reviewed.
--
--     Security Hub also resets @WorkFlowStatus@ from @NOTIFIED@ or
--     @RESOLVED@ to @NEW@ in the following cases:
--
--     -   The record state changes from @ARCHIVED@ to @ACTIVE@.
--
--     -   The compliance status changes from @PASSED@ to either @WARNING@,
--         @FAILED@, or @NOT_AVAILABLE@.
--
-- -   @NOTIFIED@ - Indicates that you notified the resource owner about
--     the security issue. Used when the initial reviewer is not the
--     resource owner, and needs intervention from the resource owner.
--
-- -   @RESOLVED@ - The finding was reviewed and remediated and is now
--     considered resolved.
--
-- -   @SUPPRESSED@ - Indicates that you reviewed the finding and do not
--     believe that any action is needed. The finding is no longer updated.
workflowUpdate_status :: Lens.Lens' WorkflowUpdate (Prelude.Maybe WorkflowStatus)
workflowUpdate_status :: (Maybe WorkflowStatus -> f (Maybe WorkflowStatus))
-> WorkflowUpdate -> f WorkflowUpdate
workflowUpdate_status = (WorkflowUpdate -> Maybe WorkflowStatus)
-> (WorkflowUpdate -> Maybe WorkflowStatus -> WorkflowUpdate)
-> Lens
     WorkflowUpdate
     WorkflowUpdate
     (Maybe WorkflowStatus)
     (Maybe WorkflowStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkflowUpdate' {Maybe WorkflowStatus
status :: Maybe WorkflowStatus
$sel:status:WorkflowUpdate' :: WorkflowUpdate -> Maybe WorkflowStatus
status} -> Maybe WorkflowStatus
status) (\s :: WorkflowUpdate
s@WorkflowUpdate' {} Maybe WorkflowStatus
a -> WorkflowUpdate
s {$sel:status:WorkflowUpdate' :: Maybe WorkflowStatus
status = Maybe WorkflowStatus
a} :: WorkflowUpdate)

instance Prelude.Hashable WorkflowUpdate

instance Prelude.NFData WorkflowUpdate

instance Core.ToJSON WorkflowUpdate where
  toJSON :: WorkflowUpdate -> Value
toJSON WorkflowUpdate' {Maybe WorkflowStatus
status :: Maybe WorkflowStatus
$sel:status:WorkflowUpdate' :: WorkflowUpdate -> Maybe WorkflowStatus
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Text
"Status" Text -> WorkflowStatus -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (WorkflowStatus -> Pair) -> Maybe WorkflowStatus -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe WorkflowStatus
status]
      )