{-# 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.Athena.Types.ExecutorsSummary
-- 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.Athena.Types.ExecutorsSummary where

import Amazonka.Athena.Types.ExecutorState
import Amazonka.Athena.Types.ExecutorType
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 summary information about an executor.
--
-- /See:/ 'newExecutorsSummary' smart constructor.
data ExecutorsSummary = ExecutorsSummary'
  { -- | The smallest unit of compute that a session can request from Athena.
    -- Size is measured in data processing unit (DPU) values, a relative
    -- measure of processing power.
    ExecutorsSummary -> Maybe Integer
executorSize :: Prelude.Maybe Prelude.Integer,
    -- | The processing state of the executor. A description of each state
    -- follows.
    --
    -- @CREATING@ - The executor is being started, including acquiring
    -- resources.
    --
    -- @CREATED@ - The executor has been started.
    --
    -- @REGISTERED@ - The executor has been registered.
    --
    -- @TERMINATING@ - The executor is in the process of shutting down.
    --
    -- @TERMINATED@ - The executor is no longer running.
    --
    -- @FAILED@ - Due to a failure, the executor is no longer running.
    ExecutorsSummary -> Maybe ExecutorState
executorState :: Prelude.Maybe ExecutorState,
    -- | The type of executor used for the application (@COORDINATOR@, @GATEWAY@,
    -- or @WORKER@).
    ExecutorsSummary -> Maybe ExecutorType
executorType :: Prelude.Maybe ExecutorType,
    -- | The date and time that the executor started.
    ExecutorsSummary -> Maybe Integer
startDateTime :: Prelude.Maybe Prelude.Integer,
    -- | The date and time that the executor was terminated.
    ExecutorsSummary -> Maybe Integer
terminationDateTime :: Prelude.Maybe Prelude.Integer,
    -- | The UUID of the executor.
    ExecutorsSummary -> Text
executorId :: Prelude.Text
  }
  deriving (ExecutorsSummary -> ExecutorsSummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ExecutorsSummary -> ExecutorsSummary -> Bool
$c/= :: ExecutorsSummary -> ExecutorsSummary -> Bool
== :: ExecutorsSummary -> ExecutorsSummary -> Bool
$c== :: ExecutorsSummary -> ExecutorsSummary -> Bool
Prelude.Eq, ReadPrec [ExecutorsSummary]
ReadPrec ExecutorsSummary
Int -> ReadS ExecutorsSummary
ReadS [ExecutorsSummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ExecutorsSummary]
$creadListPrec :: ReadPrec [ExecutorsSummary]
readPrec :: ReadPrec ExecutorsSummary
$creadPrec :: ReadPrec ExecutorsSummary
readList :: ReadS [ExecutorsSummary]
$creadList :: ReadS [ExecutorsSummary]
readsPrec :: Int -> ReadS ExecutorsSummary
$creadsPrec :: Int -> ReadS ExecutorsSummary
Prelude.Read, Int -> ExecutorsSummary -> ShowS
[ExecutorsSummary] -> ShowS
ExecutorsSummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ExecutorsSummary] -> ShowS
$cshowList :: [ExecutorsSummary] -> ShowS
show :: ExecutorsSummary -> String
$cshow :: ExecutorsSummary -> String
showsPrec :: Int -> ExecutorsSummary -> ShowS
$cshowsPrec :: Int -> ExecutorsSummary -> ShowS
Prelude.Show, forall x. Rep ExecutorsSummary x -> ExecutorsSummary
forall x. ExecutorsSummary -> Rep ExecutorsSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ExecutorsSummary x -> ExecutorsSummary
$cfrom :: forall x. ExecutorsSummary -> Rep ExecutorsSummary x
Prelude.Generic)

-- |
-- Create a value of 'ExecutorsSummary' 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:
--
-- 'executorSize', 'executorsSummary_executorSize' - The smallest unit of compute that a session can request from Athena.
-- Size is measured in data processing unit (DPU) values, a relative
-- measure of processing power.
--
-- 'executorState', 'executorsSummary_executorState' - The processing state of the executor. A description of each state
-- follows.
--
-- @CREATING@ - The executor is being started, including acquiring
-- resources.
--
-- @CREATED@ - The executor has been started.
--
-- @REGISTERED@ - The executor has been registered.
--
-- @TERMINATING@ - The executor is in the process of shutting down.
--
-- @TERMINATED@ - The executor is no longer running.
--
-- @FAILED@ - Due to a failure, the executor is no longer running.
--
-- 'executorType', 'executorsSummary_executorType' - The type of executor used for the application (@COORDINATOR@, @GATEWAY@,
-- or @WORKER@).
--
-- 'startDateTime', 'executorsSummary_startDateTime' - The date and time that the executor started.
--
-- 'terminationDateTime', 'executorsSummary_terminationDateTime' - The date and time that the executor was terminated.
--
-- 'executorId', 'executorsSummary_executorId' - The UUID of the executor.
newExecutorsSummary ::
  -- | 'executorId'
  Prelude.Text ->
  ExecutorsSummary
