{-# 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.SageMakerEdge.Types.DeploymentResult
-- 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.SageMakerEdge.Types.DeploymentResult 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
import Amazonka.SageMakerEdge.Types.DeploymentModel

-- | Information about the result of a deployment on an edge device that is
-- registered with SageMaker Edge Manager.
--
-- /See:/ 'newDeploymentResult' smart constructor.
data DeploymentResult = DeploymentResult'
  { -- | The timestamp of when the deployment was ended, and the agent got the
    -- deployment results.
    DeploymentResult -> Maybe POSIX
deploymentEndTime :: Prelude.Maybe Data.POSIX,
    -- | Returns a list of models deployed on the agent.
    DeploymentResult -> Maybe [DeploymentModel]
deploymentModels :: Prelude.Maybe [DeploymentModel],
    -- | The name and unique ID of the deployment.
    DeploymentResult -> Maybe Text
deploymentName :: Prelude.Maybe Prelude.Text,
    -- | The timestamp of when the deployment was started on the agent.
    DeploymentResult -> Maybe POSIX
deploymentStartTime :: Prelude.Maybe Data.POSIX,
    -- | Returns the bucket error code.
    DeploymentResult -> Maybe Text
deploymentStatus :: Prelude.Maybe Prelude.Text,
    -- | Returns the detailed error message.
    DeploymentResult -> Maybe Text
deploymentStatusMessage :: Prelude.Maybe Prelude.Text
  }
  deriving (DeploymentResult -> DeploymentResult -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeploymentResult -> DeploymentResult -> Bool
$c/= :: DeploymentResult -> DeploymentResult -> Bool
== :: DeploymentResult -> DeploymentResult -> Bool
$c== :: DeploymentResult -> DeploymentResult -> Bool
Prelude.Eq, ReadPrec [DeploymentResult]
ReadPrec DeploymentResult
Int -> ReadS DeploymentResult
ReadS [DeploymentResult]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeploymentResult]
$creadListPrec :: ReadPrec [DeploymentResult]
readPrec :: ReadPrec DeploymentResult
$creadPrec :: ReadPrec DeploymentResult
readList :: ReadS [DeploymentResult]
$creadList :: ReadS [DeploymentResult]
readsPrec :: Int -> ReadS DeploymentResult
$creadsPrec :: Int -> ReadS DeploymentResult
Prelude.Read, Int -> DeploymentResult -> ShowS
[DeploymentResult] -> ShowS
DeploymentResult -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeploymentResult] -> ShowS
$cshowList :: [DeploymentResult] -> ShowS
show :: DeploymentResult -> String
$cshow :: DeploymentResult -> String
showsPrec :: Int -> DeploymentResult -> ShowS
$cshowsPrec :: Int -> DeploymentResult -> ShowS
Prelude.Show, forall x. Rep DeploymentResult x -> DeploymentResult
forall x. DeploymentResult -> Rep DeploymentResult x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeploymentResult x -> DeploymentResult
$cfrom :: forall x. DeploymentResult -> Rep DeploymentResult x
Prelude.Generic)

-- |
-- Create a value of 'DeploymentResult' 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:
--
-- 'deploymentEndTime', 'deploymentResult_deploymentEndTime' - The timestamp of when the deployment was ended, and the agent got the
-- deployment results.
--
-- 'deploymentModels', 'deploymentResult_deploymentModels' - Returns a list of models deployed on the agent.
--
-- 'deploymentName', 'deploymentResult_deploymentName' - The name and unique ID of the deployment.
--
-- 'deploymentStartTime', 'deploymentResult_deploymentStartTime' - The timestamp of when the deployment was started on the agent.
--
-- 'deploymentStatus', 'deploymentResult_deploymentStatus' - Returns the bucket error code.
--
-- 'deploymentStatusMessage', 'deploymentResult_deploymentStatusMessage' - Returns the detailed error message.
newDeploymentResult ::
  DeploymentResult
newDeploymentResult :: DeploymentResult
newDeploymentResult =
  DeploymentResult'
    { $sel:deploymentEndTime:DeploymentResult' :: Maybe POSIX
deploymentEndTime =
        forall a. Maybe a
Prelude.Nothing,
      $sel:deploymentModels:DeploymentResult' :: Maybe [DeploymentModel]
deploymentModels = forall a. Maybe a
Prelude.Nothing,
      $sel:deploymentName:DeploymentResult' :: Maybe Text
deploymentName = forall a. Maybe a
Prelude.Nothing,
      $sel:deploymentStartTime:DeploymentResult' :: Maybe POSIX
deploymentStartTime = forall a. Maybe a
Prelude.Nothing,
      $sel:deploymentStatus:DeploymentResult' :: Maybe Text
deploymentStatus = forall a. Maybe a
Prelude.Nothing,
      $sel:deploymentStatusMessage:DeploymentResult' :: Maybe Text
deploymentStatusMessage = forall a. Maybe a
Prelude.Nothing
    }

