{-# 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.Transfer.Types.ListedExecution
-- 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.Transfer.Types.ListedExecution 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.Transfer.Types.ExecutionStatus
import Amazonka.Transfer.Types.FileLocation
import Amazonka.Transfer.Types.ServiceMetadata

-- | Returns properties of the execution that is specified.
--
-- /See:/ 'newListedExecution' smart constructor.
data ListedExecution = ListedExecution'
  { -- | A unique identifier for the execution of a workflow.
    ListedExecution -> Maybe Text
executionId :: Prelude.Maybe Prelude.Text,
    -- | A structure that describes the Amazon S3 or EFS file location. This is
    -- the file location when the execution begins: if the file is being
    -- copied, this is the initial (as opposed to destination) file location.
    ListedExecution -> Maybe FileLocation
initialFileLocation :: Prelude.Maybe FileLocation,
    -- | A container object for the session details that are associated with a
    -- workflow.
    ListedExecution -> Maybe ServiceMetadata
serviceMetadata :: Prelude.Maybe ServiceMetadata,
    -- | The status is one of the execution. Can be in progress, completed,
    -- exception encountered, or handling the exception.
    ListedExecution -> Maybe ExecutionStatus
status :: Prelude.Maybe ExecutionStatus
  }
  deriving (ListedExecution -> ListedExecution -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListedExecution -> ListedExecution -> Bool
$c/= :: ListedExecution -> ListedExecution -> Bool
== :: ListedExecution -> ListedExecution -> Bool
$c== :: ListedExecution -> ListedExecution -> Bool
Prelude.Eq, ReadPrec [ListedExecution]
ReadPrec ListedExecution
Int -> ReadS ListedExecution
ReadS [ListedExecution]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListedExecution]
$creadListPrec :: ReadPrec [ListedExecution]
readPrec :: ReadPrec ListedExecution
$creadPrec :: ReadPrec ListedExecution
readList :: ReadS [ListedExecution]
$creadList :: ReadS [ListedExecution]
readsPrec :: Int -> ReadS ListedExecution
$creadsPrec :: Int -> ReadS ListedExecution
Prelude.Read, Int -> ListedExecution -> ShowS
[ListedExecution] -> ShowS
ListedExecution -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListedExecution] -> ShowS
$cshowList :: [ListedExecution] -> ShowS
show :: ListedExecution -> String
$cshow :: ListedExecution -> String
showsPrec :: Int -> ListedExecution -> ShowS
$cshowsPrec :: Int -> ListedExecution -> ShowS
Prelude.Show, forall x. Rep ListedExecution x -> ListedExecution
forall x. ListedExecution -> Rep ListedExecution x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListedExecution x -> ListedExecution
$cfrom :: forall x. ListedExecution -> Rep ListedExecution x
Prelude.Generic)

-- |
-- Create a value of 'ListedExecution' 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:
--
-- 'executionId', 'listedExecution_executionId' - A unique identifier for the execution of a workflow.
--
-- 'initialFileLocation', 'listedExecution_initialFileLocation' - A structure that describes the Amazon S3 or EFS file location. This is
-- the file location when the execution begins: if the file is being
-- copied, this is the initial (as opposed to destination) file location.
--
-- 'serviceMetadata', 'listedExecution_serviceMetadata' - A container object for the session details that are associated with a
-- workflow.
--
-- 'status', 'listedExecution_status' - The status is one of the execution. Can be in progress, completed,
-- exception encountered, or handling the exception.
newListedExecution ::
  ListedExecution
newListedExecution :: ListedExecution
newListedExecution =
  ListedExecution'
    { $sel:executionId:ListedExecution' :: Maybe Text
executionId = forall a. Maybe a
Prelude.Nothing,
      $sel:initialFileLocation:ListedExecution' :: Maybe FileLocation
initialFileLocation = forall a. Maybe a
Prelude.Nothing,
      $sel:serviceMetadata:ListedExecution' :: Maybe ServiceMetadata
serviceMetadata = forall a. Maybe a
Prelude.Nothing,
      $sel:status:ListedExecution' :: Maybe ExecutionStatus
status = forall a. Maybe a
Prelude.Nothing
    }

-- | A unique identifier for the execution of a workflow.
listedExecution_executionId :: Lens.Lens' ListedExecution (Prelude.Maybe Prelude.Text)
listedExecution_executionId :: Lens' ListedExecution (Maybe Text)
listedExecution_executionId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListedExecution' {Maybe Text
executionId :: Maybe Text
$sel:executionId:ListedExecution' :: ListedExecution -> Maybe Text
executionId} -> Maybe Text
executionId) (\s :: ListedExecution
s@ListedExecution' {} Maybe Text
a -> ListedExecution
s {$sel:executionId:ListedExecution' :: Maybe Text
executionId = Maybe Text
a} :: ListedExecution)