newExecutorsSummary :: Text -> ExecutorsSummary
newExecutorsSummary Text
pExecutorId_ =
  ExecutorsSummary'
    { $sel:executorSize:ExecutorsSummary' :: Maybe Integer
executorSize = forall a. Maybe a
Prelude.Nothing,
      $sel:executorState:ExecutorsSummary' :: Maybe ExecutorState
executorState = forall a. Maybe a
Prelude.Nothing,
      $sel:executorType:ExecutorsSummary' :: Maybe ExecutorType
executorType = forall a. Maybe a
Prelude.Nothing,
      $sel:startDateTime:ExecutorsSummary' :: Maybe Integer
startDateTime = forall a. Maybe a
Prelude.Nothing,
      $sel:terminationDateTime:ExecutorsSummary' :: Maybe Integer
terminationDateTime = forall a. Maybe a
Prelude.Nothing,
      $sel:executorId:ExecutorsSummary' :: Text
executorId = Text
pExecutorId_
    }

-- | The smallest unit of compute that a session can request from Athena.
-- Size is measured in data processing unit (DPU) values, a relative
-- measure of processing power.
executorsSummary_executorSize :: Lens.Lens' ExecutorsSummary (Prelude.Maybe Prelude.Integer)
executorsSummary_executorSize :: Lens' ExecutorsSummary (Maybe Integer)
executorsSummary_executorSize = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExecutorsSummary' {Maybe Integer
executorSize :: Maybe Integer
$sel:executorSize:ExecutorsSummary' :: ExecutorsSummary -> Maybe Integer
executorSize} -> Maybe Integer
executorSize) (\s :: ExecutorsSummary
s@ExecutorsSummary' {} Maybe Integer
a -> ExecutorsSummary
s {$sel:executorSize:ExecutorsSummary' :: Maybe Integer
executorSize = Maybe Integer
a} :: ExecutorsSummary)

-- | The processing state of the executor. A description of each state
-- follows.
--
-- @CREATING@ - The executor is being started, including acquiring
-- resources.
--
-- @CREATED@ - The executor has been started.
--
-- @REGISTERED@ - The executor has been registered.
--
-- @TERMINATING@ - The executor is in the process of shutting down.
--
-- @TERMINATED@ - The executor is no longer running.
--
-- @FAILED@ - Due to a failure, the executor is no longer running.
executorsSummary_executorState :: Lens.Lens' ExecutorsSummary (Prelude.Maybe ExecutorState)
executorsSummary_executorState :: Lens' ExecutorsSummary (Maybe ExecutorState)
executorsSummary_executorState = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExecutorsSummary' {Maybe ExecutorState
executorState :: Maybe ExecutorState
$sel:executorState:ExecutorsSummary' :: ExecutorsSummary -> Maybe ExecutorState
executorState} -> Maybe ExecutorState
executorState) (\s :: ExecutorsSummary
s@ExecutorsSummary' {} Maybe ExecutorState
a -> ExecutorsSummary
s {$sel:executorState:ExecutorsSummary' :: Maybe ExecutorState
executorState = Maybe ExecutorState
a} :: ExecutorsSummary)

-- | The type of executor used for the application (@COORDINATOR@, @GATEWAY@,
-- or @WORKER@).
executorsSummary_executorType :: Lens.Lens' ExecutorsSummary (Prelude.Maybe ExecutorType)
executorsSummary_executorType :: Lens' ExecutorsSummary (Maybe ExecutorType)
executorsSummary_executorType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExecutorsSummary' {Maybe ExecutorType
executorType :: Maybe ExecutorType
$sel:executorType:ExecutorsSummary' :: ExecutorsSummary -> Maybe ExecutorType
executorType} -> Maybe ExecutorType
executorType) (\s :: ExecutorsSummary
s@ExecutorsSummary' {} Maybe ExecutorType
a -> ExecutorsSummary
s {$sel:executorType:ExecutorsSummary' :: Maybe ExecutorType
executorType = Maybe ExecutorType
a} :: ExecutorsSummary)

-- | The date and time that the executor started.
executorsSummary_startDateTime :: Lens.Lens' ExecutorsSummary (Prelude.Maybe Prelude.Integer)
executorsSummary_startDateTime :: Lens' ExecutorsSummary (Maybe Integer)
executorsSummary_startDateTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExecutorsSummary' {Maybe Integer
startDateTime :: Maybe Integer
$sel:startDateTime:ExecutorsSummary' :: ExecutorsSummary -> Maybe Integer
startDateTime} -> Maybe Integer
startDateTime) (\s :: ExecutorsSummary
s@ExecutorsSummary' {} Maybe Integer
a -> ExecutorsSummary
s {$sel:startDateTime:ExecutorsSummary' :: Maybe Integer
startDateTime = Maybe Integer
a} :: ExecutorsSummary)

