{-# 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.Nimble.Types.ValidationResult
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Nimble.Types.ValidationResult where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Nimble.Types.LaunchProfileValidationState
import Amazonka.Nimble.Types.LaunchProfileValidationStatusCode
import Amazonka.Nimble.Types.LaunchProfileValidationType
import qualified Amazonka.Prelude as Prelude

-- | The launch profile validation result.
--
-- /See:/ 'newValidationResult' smart constructor.
data ValidationResult = ValidationResult'
  { -- | The current state.
    ValidationResult -> LaunchProfileValidationState
state :: LaunchProfileValidationState,
    -- | The status code. This will contain the failure reason if the state is
    -- @VALIDATION_FAILED@.
    ValidationResult -> LaunchProfileValidationStatusCode
statusCode :: LaunchProfileValidationStatusCode,
    -- | The status message for the validation result.
    ValidationResult -> Text
statusMessage :: Prelude.Text,
    -- | The type of the validation result.
    ValidationResult -> LaunchProfileValidationType
type' :: LaunchProfileValidationType
  }
  deriving (ValidationResult -> ValidationResult -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ValidationResult -> ValidationResult -> Bool
$c/= :: ValidationResult -> ValidationResult -> Bool
== :: ValidationResult -> ValidationResult -> Bool
$c== :: ValidationResult -> ValidationResult -> Bool
Prelude.Eq, ReadPrec [ValidationResult]
ReadPrec ValidationResult
Int -> ReadS ValidationResult
ReadS [ValidationResult]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ValidationResult]
$creadListPrec :: ReadPrec [ValidationResult]
readPrec :: ReadPrec ValidationResult
$creadPrec :: ReadPrec ValidationResult
readList :: ReadS [ValidationResult]
$creadList :: ReadS [ValidationResult]
readsPrec :: Int -> ReadS ValidationResult
$creadsPrec :: Int -> ReadS ValidationResult
Prelude.Read, Int -> ValidationResult -> ShowS
[ValidationResult] -> ShowS
ValidationResult -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ValidationResult] -> ShowS
$cshowList :: [ValidationResult] -> ShowS
show :: ValidationResult -> String
$cshow :: ValidationResult -> String
showsPrec :: Int -> ValidationResult -> ShowS
$cshowsPrec :: Int -> ValidationResult -> ShowS
Prelude.Show, forall x. Rep ValidationResult x -> ValidationResult
forall x. ValidationResult -> Rep ValidationResult x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ValidationResult x -> ValidationResult
$cfrom :: forall x. ValidationResult -> Rep ValidationResult x
Prelude.Generic)

-- |
-- Create a value of 'ValidationResult' 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:
--
-- 'state', 'validationResult_state' - The current state.
--
-- 'statusCode', 'validationResult_statusCode' - The status code. This will contain the failure reason if the state is
-- @VALIDATION_FAILED@.
--
-- 'statusMessage', 'validationResult_statusMessage' - The status message for the validation result.
--
-- 'type'', 'validationResult_type' - The type of the validation result.
newValidationResult ::
  -- | 'state'
  LaunchProfileValidationState ->
  -- | 'statusCode'
  LaunchProfileValidationStatusCode ->
  -- | 'statusMessage'
  Prelude.Text ->
  -- | 'type''
  LaunchProfileValidationType ->
  ValidationResult
newValidationResult :: LaunchProfileValidationState
-> LaunchProfileValidationStatusCode
-> Text
-> LaunchProfileValidationType
-> ValidationResult
newValidationResult
  LaunchProfileValidationState
pState_
  LaunchProfileValidationStatusCode
pStatusCode_
  Text
pStatusMessage_
  LaunchProfileValidationType
pType_ =
    ValidationResult'
      { $sel:state:ValidationResult' :: LaunchProfileValidationState
state = LaunchProfileValidationState
pState_,
        $sel:statusCode:ValidationResult' :: LaunchProfileValidationStatusCode
statusCode = LaunchProfileValidationStatusCode
pStatusCode_,
        $sel:statusMessage:ValidationResult' :: Text
statusMessage = Text
pStatusMessage_,
        $sel:type':ValidationResult' :: LaunchProfileValidationType
type' = LaunchProfileValidationType
pType_
      }

-- | The current state.
validationResult_state :: Lens.Lens' ValidationResult LaunchProfileValidationState
validationResult_state :: Lens' ValidationResult LaunchProfileValidationState
validationResult_state = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ValidationResult' {LaunchProfileValidationState
state :: LaunchProfileValidationState
$sel:state:ValidationResult' :: ValidationResult -> LaunchProfileValidationState
state} -> LaunchProfileValidationState
state) (\s :: ValidationResult
s@ValidationResult' {} LaunchProfileValidationState
a -> ValidationResult
s {$sel:state:ValidationResult' :: LaunchProfileValidationState
state = LaunchProfileValidationState
a} :: ValidationResult)

