{-# 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.GreengrassV2.Types.EffectiveDeploymentStatusDetails
-- 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.GreengrassV2.Types.EffectiveDeploymentStatusDetails where

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

-- | Contains all error-related information for the deployment record. The
-- status details will be null if the deployment is in a success state.
--
-- Greengrass nucleus v2.8.0 or later is required to get an accurate
-- @errorStack@ and @errorTypes@ response. This field will not be returned
-- for earlier Greengrass nucleus versions.
--
-- /See:/ 'newEffectiveDeploymentStatusDetails' smart constructor.
data EffectiveDeploymentStatusDetails = EffectiveDeploymentStatusDetails'
  { -- | Contains an ordered list of short error codes that range from the most
    -- generic error to the most specific one. The error codes describe the
    -- reason for failure whenever the @coreDeviceExecutionStatus@ is in a
    -- failed state. The response will be an empty list if there is no error.
    EffectiveDeploymentStatusDetails -> Maybe [Text]
errorStack :: Prelude.Maybe [Prelude.Text],
    -- | Contains tags which describe the error. You can use the error types to
    -- classify errors to assist with remediating the failure. The response
    -- will be an empty list if there is no error.
    EffectiveDeploymentStatusDetails -> Maybe [Text]
errorTypes :: Prelude.Maybe [Prelude.Text]
  }
  deriving (EffectiveDeploymentStatusDetails
-> EffectiveDeploymentStatusDetails -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EffectiveDeploymentStatusDetails
-> EffectiveDeploymentStatusDetails -> Bool
$c/= :: EffectiveDeploymentStatusDetails
-> EffectiveDeploymentStatusDetails -> Bool
== :: EffectiveDeploymentStatusDetails
-> EffectiveDeploymentStatusDetails -> Bool
$c== :: EffectiveDeploymentStatusDetails
-> EffectiveDeploymentStatusDetails -> Bool
Prelude.Eq, ReadPrec [EffectiveDeploymentStatusDetails]
ReadPrec EffectiveDeploymentStatusDetails
Int -> ReadS EffectiveDeploymentStatusDetails
ReadS [EffectiveDeploymentStatusDetails]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EffectiveDeploymentStatusDetails]
$creadListPrec :: ReadPrec [EffectiveDeploymentStatusDetails]
readPrec :: ReadPrec EffectiveDeploymentStatusDetails
$creadPrec :: ReadPrec EffectiveDeploymentStatusDetails
readList :: ReadS [EffectiveDeploymentStatusDetails]
$creadList :: ReadS [EffectiveDeploymentStatusDetails]
readsPrec :: Int -> ReadS EffectiveDeploymentStatusDetails
$creadsPrec :: Int -> ReadS EffectiveDeploymentStatusDetails
Prelude.Read, Int -> EffectiveDeploymentStatusDetails -> ShowS
[EffectiveDeploymentStatusDetails] -> ShowS
EffectiveDeploymentStatusDetails -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EffectiveDeploymentStatusDetails] -> ShowS
$cshowList :: [EffectiveDeploymentStatusDetails] -> ShowS
show :: EffectiveDeploymentStatusDetails -> String
$cshow :: EffectiveDeploymentStatusDetails -> String
showsPrec :: Int -> EffectiveDeploymentStatusDetails -> ShowS
$cshowsPrec :: Int -> EffectiveDeploymentStatusDetails -> ShowS
Prelude.Show, forall x.
Rep EffectiveDeploymentStatusDetails x
-> EffectiveDeploymentStatusDetails
forall x.
EffectiveDeploymentStatusDetails
-> Rep EffectiveDeploymentStatusDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep EffectiveDeploymentStatusDetails x
-> EffectiveDeploymentStatusDetails
$cfrom :: forall x.
EffectiveDeploymentStatusDetails
-> Rep EffectiveDeploymentStatusDetails x
Prelude.Generic)

-- |
-- Create a value of 'EffectiveDeploymentStatusDetails' 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:
--
-- 'errorStack', 'effectiveDeploymentStatusDetails_errorStack' - Contains an ordered list of short error codes that range from the most
-- generic error to the most specific one. The error codes describe the
-- reason for failure whenever the @coreDeviceExecutionStatus@ is in a
-- failed state. The response will be an empty list if there is no error.
--
-- 'errorTypes', 'effectiveDeploymentStatusDetails_errorTypes' - Contains tags which describe the error. You can use the error types to
-- classify errors to assist with remediating the failure. The response
-- will be an empty list if there is no error.
newEffectiveDeploymentStatusDetails ::
  EffectiveDeploymentStatusDetails
