{-# 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.SMS.Types.ValidationOutput
-- 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.SMS.Types.ValidationOutput where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SMS.Types.AppValidationOutput
import Amazonka.SMS.Types.ServerValidationOutput
import Amazonka.SMS.Types.ValidationStatus

-- | Contains validation output.
--
-- /See:/ 'newValidationOutput' smart constructor.
data ValidationOutput = ValidationOutput'
  { -- | The status of the validation.
    ValidationOutput -> Maybe ValidationStatus
status :: Prelude.Maybe ValidationStatus,
    -- | The output from validating an application.
    ValidationOutput -> Maybe AppValidationOutput
appValidationOutput :: Prelude.Maybe AppValidationOutput,
    -- | The latest time that the validation was performed.
    ValidationOutput -> Maybe POSIX
latestValidationTime :: Prelude.Maybe Core.POSIX,
    -- | The name of the validation.
    ValidationOutput -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The status message.
    ValidationOutput -> Maybe Text
statusMessage :: Prelude.Maybe Prelude.Text,
    -- | The ID of the validation.
    ValidationOutput -> Maybe Text
validationId :: Prelude.Maybe Prelude.Text,
    -- | The output from validation an instance.
    ValidationOutput -> Maybe ServerValidationOutput
serverValidationOutput :: Prelude.Maybe ServerValidationOutput
  }
  deriving (ValidationOutput -> ValidationOutput -> Bool
(ValidationOutput -> ValidationOutput -> Bool)
-> (ValidationOutput -> ValidationOutput -> Bool)
-> Eq ValidationOutput
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ValidationOutput -> ValidationOutput -> Bool
$c/= :: ValidationOutput -> ValidationOutput -> Bool
== :: ValidationOutput -> ValidationOutput -> Bool
$c== :: ValidationOutput -> ValidationOutput -> Bool
Prelude.Eq, ReadPrec [ValidationOutput]
ReadPrec ValidationOutput
Int -> ReadS ValidationOutput
ReadS [ValidationOutput]
(Int -> ReadS ValidationOutput)
-> ReadS [ValidationOutput]
-> ReadPrec ValidationOutput
-> ReadPrec [ValidationOutput]
-> Read ValidationOutput
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ValidationOutput]
$creadListPrec :: ReadPrec [ValidationOutput]
readPrec :: ReadPrec ValidationOutput
$creadPrec :: ReadPrec ValidationOutput
readList :: ReadS [ValidationOutput]
$creadList :: ReadS [ValidationOutput]
readsPrec :: Int -> ReadS ValidationOutput
$creadsPrec :: Int -> ReadS ValidationOutput
Prelude.Read, Int -> ValidationOutput -> ShowS
[ValidationOutput] -> ShowS
ValidationOutput -> String
(Int -> ValidationOutput -> ShowS)
-> (ValidationOutput -> String)
-> ([ValidationOutput] -> ShowS)
-> Show ValidationOutput
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ValidationOutput] -> ShowS
$cshowList :: [ValidationOutput] -> ShowS
show :: ValidationOutput -> String
$cshow :: ValidationOutput -> String
showsPrec :: Int -> ValidationOutput -> ShowS
$cshowsPrec :: Int -> ValidationOutput -> ShowS
Prelude.Show, (forall x. ValidationOutput -> Rep ValidationOutput x)
-> (forall x. Rep ValidationOutput x -> ValidationOutput)
-> Generic ValidationOutput
forall x. Rep ValidationOutput x -> ValidationOutput
forall x. ValidationOutput -> Rep ValidationOutput x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ValidationOutput x -> ValidationOutput
$cfrom :: forall x. ValidationOutput -> Rep ValidationOutput x
Prelude.Generic)

-- |
-- Create a value of 'ValidationOutput' 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', 'validationOutput_status' - The status of the validation.
--
-- 'appValidationOutput', 'validationOutput_appValidationOutput' - The output from validating an application.
--
-- 'latestValidationTime', 'validationOutput_latestValidationTime' - The latest time that the validation was performed.
--
-- 'name', 'validationOutput_name' - The name of the validation.
--
-- 'statusMessage', 'validationOutput_statusMessage' - The status message.
--
-- 'validationId', 'validationOutput_validationId' - The ID of the validation.
--
-- 'serverValidationOutput', 'validationOutput_serverValidationOutput' - The output from validation an instance.
newValidationOutput ::
  ValidationOutput
newValidationOutput :: ValidationOutput
newValidationOutput =
  ValidationOutput' :: Maybe ValidationStatus
-> Maybe AppValidationOutput
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe ServerValidationOutput
-> ValidationOutput
ValidationOutput'
    { $sel:status:ValidationOutput' :: Maybe ValidationStatus
status = Maybe ValidationStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:appValidationOutput:ValidationOutput' :: Maybe AppValidationOutput
appValidationOutput = Maybe AppValidationOutput
forall a. Maybe a
Prelude.Nothing,
      $sel:latestValidationTime:ValidationOutput' :: Maybe POSIX
latestValidationTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:name:ValidationOutput' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:statusMessage:ValidationOutput' :: Maybe Text
statusMessage = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:validationId:ValidationOutput' :: Maybe Text
validationId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:serverValidationOutput:ValidationOutput' :: Maybe ServerValidationOutput
serverValidationOutput = Maybe ServerValidationOutput
forall a. Maybe a
Prelude.Nothing
    }

