{-# 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.AmplifyBackend.Types.BackendJobRespObj
-- 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.AmplifyBackend.Types.BackendJobRespObj where

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

-- | The response object for this operation.
--
-- /See:/ 'newBackendJobRespObj' smart constructor.
data BackendJobRespObj = BackendJobRespObj'
  { -- | The current status of the request.
    BackendJobRespObj -> Maybe Text
status :: Prelude.Maybe Prelude.Text,
    -- | The ID for the job.
    BackendJobRespObj -> Maybe Text
jobId :: Prelude.Maybe Prelude.Text,
    -- | The name of the operation.
    BackendJobRespObj -> Maybe Text
operation :: Prelude.Maybe Prelude.Text,
    -- | If the request fails, this error is returned.
    BackendJobRespObj -> Maybe Text
error :: Prelude.Maybe Prelude.Text,
    -- | The time when the job was last updated.
    BackendJobRespObj -> Maybe Text
updateTime :: Prelude.Maybe Prelude.Text,
    -- | The time when the job was created.
    BackendJobRespObj -> Maybe Text
createTime :: Prelude.Maybe Prelude.Text,
    -- | The app ID.
    BackendJobRespObj -> Text
appId :: Prelude.Text,
    -- | The name of the backend environment.
    BackendJobRespObj -> Text
backendEnvironmentName :: Prelude.Text
  }
  deriving (BackendJobRespObj -> BackendJobRespObj -> Bool
(BackendJobRespObj -> BackendJobRespObj -> Bool)
-> (BackendJobRespObj -> BackendJobRespObj -> Bool)
-> Eq BackendJobRespObj
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BackendJobRespObj -> BackendJobRespObj -> Bool
$c/= :: BackendJobRespObj -> BackendJobRespObj -> Bool
== :: BackendJobRespObj -> BackendJobRespObj -> Bool
$c== :: BackendJobRespObj -> BackendJobRespObj -> Bool
Prelude.Eq, ReadPrec [BackendJobRespObj]
ReadPrec BackendJobRespObj
Int -> ReadS BackendJobRespObj
ReadS [BackendJobRespObj]
(Int -> ReadS BackendJobRespObj)
-> ReadS [BackendJobRespObj]
-> ReadPrec BackendJobRespObj
-> ReadPrec [BackendJobRespObj]
-> Read BackendJobRespObj
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BackendJobRespObj]
$creadListPrec :: ReadPrec [BackendJobRespObj]
readPrec :: ReadPrec BackendJobRespObj
$creadPrec :: ReadPrec BackendJobRespObj
readList :: ReadS [BackendJobRespObj]
$creadList :: ReadS [BackendJobRespObj]
readsPrec :: Int -> ReadS BackendJobRespObj
$creadsPrec :: Int -> ReadS BackendJobRespObj
Prelude.Read, Int -> BackendJobRespObj -> ShowS
[BackendJobRespObj] -> ShowS
BackendJobRespObj -> String
(Int -> BackendJobRespObj -> ShowS)
-> (BackendJobRespObj -> String)
-> ([BackendJobRespObj] -> ShowS)
-> Show BackendJobRespObj
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BackendJobRespObj] -> ShowS
$cshowList :: [BackendJobRespObj] -> ShowS
show :: BackendJobRespObj -> String
$cshow :: BackendJobRespObj -> String
showsPrec :: Int -> BackendJobRespObj -> ShowS
$cshowsPrec :: Int -> BackendJobRespObj -> ShowS
Prelude.Show, (forall x. BackendJobRespObj -> Rep BackendJobRespObj x)
-> (forall x. Rep BackendJobRespObj x -> BackendJobRespObj)
-> Generic BackendJobRespObj
forall x. Rep BackendJobRespObj x -> BackendJobRespObj
forall x. BackendJobRespObj -> Rep BackendJobRespObj x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BackendJobRespObj x -> BackendJobRespObj
$cfrom :: forall x. BackendJobRespObj -> Rep BackendJobRespObj x
Prelude.Generic)

-- |
-- Create a value of 'BackendJobRespObj' 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', 'backendJobRespObj_status' - The current status of the request.
--
-- 'jobId', 'backendJobRespObj_jobId' - The ID for the job.
--
-- 'operation', 'backendJobRespObj_operation' - The name of the operation.
--
-- 'error', 'backendJobRespObj_error' - If the request fails, this error is returned.
--
-- 'updateTime', 'backendJobRespObj_updateTime' - The time when the job was last updated.
--
-- 'createTime', 'backendJobRespObj_createTime' - The time when the job was created.
--
-- 'appId', 'backendJobRespObj_appId' - The app ID.
--
-- 'backendEnvironmentName', 'backendJobRespObj_backendEnvironmentName' - The name of the backend environment.
newBackendJobRespObj ::
  -- | 'appId'
  Prelude.Text ->
  -- | 'backendEnvironmentName'
  Prelude.Text ->
  BackendJobRespObj