-- | A structure that describes the Amazon S3 or EFS file location. This is
-- the file location when the execution begins: if the file is being
-- copied, this is the initial (as opposed to destination) file location.
listedExecution_initialFileLocation :: Lens.Lens' ListedExecution (Prelude.Maybe FileLocation)
listedExecution_initialFileLocation :: Lens' ListedExecution (Maybe FileLocation)
listedExecution_initialFileLocation = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListedExecution' {Maybe FileLocation
initialFileLocation :: Maybe FileLocation
$sel:initialFileLocation:ListedExecution' :: ListedExecution -> Maybe FileLocation
initialFileLocation} -> Maybe FileLocation
initialFileLocation) (\s :: ListedExecution
s@ListedExecution' {} Maybe FileLocation
a -> ListedExecution
s {$sel:initialFileLocation:ListedExecution' :: Maybe FileLocation
initialFileLocation = Maybe FileLocation
a} :: ListedExecution)

-- | A container object for the session details that are associated with a
-- workflow.
listedExecution_serviceMetadata :: Lens.Lens' ListedExecution (Prelude.Maybe ServiceMetadata)
listedExecution_serviceMetadata :: Lens' ListedExecution (Maybe ServiceMetadata)
listedExecution_serviceMetadata = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListedExecution' {Maybe ServiceMetadata
serviceMetadata :: Maybe ServiceMetadata
$sel:serviceMetadata:ListedExecution' :: ListedExecution -> Maybe ServiceMetadata
serviceMetadata} -> Maybe ServiceMetadata
serviceMetadata) (\s :: ListedExecution
s@ListedExecution' {} Maybe ServiceMetadata
a -> ListedExecution
s {$sel:serviceMetadata:ListedExecution' :: Maybe ServiceMetadata
serviceMetadata = Maybe ServiceMetadata
a} :: ListedExecution)

-- | The status is one of the execution. Can be in progress, completed,
-- exception encountered, or handling the exception.
listedExecution_status :: Lens.Lens' ListedExecution (Prelude.Maybe ExecutionStatus)
listedExecution_status :: Lens' ListedExecution (Maybe ExecutionStatus)
listedExecution_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListedExecution' {Maybe ExecutionStatus
status :: Maybe ExecutionStatus
$sel:status:ListedExecution' :: ListedExecution -> Maybe ExecutionStatus
status} -> Maybe ExecutionStatus
status) (\s :: ListedExecution
s@ListedExecution' {} Maybe ExecutionStatus
a -> ListedExecution
s {$sel:status:ListedExecution' :: Maybe ExecutionStatus
status = Maybe ExecutionStatus
a} :: ListedExecution)

instance Data.FromJSON ListedExecution where
  parseJSON :: Value -> Parser ListedExecution
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ListedExecution"
      ( \Object
x ->
          Maybe Text
-> Maybe FileLocation
-> Maybe ServiceMetadata
-> Maybe ExecutionStatus
-> ListedExecution
ListedExecution'
            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
"ExecutionId")
            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
"InitialFileLocation")
            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
"ServiceMetadata")
            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
"Status")
      )

instance Prelude.Hashable ListedExecution where
  hashWithSalt :: Int -> ListedExecution -> Int
hashWithSalt Int
_salt ListedExecution' {Maybe Text
Maybe ExecutionStatus
Maybe FileLocation
Maybe ServiceMetadata
status :: Maybe ExecutionStatus
serviceMetadata :: Maybe ServiceMetadata
initialFileLocation :: Maybe FileLocation
executionId :: Maybe Text
$sel:status:ListedExecution' :: ListedExecution -> Maybe ExecutionStatus
$sel:serviceMetadata:ListedExecution' :: ListedExecution -> Maybe ServiceMetadata
$sel:initialFileLocation:ListedExecution' :: ListedExecution -> Maybe FileLocation
$sel:executionId:ListedExecution' :: ListedExecution -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
executionId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe FileLocation
initialFileLocation
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ServiceMetadata
serviceMetadata
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ExecutionStatus
status

instance Prelude.NFData ListedExecution where
  rnf :: ListedExecution -> ()
rnf ListedExecution' {Maybe Text
Maybe ExecutionStatus
Maybe FileLocation
Maybe ServiceMetadata
status :: Maybe ExecutionStatus
serviceMetadata :: Maybe ServiceMetadata
initialFileLocation :: Maybe FileLocation
executionId :: Maybe Text
$sel:status:ListedExecution' :: ListedExecution -> Maybe ExecutionStatus
$sel:serviceMetadata:ListedExecution' :: ListedExecution -> Maybe ServiceMetadata
$sel:initialFileLocation:ListedExecution' :: ListedExecution -> Maybe FileLocation
$sel:executionId:ListedExecution' :: ListedExecution -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
executionId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe FileLocation
initialFileLocation
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ServiceMetadata
serviceMetadata
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ExecutionStatus
status