-- | The date and time that the executor was terminated.
executorsSummary_terminationDateTime :: Lens.Lens' ExecutorsSummary (Prelude.Maybe Prelude.Integer)
executorsSummary_terminationDateTime :: Lens' ExecutorsSummary (Maybe Integer)
executorsSummary_terminationDateTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExecutorsSummary' {Maybe Integer
terminationDateTime :: Maybe Integer
$sel:terminationDateTime:ExecutorsSummary' :: ExecutorsSummary -> Maybe Integer
terminationDateTime} -> Maybe Integer
terminationDateTime) (\s :: ExecutorsSummary
s@ExecutorsSummary' {} Maybe Integer
a -> ExecutorsSummary
s {$sel:terminationDateTime:ExecutorsSummary' :: Maybe Integer
terminationDateTime = Maybe Integer
a} :: ExecutorsSummary)

-- | The UUID of the executor.
executorsSummary_executorId :: Lens.Lens' ExecutorsSummary Prelude.Text
executorsSummary_executorId :: Lens' ExecutorsSummary Text
executorsSummary_executorId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExecutorsSummary' {Text
executorId :: Text
$sel:executorId:ExecutorsSummary' :: ExecutorsSummary -> Text
executorId} -> Text
executorId) (\s :: ExecutorsSummary
s@ExecutorsSummary' {} Text
a -> ExecutorsSummary
s {$sel:executorId:ExecutorsSummary' :: Text
executorId = Text
a} :: ExecutorsSummary)

instance Data.FromJSON ExecutorsSummary where
  parseJSON :: Value -> Parser ExecutorsSummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ExecutorsSummary"
      ( \Object
x ->
          Maybe Integer
-> Maybe ExecutorState
-> Maybe ExecutorType
-> Maybe Integer
-> Maybe Integer
-> Text
-> ExecutorsSummary
ExecutorsSummary'
            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
"ExecutorSize")
            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
"ExecutorState")
            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
"ExecutorType")
            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
"StartDateTime")
            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
"TerminationDateTime")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"ExecutorId")
      )

instance Prelude.Hashable ExecutorsSummary where
  hashWithSalt :: Int -> ExecutorsSummary -> Int
hashWithSalt Int
_salt ExecutorsSummary' {Maybe Integer
Maybe ExecutorState
Maybe ExecutorType
Text
executorId :: Text
terminationDateTime :: Maybe Integer
startDateTime :: Maybe Integer
executorType :: Maybe ExecutorType
executorState :: Maybe ExecutorState
executorSize :: Maybe Integer
$sel:executorId:ExecutorsSummary' :: ExecutorsSummary -> Text
$sel:terminationDateTime:ExecutorsSummary' :: ExecutorsSummary -> Maybe Integer
$sel:startDateTime:ExecutorsSummary' :: ExecutorsSummary -> Maybe Integer
$sel:executorType:ExecutorsSummary' :: ExecutorsSummary -> Maybe ExecutorType
$sel:executorState:ExecutorsSummary' :: ExecutorsSummary -> Maybe ExecutorState
$sel:executorSize:ExecutorsSummary' :: ExecutorsSummary -> Maybe Integer
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
executorSize
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ExecutorState
executorState
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ExecutorType
executorType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
startDateTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
terminationDateTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
executorId

instance Prelude.NFData ExecutorsSummary where
  rnf :: ExecutorsSummary -> ()
rnf ExecutorsSummary' {Maybe Integer
Maybe ExecutorState
Maybe ExecutorType
Text
executorId :: Text
terminationDateTime :: Maybe Integer
startDateTime :: Maybe Integer
executorType :: Maybe ExecutorType
executorState :: Maybe ExecutorState
executorSize :: Maybe Integer
$sel:executorId:ExecutorsSummary' :: ExecutorsSummary -> Text
$sel:terminationDateTime:ExecutorsSummary' :: ExecutorsSummary -> Maybe Integer
$sel:startDateTime:ExecutorsSummary' :: ExecutorsSummary -> Maybe Integer
$sel:executorType:ExecutorsSummary' :: ExecutorsSummary -> Maybe ExecutorType
$sel:executorState:ExecutorsSummary' :: ExecutorsSummary -> Maybe ExecutorState
$sel:executorSize:ExecutorsSummary' :: ExecutorsSummary -> Maybe Integer
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
executorSize
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ExecutorState
executorState
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ExecutorType
executorType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
startDateTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
terminationDateTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
executorId