newBackendJobRespObj :: Text -> Text -> BackendJobRespObj
newBackendJobRespObj Text
pAppId_ Text
pBackendEnvironmentName_ =
  BackendJobRespObj' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Text
-> Text
-> BackendJobRespObj
BackendJobRespObj'
    { $sel:status:BackendJobRespObj' :: Maybe Text
status = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:jobId:BackendJobRespObj' :: Maybe Text
jobId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:operation:BackendJobRespObj' :: Maybe Text
operation = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:error:BackendJobRespObj' :: Maybe Text
error = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:updateTime:BackendJobRespObj' :: Maybe Text
updateTime = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:createTime:BackendJobRespObj' :: Maybe Text
createTime = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:appId:BackendJobRespObj' :: Text
appId = Text
pAppId_,
      $sel:backendEnvironmentName:BackendJobRespObj' :: Text
backendEnvironmentName = Text
pBackendEnvironmentName_
    }

-- | The current status of the request.
backendJobRespObj_status :: Lens.Lens' BackendJobRespObj (Prelude.Maybe Prelude.Text)
backendJobRespObj_status :: (Maybe Text -> f (Maybe Text))
-> BackendJobRespObj -> f BackendJobRespObj
backendJobRespObj_status = (BackendJobRespObj -> Maybe Text)
-> (BackendJobRespObj -> Maybe Text -> BackendJobRespObj)
-> Lens
     BackendJobRespObj BackendJobRespObj (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BackendJobRespObj' {Maybe Text
status :: Maybe Text
$sel:status:BackendJobRespObj' :: BackendJobRespObj -> Maybe Text
status} -> Maybe Text
status) (\s :: BackendJobRespObj
s@BackendJobRespObj' {} Maybe Text
a -> BackendJobRespObj
s {$sel:status:BackendJobRespObj' :: Maybe Text
status = Maybe Text
a} :: BackendJobRespObj)

-- | The ID for the job.
backendJobRespObj_jobId :: Lens.Lens' BackendJobRespObj (Prelude.Maybe Prelude.Text)
backendJobRespObj_jobId :: (Maybe Text -> f (Maybe Text))
-> BackendJobRespObj -> f BackendJobRespObj
backendJobRespObj_jobId = (BackendJobRespObj -> Maybe Text)
-> (BackendJobRespObj -> Maybe Text -> BackendJobRespObj)
-> Lens
     BackendJobRespObj BackendJobRespObj (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BackendJobRespObj' {Maybe Text
jobId :: Maybe Text
$sel:jobId:BackendJobRespObj' :: BackendJobRespObj -> Maybe Text
jobId} -> Maybe Text
jobId) (\s :: BackendJobRespObj
s@BackendJobRespObj' {} Maybe Text
a -> BackendJobRespObj
s {$sel:jobId:BackendJobRespObj' :: Maybe Text
jobId = Maybe Text
a} :: BackendJobRespObj)

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

-- | If the request fails, this error is returned.
backendJobRespObj_error :: Lens.Lens' BackendJobRespObj (Prelude.Maybe Prelude.Text)
backendJobRespObj_error :: (Maybe Text -> f (Maybe Text))
-> BackendJobRespObj -> f BackendJobRespObj
backendJobRespObj_error = (BackendJobRespObj -> Maybe Text)
-> (BackendJobRespObj -> Maybe Text -> BackendJobRespObj)
-> Lens
     BackendJobRespObj BackendJobRespObj (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BackendJobRespObj' {Maybe Text
error :: Maybe Text
$sel:error:BackendJobRespObj' :: BackendJobRespObj -> Maybe Text
error} -> Maybe Text
error) (\s :: BackendJobRespObj
s@BackendJobRespObj' {} Maybe Text
a -> BackendJobRespObj
s {$sel:error:BackendJobRespObj' :: Maybe Text
error = Maybe Text
a} :: BackendJobRespObj)

-- | The time when the job was last updated.
backendJobRespObj_updateTime :: Lens.Lens' BackendJobRespObj (Prelude.Maybe Prelude.Text)
backendJobRespObj_updateTime :: (Maybe Text -> f (Maybe Text))
-> BackendJobRespObj -> f BackendJobRespObj
backendJobRespObj_updateTime = (BackendJobRespObj -> Maybe Text)
-> (BackendJobRespObj -> Maybe Text -> BackendJobRespObj)
-> Lens
     BackendJobRespObj BackendJobRespObj (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BackendJobRespObj' {Maybe Text
updateTime :: Maybe Text
$sel:updateTime:BackendJobRespObj' :: BackendJobRespObj -> Maybe Text
updateTime} -> Maybe Text
updateTime) (\s :: BackendJobRespObj
s@BackendJobRespObj' {} Maybe Text
a -> BackendJobRespObj
s {$sel:updateTime:BackendJobRespObj' :: Maybe Text
updateTime = Maybe Text
a} :: BackendJobRespObj)