-- | The status of the validation.
validationOutput_status :: Lens.Lens' ValidationOutput (Prelude.Maybe ValidationStatus)
validationOutput_status :: (Maybe ValidationStatus -> f (Maybe ValidationStatus))
-> ValidationOutput -> f ValidationOutput
validationOutput_status = (ValidationOutput -> Maybe ValidationStatus)
-> (ValidationOutput -> Maybe ValidationStatus -> ValidationOutput)
-> Lens
     ValidationOutput
     ValidationOutput
     (Maybe ValidationStatus)
     (Maybe ValidationStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ValidationOutput' {Maybe ValidationStatus
status :: Maybe ValidationStatus
$sel:status:ValidationOutput' :: ValidationOutput -> Maybe ValidationStatus
status} -> Maybe ValidationStatus
status) (\s :: ValidationOutput
s@ValidationOutput' {} Maybe ValidationStatus
a -> ValidationOutput
s {$sel:status:ValidationOutput' :: Maybe ValidationStatus
status = Maybe ValidationStatus
a} :: ValidationOutput)

-- | The output from validating an application.
validationOutput_appValidationOutput :: Lens.Lens' ValidationOutput (Prelude.Maybe AppValidationOutput)
validationOutput_appValidationOutput :: (Maybe AppValidationOutput -> f (Maybe AppValidationOutput))
-> ValidationOutput -> f ValidationOutput
validationOutput_appValidationOutput = (ValidationOutput -> Maybe AppValidationOutput)
-> (ValidationOutput
    -> Maybe AppValidationOutput -> ValidationOutput)
-> Lens
     ValidationOutput
     ValidationOutput
     (Maybe AppValidationOutput)
     (Maybe AppValidationOutput)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ValidationOutput' {Maybe AppValidationOutput
appValidationOutput :: Maybe AppValidationOutput
$sel:appValidationOutput:ValidationOutput' :: ValidationOutput -> Maybe AppValidationOutput
appValidationOutput} -> Maybe AppValidationOutput
appValidationOutput) (\s :: ValidationOutput
s@ValidationOutput' {} Maybe AppValidationOutput
a -> ValidationOutput
s {$sel:appValidationOutput:ValidationOutput' :: Maybe AppValidationOutput
appValidationOutput = Maybe AppValidationOutput
a} :: ValidationOutput)

-- | The latest time that the validation was performed.
validationOutput_latestValidationTime :: Lens.Lens' ValidationOutput (Prelude.Maybe Prelude.UTCTime)
validationOutput_latestValidationTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ValidationOutput -> f ValidationOutput
validationOutput_latestValidationTime = (ValidationOutput -> Maybe POSIX)
-> (ValidationOutput -> Maybe POSIX -> ValidationOutput)
-> Lens
     ValidationOutput ValidationOutput (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ValidationOutput' {Maybe POSIX
latestValidationTime :: Maybe POSIX
$sel:latestValidationTime:ValidationOutput' :: ValidationOutput -> Maybe POSIX
latestValidationTime} -> Maybe POSIX
latestValidationTime) (\s :: ValidationOutput
s@ValidationOutput' {} Maybe POSIX
a -> ValidationOutput
s {$sel:latestValidationTime:ValidationOutput' :: Maybe POSIX
latestValidationTime = Maybe POSIX
a} :: ValidationOutput) ((Maybe POSIX -> f (Maybe POSIX))
 -> ValidationOutput -> f ValidationOutput)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ValidationOutput
-> f ValidationOutput
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The name of the validation.
validationOutput_name :: Lens.Lens' ValidationOutput (Prelude.Maybe Prelude.Text)
validationOutput_name :: (Maybe Text -> f (Maybe Text))
-> ValidationOutput -> f ValidationOutput
validationOutput_name = (ValidationOutput -> Maybe Text)
-> (ValidationOutput -> Maybe Text -> ValidationOutput)
-> Lens ValidationOutput ValidationOutput (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ValidationOutput' {Maybe Text
name :: Maybe Text
$sel:name:ValidationOutput' :: ValidationOutput -> Maybe Text
name} -> Maybe Text
name) (\s :: ValidationOutput
s@ValidationOutput' {} Maybe Text
a -> ValidationOutput
s {$sel:name:ValidationOutput' :: Maybe Text
name = Maybe Text
a} :: ValidationOutput)

