{-# 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-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.Transfer.Types.ListedExecution where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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'
  { -- | 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,
    -- | 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 associated with a workflow.
    ListedExecution -> Maybe ServiceMetadata
serviceMetadata :: Prelude.Maybe ServiceMetadata
  }
  deriving (ListedExecution -> ListedExecution -> Bool
(ListedExecution -> ListedExecution -> Bool)
-> (ListedExecution -> ListedExecution -> Bool)
-> Eq ListedExecution
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]
(Int -> ReadS ListedExecution)
-> ReadS [ListedExecution]
-> ReadPrec ListedExecution
-> ReadPrec [ListedExecution]
-> Read 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
(Int -> ListedExecution -> ShowS)
-> (ListedExecution -> String)
-> ([ListedExecution] -> ShowS)
-> Show ListedExecution
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. ListedExecution -> Rep ListedExecution x)
-> (forall x. Rep ListedExecution x -> ListedExecution)
-> Generic ListedExecution
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:
--
-- 'status', 'listedExecution_status' - The status is one of the execution. Can be in progress, completed,
-- exception encountered, or handling the exception.
--
-- '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 associated with a workflow.
newListedExecution ::
  ListedExecution
newListedExecution :: ListedExecution
newListedExecution =
  ListedExecution' :: Maybe ExecutionStatus
-> Maybe Text
-> Maybe FileLocation
-> Maybe ServiceMetadata
-> ListedExecution
ListedExecution'
    { $sel:status:ListedExecution' :: Maybe ExecutionStatus
status = Maybe ExecutionStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:executionId:ListedExecution' :: Maybe Text
executionId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:initialFileLocation:ListedExecution' :: Maybe FileLocation
initialFileLocation = Maybe FileLocation
forall a. Maybe a
Prelude.Nothing,
      $sel:serviceMetadata:ListedExecution' :: Maybe ServiceMetadata
serviceMetadata = Maybe ServiceMetadata
forall a. Maybe a
Prelude.Nothing
    }

-- | 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 :: (Maybe ExecutionStatus -> f (Maybe ExecutionStatus))
-> ListedExecution -> f ListedExecution
listedExecution_status = (ListedExecution -> Maybe ExecutionStatus)
-> (ListedExecution -> Maybe ExecutionStatus -> ListedExecution)
-> Lens
     ListedExecution
     ListedExecution
     (Maybe ExecutionStatus)
     (Maybe ExecutionStatus)
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)

-- | A unique identifier for the execution of a workflow.
listedExecution_executionId :: Lens.Lens' ListedExecution (Prelude.Maybe Prelude.Text)
listedExecution_executionId :: (Maybe Text -> f (Maybe Text))
-> ListedExecution -> f ListedExecution
listedExecution_executionId = (ListedExecution -> Maybe Text)
-> (ListedExecution -> Maybe Text -> ListedExecution)
-> Lens ListedExecution ListedExecution (Maybe Text) (Maybe Text)
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 :: (Maybe FileLocation -> f (Maybe FileLocation))
-> ListedExecution -> f ListedExecution
listedExecution_initialFileLocation = (ListedExecution -> Maybe FileLocation)
-> (ListedExecution -> Maybe FileLocation -> ListedExecution)
-> Lens
     ListedExecution
     ListedExecution
     (Maybe FileLocation)
     (Maybe FileLocation)
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 associated with a workflow.
listedExecution_serviceMetadata :: Lens.Lens' ListedExecution (Prelude.Maybe ServiceMetadata)
listedExecution_serviceMetadata :: (Maybe ServiceMetadata -> f (Maybe ServiceMetadata))
-> ListedExecution -> f ListedExecution
listedExecution_serviceMetadata = (ListedExecution -> Maybe ServiceMetadata)
-> (ListedExecution -> Maybe ServiceMetadata -> ListedExecution)
-> Lens
     ListedExecution
     ListedExecution
     (Maybe ServiceMetadata)
     (Maybe 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)

instance Core.FromJSON ListedExecution where
  parseJSON :: Value -> Parser ListedExecution
parseJSON =
    String
-> (Object -> Parser ListedExecution)
-> Value
-> Parser ListedExecution
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ListedExecution"
      ( \Object
x ->
          Maybe ExecutionStatus
-> Maybe Text
-> Maybe FileLocation
-> Maybe ServiceMetadata
-> ListedExecution
ListedExecution'
            (Maybe ExecutionStatus
 -> Maybe Text
 -> Maybe FileLocation
 -> Maybe ServiceMetadata
 -> ListedExecution)
-> Parser (Maybe ExecutionStatus)
-> Parser
     (Maybe Text
      -> Maybe FileLocation -> Maybe ServiceMetadata -> ListedExecution)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe ExecutionStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Status")
            Parser
  (Maybe Text
   -> Maybe FileLocation -> Maybe ServiceMetadata -> ListedExecution)
-> Parser (Maybe Text)
-> Parser
     (Maybe FileLocation -> Maybe ServiceMetadata -> ListedExecution)
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
"ExecutionId")
            Parser
  (Maybe FileLocation -> Maybe ServiceMetadata -> ListedExecution)
-> Parser (Maybe FileLocation)
-> Parser (Maybe ServiceMetadata -> ListedExecution)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe FileLocation)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"InitialFileLocation")
            Parser (Maybe ServiceMetadata -> ListedExecution)
-> Parser (Maybe ServiceMetadata) -> Parser ListedExecution
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ServiceMetadata)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ServiceMetadata")
      )

instance Prelude.Hashable ListedExecution

instance Prelude.NFData ListedExecution