-- | The timestamp of when the deployment was ended, and the agent got the
-- deployment results.
deploymentResult_deploymentEndTime :: Lens.Lens' DeploymentResult (Prelude.Maybe Prelude.UTCTime)
deploymentResult_deploymentEndTime :: Lens' DeploymentResult (Maybe UTCTime)
deploymentResult_deploymentEndTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeploymentResult' {Maybe POSIX
deploymentEndTime :: Maybe POSIX
$sel:deploymentEndTime:DeploymentResult' :: DeploymentResult -> Maybe POSIX
deploymentEndTime} -> Maybe POSIX
deploymentEndTime) (\s :: DeploymentResult
s@DeploymentResult' {} Maybe POSIX
a -> DeploymentResult
s {$sel:deploymentEndTime:DeploymentResult' :: Maybe POSIX
deploymentEndTime = Maybe POSIX
a} :: DeploymentResult) 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 (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | Returns a list of models deployed on the agent.
deploymentResult_deploymentModels :: Lens.Lens' DeploymentResult (Prelude.Maybe [DeploymentModel])
deploymentResult_deploymentModels :: Lens' DeploymentResult (Maybe [DeploymentModel])
deploymentResult_deploymentModels = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeploymentResult' {Maybe [DeploymentModel]
deploymentModels :: Maybe [DeploymentModel]
$sel:deploymentModels:DeploymentResult' :: DeploymentResult -> Maybe [DeploymentModel]
deploymentModels} -> Maybe [DeploymentModel]
deploymentModels) (\s :: DeploymentResult
s@DeploymentResult' {} Maybe [DeploymentModel]
a -> DeploymentResult
s {$sel:deploymentModels:DeploymentResult' :: Maybe [DeploymentModel]
deploymentModels = Maybe [DeploymentModel]
a} :: DeploymentResult) 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

-- | The name and unique ID of the deployment.
deploymentResult_deploymentName :: Lens.Lens' DeploymentResult (Prelude.Maybe Prelude.Text)
deploymentResult_deploymentName :: Lens' DeploymentResult (Maybe Text)
deploymentResult_deploymentName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeploymentResult' {Maybe Text
deploymentName :: Maybe Text
$sel:deploymentName:DeploymentResult' :: DeploymentResult -> Maybe Text
deploymentName} -> Maybe Text
deploymentName) (\s :: DeploymentResult
s@DeploymentResult' {} Maybe Text
a -> DeploymentResult
s {$sel:deploymentName:DeploymentResult' :: Maybe Text
deploymentName = Maybe Text
a} :: DeploymentResult)

-- | The timestamp of when the deployment was started on the agent.
deploymentResult_deploymentStartTime :: Lens.Lens' DeploymentResult (Prelude.Maybe Prelude.UTCTime)
deploymentResult_deploymentStartTime :: Lens' DeploymentResult (Maybe UTCTime)
deploymentResult_deploymentStartTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeploymentResult' {Maybe POSIX
deploymentStartTime :: Maybe POSIX
$sel:deploymentStartTime:DeploymentResult' :: DeploymentResult -> Maybe POSIX
deploymentStartTime} -> Maybe POSIX
deploymentStartTime) (\s :: DeploymentResult
s@DeploymentResult' {} Maybe POSIX
a -> DeploymentResult
s {$sel:deploymentStartTime:DeploymentResult' :: Maybe POSIX
deploymentStartTime = Maybe POSIX
a} :: DeploymentResult) 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 (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | Returns the bucket error code.
deploymentResult_deploymentStatus :: Lens.Lens' DeploymentResult (Prelude.Maybe Prelude.Text)
deploymentResult_deploymentStatus :: Lens' DeploymentResult (Maybe Text)
deploymentResult_deploymentStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeploymentResult' {Maybe Text
deploymentStatus :: Maybe Text
$sel:deploymentStatus:DeploymentResult' :: DeploymentResult -> Maybe Text
deploymentStatus} -> Maybe Text
deploymentStatus) (\s :: DeploymentResult
s@DeploymentResult' {} Maybe Text
a -> DeploymentResult
s {$sel:deploymentStatus:DeploymentResult' :: Maybe Text
deploymentStatus = Maybe Text
a} :: DeploymentResult)

