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

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

-- | Details about the account that was not processed.
--
-- /See:/ 'newResult' smart constructor.
data Result = Result'
  { -- | An Amazon Web Services account ID of the account that was not processed.
    Result -> Maybe Text
accountId :: Prelude.Maybe Prelude.Text,
    -- | The reason that the account was not processed.
    Result -> Maybe Text
processingResult :: Prelude.Maybe Prelude.Text
  }
  deriving (Result -> Result -> Bool
(Result -> Result -> Bool)
-> (Result -> Result -> Bool) -> Eq Result
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Result -> Result -> Bool
$c/= :: Result -> Result -> Bool
== :: Result -> Result -> Bool
$c== :: Result -> Result -> Bool
Prelude.Eq, ReadPrec [Result]
ReadPrec Result
Int -> ReadS Result
ReadS [Result]
(Int -> ReadS Result)
-> ReadS [Result]
-> ReadPrec Result
-> ReadPrec [Result]
-> Read Result
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Result]
$creadListPrec :: ReadPrec [Result]
readPrec :: ReadPrec Result
$creadPrec :: ReadPrec Result
readList :: ReadS [Result]
$creadList :: ReadS [Result]
readsPrec :: Int -> ReadS Result
$creadsPrec :: Int -> ReadS Result
Prelude.Read, Int -> Result -> ShowS
[Result] -> ShowS
Result -> String
(Int -> Result -> ShowS)
-> (Result -> String) -> ([Result] -> ShowS) -> Show Result
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Result] -> ShowS
$cshowList :: [Result] -> ShowS
show :: Result -> String
$cshow :: Result -> String
showsPrec :: Int -> Result -> ShowS
$cshowsPrec :: Int -> Result -> ShowS
Prelude.Show, (forall x. Result -> Rep Result x)
-> (forall x. Rep Result x -> Result) -> Generic Result
forall x. Rep Result x -> Result
forall x. Result -> Rep Result x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Result x -> Result
$cfrom :: forall x. Result -> Rep Result x
Prelude.Generic)

-- |
-- Create a value of 'Result' 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:
--
-- 'accountId', 'result_accountId' - An Amazon Web Services account ID of the account that was not processed.
--
-- 'processingResult', 'result_processingResult' - The reason that the account was not processed.
newResult ::
  Result
newResult :: Result
newResult =
  Result' :: Maybe Text -> Maybe Text -> Result
Result'
    { $sel:accountId:Result' :: Maybe Text
accountId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:processingResult:Result' :: Maybe Text
processingResult = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | An Amazon Web Services account ID of the account that was not processed.
result_accountId :: Lens.Lens' Result (Prelude.Maybe Prelude.Text)
result_accountId :: (Maybe Text -> f (Maybe Text)) -> Result -> f Result
result_accountId = (Result -> Maybe Text)
-> (Result -> Maybe Text -> Result)
-> Lens Result Result (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Result' {Maybe Text
accountId :: Maybe Text
$sel:accountId:Result' :: Result -> Maybe Text
accountId} -> Maybe Text
accountId) (\s :: Result
s@Result' {} Maybe Text
a -> Result
s {$sel:accountId:Result' :: Maybe Text
accountId = Maybe Text
a} :: Result)

-- | The reason that the account was not processed.
result_processingResult :: Lens.Lens' Result (Prelude.Maybe Prelude.Text)
result_processingResult :: (Maybe Text -> f (Maybe Text)) -> Result -> f Result
result_processingResult = (Result -> Maybe Text)
-> (Result -> Maybe Text -> Result)
-> Lens Result Result (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Result' {Maybe Text
processingResult :: Maybe Text
$sel:processingResult:Result' :: Result -> Maybe Text
processingResult} -> Maybe Text
processingResult) (\s :: Result
s@Result' {} Maybe Text
a -> Result
s {$sel:processingResult:Result' :: Maybe Text
processingResult = Maybe Text
a} :: Result)

instance Core.FromJSON Result where
  parseJSON :: Value -> Parser Result
parseJSON =
    String -> (Object -> Parser Result) -> Value -> Parser Result
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Result"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> Result
Result'
            (Maybe Text -> Maybe Text -> Result)
-> Parser (Maybe Text) -> Parser (Maybe Text -> Result)
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
"AccountId")
            Parser (Maybe Text -> Result)
-> Parser (Maybe Text) -> Parser Result
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
"ProcessingResult")
      )

instance Prelude.Hashable Result

instance Prelude.NFData Result