-- | The time when the job was created.
backendJobRespObj_createTime :: Lens.Lens' BackendJobRespObj (Prelude.Maybe Prelude.Text)
backendJobRespObj_createTime :: (Maybe Text -> f (Maybe Text))
-> BackendJobRespObj -> f BackendJobRespObj
backendJobRespObj_createTime = (BackendJobRespObj -> Maybe Text)
-> (BackendJobRespObj -> Maybe Text -> BackendJobRespObj)
-> Lens
     BackendJobRespObj BackendJobRespObj (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BackendJobRespObj' {Maybe Text
createTime :: Maybe Text
$sel:createTime:BackendJobRespObj' :: BackendJobRespObj -> Maybe Text
createTime} -> Maybe Text
createTime) (\s :: BackendJobRespObj
s@BackendJobRespObj' {} Maybe Text
a -> BackendJobRespObj
s {$sel:createTime:BackendJobRespObj' :: Maybe Text
createTime = Maybe Text
a} :: BackendJobRespObj)

-- | The app ID.
backendJobRespObj_appId :: Lens.Lens' BackendJobRespObj Prelude.Text
backendJobRespObj_appId :: (Text -> f Text) -> BackendJobRespObj -> f BackendJobRespObj
backendJobRespObj_appId = (BackendJobRespObj -> Text)
-> (BackendJobRespObj -> Text -> BackendJobRespObj)
-> Lens BackendJobRespObj BackendJobRespObj Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BackendJobRespObj' {Text
appId :: Text
$sel:appId:BackendJobRespObj' :: BackendJobRespObj -> Text
appId} -> Text
appId) (\s :: BackendJobRespObj
s@BackendJobRespObj' {} Text
a -> BackendJobRespObj
s {$sel:appId:BackendJobRespObj' :: Text
appId = Text
a} :: BackendJobRespObj)

-- | The name of the backend environment.
backendJobRespObj_backendEnvironmentName :: Lens.Lens' BackendJobRespObj Prelude.Text
backendJobRespObj_backendEnvironmentName :: (Text -> f Text) -> BackendJobRespObj -> f BackendJobRespObj
backendJobRespObj_backendEnvironmentName = (BackendJobRespObj -> Text)
-> (BackendJobRespObj -> Text -> BackendJobRespObj)
-> Lens BackendJobRespObj BackendJobRespObj Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BackendJobRespObj' {Text
backendEnvironmentName :: Text
$sel:backendEnvironmentName:BackendJobRespObj' :: BackendJobRespObj -> Text
backendEnvironmentName} -> Text
backendEnvironmentName) (\s :: BackendJobRespObj
s@BackendJobRespObj' {} Text
a -> BackendJobRespObj
s {$sel:backendEnvironmentName:BackendJobRespObj' :: Text
backendEnvironmentName = Text
a} :: BackendJobRespObj)

instance Core.FromJSON BackendJobRespObj where
  parseJSON :: Value -> Parser BackendJobRespObj
parseJSON =
    String
-> (Object -> Parser BackendJobRespObj)
-> Value
-> Parser BackendJobRespObj
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"BackendJobRespObj"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Text
-> Text
-> BackendJobRespObj
BackendJobRespObj'
            (Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Text
 -> Text
 -> BackendJobRespObj)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Text
      -> Text
      -> BackendJobRespObj)
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
"status")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Text
   -> Text
   -> BackendJobRespObj)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Text
      -> Text
      -> BackendJobRespObj)
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
"jobId")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Text
   -> Text
   -> BackendJobRespObj)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text -> Maybe Text -> Text -> Text -> BackendJobRespObj)
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
"operation")
            Parser
  (Maybe Text
   -> Maybe Text -> Maybe Text -> Text -> Text -> BackendJobRespObj)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> Maybe Text -> Text -> Text -> BackendJobRespObj)
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
"error")
            Parser
  (Maybe Text -> Maybe Text -> Text -> Text -> BackendJobRespObj)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Text -> Text -> BackendJobRespObj)
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
"updateTime")
            Parser (Maybe Text -> Text -> Text -> BackendJobRespObj)
-> Parser (Maybe Text)
-> Parser (Text -> Text -> BackendJobRespObj)
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
"createTime")
            Parser (Text -> Text -> BackendJobRespObj)
-> Parser Text -> Parser (Text -> BackendJobRespObj)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"appId")
            Parser (Text -> BackendJobRespObj)
-> Parser Text -> Parser BackendJobRespObj
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"backendEnvironmentName")
      )

instance Prelude.Hashable BackendJobRespObj

instance Prelude.NFData BackendJobRespObj