-- | Returns the detailed error message.
deploymentResult_deploymentStatusMessage :: Lens.Lens' DeploymentResult (Prelude.Maybe Prelude.Text)
deploymentResult_deploymentStatusMessage :: Lens' DeploymentResult (Maybe Text)
deploymentResult_deploymentStatusMessage = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeploymentResult' {Maybe Text
deploymentStatusMessage :: Maybe Text
$sel:deploymentStatusMessage:DeploymentResult' :: DeploymentResult -> Maybe Text
deploymentStatusMessage} -> Maybe Text
deploymentStatusMessage) (\s :: DeploymentResult
s@DeploymentResult' {} Maybe Text
a -> DeploymentResult
s {$sel:deploymentStatusMessage:DeploymentResult' :: Maybe Text
deploymentStatusMessage = Maybe Text
a} :: DeploymentResult)

instance Prelude.Hashable DeploymentResult where
  hashWithSalt :: Int -> DeploymentResult -> Int
hashWithSalt Int
_salt DeploymentResult' {Maybe [DeploymentModel]
Maybe Text
Maybe POSIX
deploymentStatusMessage :: Maybe Text
deploymentStatus :: Maybe Text
deploymentStartTime :: Maybe POSIX
deploymentName :: Maybe Text
deploymentModels :: Maybe [DeploymentModel]
deploymentEndTime :: Maybe POSIX
$sel:deploymentStatusMessage:DeploymentResult' :: DeploymentResult -> Maybe Text
$sel:deploymentStatus:DeploymentResult' :: DeploymentResult -> Maybe Text
$sel:deploymentStartTime:DeploymentResult' :: DeploymentResult -> Maybe POSIX
$sel:deploymentName:DeploymentResult' :: DeploymentResult -> Maybe Text
$sel:deploymentModels:DeploymentResult' :: DeploymentResult -> Maybe [DeploymentModel]
$sel:deploymentEndTime:DeploymentResult' :: DeploymentResult -> Maybe POSIX
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
deploymentEndTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [DeploymentModel]
deploymentModels
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
deploymentName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
deploymentStartTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
deploymentStatus
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
deploymentStatusMessage

instance Prelude.NFData DeploymentResult where
  rnf :: DeploymentResult -> ()
rnf DeploymentResult' {Maybe [DeploymentModel]
Maybe Text
Maybe POSIX
deploymentStatusMessage :: Maybe Text
deploymentStatus :: Maybe Text
deploymentStartTime :: Maybe POSIX
deploymentName :: Maybe Text
deploymentModels :: Maybe [DeploymentModel]
deploymentEndTime :: Maybe POSIX
$sel:deploymentStatusMessage:DeploymentResult' :: DeploymentResult -> Maybe Text
$sel:deploymentStatus:DeploymentResult' :: DeploymentResult -> Maybe Text
$sel:deploymentStartTime:DeploymentResult' :: DeploymentResult -> Maybe POSIX
$sel:deploymentName:DeploymentResult' :: DeploymentResult -> Maybe Text
$sel:deploymentModels:DeploymentResult' :: DeploymentResult -> Maybe [DeploymentModel]
$sel:deploymentEndTime:DeploymentResult' :: DeploymentResult -> Maybe POSIX
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
deploymentEndTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [DeploymentModel]
deploymentModels
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
deploymentName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
deploymentStartTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
deploymentStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
deploymentStatusMessage

instance Data.ToJSON DeploymentResult where
  toJSON :: DeploymentResult -> Value
toJSON DeploymentResult' {Maybe [DeploymentModel]
Maybe Text
Maybe POSIX
deploymentStatusMessage :: Maybe Text
deploymentStatus :: Maybe Text
deploymentStartTime :: Maybe POSIX
deploymentName :: Maybe Text
deploymentModels :: Maybe [DeploymentModel]
deploymentEndTime :: Maybe POSIX
$sel:deploymentStatusMessage:DeploymentResult' :: DeploymentResult -> Maybe Text
$sel:deploymentStatus:DeploymentResult' :: DeploymentResult -> Maybe Text
$sel:deploymentStartTime:DeploymentResult' :: DeploymentResult -> Maybe POSIX
$sel:deploymentName:DeploymentResult' :: DeploymentResult -> Maybe Text
$sel:deploymentModels:DeploymentResult' :: DeploymentResult -> Maybe [DeploymentModel]
$sel:deploymentEndTime:DeploymentResult' :: DeploymentResult -> Maybe POSIX
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"DeploymentEndTime" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe POSIX
deploymentEndTime,
            (Key
"DeploymentModels" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [DeploymentModel]
deploymentModels,
            (Key
"DeploymentName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
deploymentName,
            (Key
"DeploymentStartTime" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe POSIX
deploymentStartTime,
            (Key
"DeploymentStatus" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
deploymentStatus,
            (Key
"DeploymentStatusMessage" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
deploymentStatusMessage
          ]
      )