-- | The status code. This will contain the failure reason if the state is
-- @VALIDATION_FAILED@.
validationResult_statusCode :: Lens.Lens' ValidationResult LaunchProfileValidationStatusCode
validationResult_statusCode :: Lens' ValidationResult LaunchProfileValidationStatusCode
validationResult_statusCode = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ValidationResult' {LaunchProfileValidationStatusCode
statusCode :: LaunchProfileValidationStatusCode
$sel:statusCode:ValidationResult' :: ValidationResult -> LaunchProfileValidationStatusCode
statusCode} -> LaunchProfileValidationStatusCode
statusCode) (\s :: ValidationResult
s@ValidationResult' {} LaunchProfileValidationStatusCode
a -> ValidationResult
s {$sel:statusCode:ValidationResult' :: LaunchProfileValidationStatusCode
statusCode = LaunchProfileValidationStatusCode
a} :: ValidationResult)

-- | The status message for the validation result.
validationResult_statusMessage :: Lens.Lens' ValidationResult Prelude.Text
validationResult_statusMessage :: Lens' ValidationResult Text
validationResult_statusMessage = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ValidationResult' {Text
statusMessage :: Text
$sel:statusMessage:ValidationResult' :: ValidationResult -> Text
statusMessage} -> Text
statusMessage) (\s :: ValidationResult
s@ValidationResult' {} Text
a -> ValidationResult
s {$sel:statusMessage:ValidationResult' :: Text
statusMessage = Text
a} :: ValidationResult)

-- | The type of the validation result.
validationResult_type :: Lens.Lens' ValidationResult LaunchProfileValidationType
validationResult_type :: Lens' ValidationResult LaunchProfileValidationType
validationResult_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ValidationResult' {LaunchProfileValidationType
type' :: LaunchProfileValidationType
$sel:type':ValidationResult' :: ValidationResult -> LaunchProfileValidationType
type'} -> LaunchProfileValidationType
type') (\s :: ValidationResult
s@ValidationResult' {} LaunchProfileValidationType
a -> ValidationResult
s {$sel:type':ValidationResult' :: LaunchProfileValidationType
type' = LaunchProfileValidationType
a} :: ValidationResult)

instance Data.FromJSON ValidationResult where
  parseJSON :: Value -> Parser ValidationResult
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ValidationResult"
      ( \Object
x ->
          LaunchProfileValidationState
-> LaunchProfileValidationStatusCode
-> Text
-> LaunchProfileValidationType
-> ValidationResult
ValidationResult'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"state")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"statusCode")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"statusMessage")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"type")
      )

instance Prelude.Hashable ValidationResult where
  hashWithSalt :: Int -> ValidationResult -> Int
hashWithSalt Int
_salt ValidationResult' {Text
LaunchProfileValidationState
LaunchProfileValidationStatusCode
LaunchProfileValidationType
type' :: LaunchProfileValidationType
statusMessage :: Text
statusCode :: LaunchProfileValidationStatusCode
state :: LaunchProfileValidationState
$sel:type':ValidationResult' :: ValidationResult -> LaunchProfileValidationType
$sel:statusMessage:ValidationResult' :: ValidationResult -> Text
$sel:statusCode:ValidationResult' :: ValidationResult -> LaunchProfileValidationStatusCode
$sel:state:ValidationResult' :: ValidationResult -> LaunchProfileValidationState
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` LaunchProfileValidationState
state
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` LaunchProfileValidationStatusCode
statusCode
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
statusMessage
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` LaunchProfileValidationType
type'

instance Prelude.NFData ValidationResult where
  rnf :: ValidationResult -> ()
rnf ValidationResult' {Text
LaunchProfileValidationState
LaunchProfileValidationStatusCode
LaunchProfileValidationType
type' :: LaunchProfileValidationType
statusMessage :: Text
statusCode :: LaunchProfileValidationStatusCode
state :: LaunchProfileValidationState
$sel:type':ValidationResult' :: ValidationResult -> LaunchProfileValidationType
$sel:statusMessage:ValidationResult' :: ValidationResult -> Text
$sel:statusCode:ValidationResult' :: ValidationResult -> LaunchProfileValidationStatusCode
$sel:state:ValidationResult' :: ValidationResult -> LaunchProfileValidationState
..} =
    forall a. NFData a => a -> ()
Prelude.rnf LaunchProfileValidationState
state
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf LaunchProfileValidationStatusCode
statusCode
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
statusMessage
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf LaunchProfileValidationType
type'