-- | The status message.
validationOutput_statusMessage :: Lens.Lens' ValidationOutput (Prelude.Maybe Prelude.Text)
validationOutput_statusMessage :: (Maybe Text -> f (Maybe Text))
-> ValidationOutput -> f ValidationOutput
validationOutput_statusMessage = (ValidationOutput -> Maybe Text)
-> (ValidationOutput -> Maybe Text -> ValidationOutput)
-> Lens ValidationOutput ValidationOutput (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ValidationOutput' {Maybe Text
statusMessage :: Maybe Text
$sel:statusMessage:ValidationOutput' :: ValidationOutput -> Maybe Text
statusMessage} -> Maybe Text
statusMessage) (\s :: ValidationOutput
s@ValidationOutput' {} Maybe Text
a -> ValidationOutput
s {$sel:statusMessage:ValidationOutput' :: Maybe Text
statusMessage = Maybe Text
a} :: ValidationOutput)

-- | The ID of the validation.
validationOutput_validationId :: Lens.Lens' ValidationOutput (Prelude.Maybe Prelude.Text)
validationOutput_validationId :: (Maybe Text -> f (Maybe Text))
-> ValidationOutput -> f ValidationOutput
validationOutput_validationId = (ValidationOutput -> Maybe Text)
-> (ValidationOutput -> Maybe Text -> ValidationOutput)
-> Lens ValidationOutput ValidationOutput (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ValidationOutput' {Maybe Text
validationId :: Maybe Text
$sel:validationId:ValidationOutput' :: ValidationOutput -> Maybe Text
validationId} -> Maybe Text
validationId) (\s :: ValidationOutput
s@ValidationOutput' {} Maybe Text
a -> ValidationOutput
s {$sel:validationId:ValidationOutput' :: Maybe Text
validationId = Maybe Text
a} :: ValidationOutput)

-- | The output from validation an instance.
validationOutput_serverValidationOutput :: Lens.Lens' ValidationOutput (Prelude.Maybe ServerValidationOutput)
validationOutput_serverValidationOutput :: (Maybe ServerValidationOutput -> f (Maybe ServerValidationOutput))
-> ValidationOutput -> f ValidationOutput
validationOutput_serverValidationOutput = (ValidationOutput -> Maybe ServerValidationOutput)
-> (ValidationOutput
    -> Maybe ServerValidationOutput -> ValidationOutput)
-> Lens
     ValidationOutput
     ValidationOutput
     (Maybe ServerValidationOutput)
     (Maybe ServerValidationOutput)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ValidationOutput' {Maybe ServerValidationOutput
serverValidationOutput :: Maybe ServerValidationOutput
$sel:serverValidationOutput:ValidationOutput' :: ValidationOutput -> Maybe ServerValidationOutput
serverValidationOutput} -> Maybe ServerValidationOutput
serverValidationOutput) (\s :: ValidationOutput
s@ValidationOutput' {} Maybe ServerValidationOutput
a -> ValidationOutput
s {$sel:serverValidationOutput:ValidationOutput' :: Maybe ServerValidationOutput
serverValidationOutput = Maybe ServerValidationOutput
a} :: ValidationOutput)

instance Core.FromJSON ValidationOutput where
  parseJSON :: Value -> Parser ValidationOutput
parseJSON =
    String
-> (Object -> Parser ValidationOutput)
-> Value
-> Parser ValidationOutput
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ValidationOutput"
      ( \Object
x ->
          Maybe ValidationStatus
-> Maybe AppValidationOutput
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe ServerValidationOutput
-> ValidationOutput
ValidationOutput'
            (Maybe ValidationStatus
 -> Maybe AppValidationOutput
 -> Maybe POSIX
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe ServerValidationOutput
 -> ValidationOutput)
-> Parser (Maybe ValidationStatus)
-> Parser
     (Maybe AppValidationOutput
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe ServerValidationOutput
      -> ValidationOutput)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe ValidationStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"status")
            Parser
  (Maybe AppValidationOutput
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe ServerValidationOutput
   -> ValidationOutput)
-> Parser (Maybe AppValidationOutput)
-> Parser
     (Maybe POSIX
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe ServerValidationOutput
      -> ValidationOutput)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe AppValidationOutput)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"appValidationOutput")
            Parser
  (Maybe POSIX
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe ServerValidationOutput
   -> ValidationOutput)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe ServerValidationOutput
      -> ValidationOutput)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"latestValidationTime")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe ServerValidationOutput
   -> ValidationOutput)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text -> Maybe ServerValidationOutput -> ValidationOutput)
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
"name")
            Parser
  (Maybe Text
   -> Maybe Text -> Maybe ServerValidationOutput -> ValidationOutput)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> Maybe ServerValidationOutput -> ValidationOutput)
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
"statusMessage")
            Parser
  (Maybe Text -> Maybe ServerValidationOutput -> ValidationOutput)
-> Parser (Maybe Text)
-> Parser (Maybe ServerValidationOutput -> ValidationOutput)
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
"validationId")
            Parser (Maybe ServerValidationOutput -> ValidationOutput)
-> Parser (Maybe ServerValidationOutput) -> Parser ValidationOutput
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ServerValidationOutput)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"serverValidationOutput")
      )

instance Prelude.Hashable ValidationOutput

instance Prelude.NFData ValidationOutput