newEffectiveDeploymentStatusDetails :: EffectiveDeploymentStatusDetails
newEffectiveDeploymentStatusDetails =
  EffectiveDeploymentStatusDetails'
    { $sel:errorStack:EffectiveDeploymentStatusDetails' :: Maybe [Text]
errorStack =
        forall a. Maybe a
Prelude.Nothing,
      $sel:errorTypes:EffectiveDeploymentStatusDetails' :: Maybe [Text]
errorTypes = forall a. Maybe a
Prelude.Nothing
    }

-- | Contains an ordered list of short error codes that range from the most
-- generic error to the most specific one. The error codes describe the
-- reason for failure whenever the @coreDeviceExecutionStatus@ is in a
-- failed state. The response will be an empty list if there is no error.
effectiveDeploymentStatusDetails_errorStack :: Lens.Lens' EffectiveDeploymentStatusDetails (Prelude.Maybe [Prelude.Text])
effectiveDeploymentStatusDetails_errorStack :: Lens' EffectiveDeploymentStatusDetails (Maybe [Text])
effectiveDeploymentStatusDetails_errorStack = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EffectiveDeploymentStatusDetails' {Maybe [Text]
errorStack :: Maybe [Text]
$sel:errorStack:EffectiveDeploymentStatusDetails' :: EffectiveDeploymentStatusDetails -> Maybe [Text]
errorStack} -> Maybe [Text]
errorStack) (\s :: EffectiveDeploymentStatusDetails
s@EffectiveDeploymentStatusDetails' {} Maybe [Text]
a -> EffectiveDeploymentStatusDetails
s {$sel:errorStack:EffectiveDeploymentStatusDetails' :: Maybe [Text]
errorStack = Maybe [Text]
a} :: EffectiveDeploymentStatusDetails) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Contains tags which describe the error. You can use the error types to
-- classify errors to assist with remediating the failure. The response
-- will be an empty list if there is no error.
effectiveDeploymentStatusDetails_errorTypes :: Lens.Lens' EffectiveDeploymentStatusDetails (Prelude.Maybe [Prelude.Text])
effectiveDeploymentStatusDetails_errorTypes :: Lens' EffectiveDeploymentStatusDetails (Maybe [Text])
effectiveDeploymentStatusDetails_errorTypes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EffectiveDeploymentStatusDetails' {Maybe [Text]
errorTypes :: Maybe [Text]
$sel:errorTypes:EffectiveDeploymentStatusDetails' :: EffectiveDeploymentStatusDetails -> Maybe [Text]
errorTypes} -> Maybe [Text]
errorTypes) (\s :: EffectiveDeploymentStatusDetails
s@EffectiveDeploymentStatusDetails' {} Maybe [Text]
a -> EffectiveDeploymentStatusDetails
s {$sel:errorTypes:EffectiveDeploymentStatusDetails' :: Maybe [Text]
errorTypes = Maybe [Text]
a} :: EffectiveDeploymentStatusDetails) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance
  Data.FromJSON
    EffectiveDeploymentStatusDetails
  where
  parseJSON :: Value -> Parser EffectiveDeploymentStatusDetails
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"EffectiveDeploymentStatusDetails"
      ( \Object
x ->
          Maybe [Text] -> Maybe [Text] -> EffectiveDeploymentStatusDetails
EffectiveDeploymentStatusDetails'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"errorStack" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"errorTypes" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
      )

instance
  Prelude.Hashable
    EffectiveDeploymentStatusDetails
  where
  hashWithSalt :: Int -> EffectiveDeploymentStatusDetails -> Int
hashWithSalt
    Int
_salt
    EffectiveDeploymentStatusDetails' {Maybe [Text]
errorTypes :: Maybe [Text]
errorStack :: Maybe [Text]
$sel:errorTypes:EffectiveDeploymentStatusDetails' :: EffectiveDeploymentStatusDetails -> Maybe [Text]
$sel:errorStack:EffectiveDeploymentStatusDetails' :: EffectiveDeploymentStatusDetails -> Maybe [Text]
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
errorStack
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
errorTypes

instance
  Prelude.NFData
    EffectiveDeploymentStatusDetails
  where
  rnf :: EffectiveDeploymentStatusDetails -> ()
rnf EffectiveDeploymentStatusDetails' {Maybe [Text]
errorTypes :: Maybe [Text]
errorStack :: Maybe [Text]
$sel:errorTypes:EffectiveDeploymentStatusDetails' :: EffectiveDeploymentStatusDetails -> Maybe [Text]
$sel:errorStack:EffectiveDeploymentStatusDetails' :: EffectiveDeploymentStatusDetails -> Maybe [Text]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
errorStack
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
errorTypes