{-# 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.WorkGroupSummary
-- 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.WorkGroupSummary where

import Amazonka.Athena.Types.EngineVersion
import Amazonka.Athena.Types.WorkGroupState
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

-- | The summary information for the workgroup, which includes its name,
-- state, description, and the date and time it was created.
--
-- /See:/ 'newWorkGroupSummary' smart constructor.
data WorkGroupSummary = WorkGroupSummary'
  { -- | The workgroup creation date and time.
    WorkGroupSummary -> Maybe POSIX
creationTime :: Prelude.Maybe Data.POSIX,
    -- | The workgroup description.
    WorkGroupSummary -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The engine version setting for all queries on the workgroup. Queries on
    -- the @AmazonAthenaPreviewFunctionality@ workgroup run on the preview
    -- engine regardless of this setting.
    WorkGroupSummary -> Maybe EngineVersion
engineVersion :: Prelude.Maybe EngineVersion,
    -- | The name of the workgroup.
    WorkGroupSummary -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The state of the workgroup.
    WorkGroupSummary -> Maybe WorkGroupState
state :: Prelude.Maybe WorkGroupState
  }
  deriving (WorkGroupSummary -> WorkGroupSummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WorkGroupSummary -> WorkGroupSummary -> Bool
$c/= :: WorkGroupSummary -> WorkGroupSummary -> Bool
== :: WorkGroupSummary -> WorkGroupSummary -> Bool
$c== :: WorkGroupSummary -> WorkGroupSummary -> Bool
Prelude.Eq, ReadPrec [WorkGroupSummary]
ReadPrec WorkGroupSummary
Int -> ReadS WorkGroupSummary
ReadS [WorkGroupSummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [WorkGroupSummary]
$creadListPrec :: ReadPrec [WorkGroupSummary]
readPrec :: ReadPrec WorkGroupSummary
$creadPrec :: ReadPrec WorkGroupSummary
readList :: ReadS [WorkGroupSummary]
$creadList :: ReadS [WorkGroupSummary]
readsPrec :: Int -> ReadS WorkGroupSummary
$creadsPrec :: Int -> ReadS WorkGroupSummary
Prelude.Read, Int -> WorkGroupSummary -> ShowS
[WorkGroupSummary] -> ShowS
WorkGroupSummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WorkGroupSummary] -> ShowS
$cshowList :: [WorkGroupSummary] -> ShowS
show :: WorkGroupSummary -> String
$cshow :: WorkGroupSummary -> String
showsPrec :: Int -> WorkGroupSummary -> ShowS
$cshowsPrec :: Int -> WorkGroupSummary -> ShowS
Prelude.Show, forall x. Rep WorkGroupSummary x -> WorkGroupSummary
forall x. WorkGroupSummary -> Rep WorkGroupSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep WorkGroupSummary x -> WorkGroupSummary
$cfrom :: forall x. WorkGroupSummary -> Rep WorkGroupSummary x
Prelude.Generic)

-- |
-- Create a value of 'WorkGroupSummary' 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:
--
-- 'creationTime', 'workGroupSummary_creationTime' - The workgroup creation date and time.
--
-- 'description', 'workGroupSummary_description' - The workgroup description.
--
-- 'engineVersion', 'workGroupSummary_engineVersion' - The engine version setting for all queries on the workgroup. Queries on
-- the @AmazonAthenaPreviewFunctionality@ workgroup run on the preview
-- engine regardless of this setting.
--
-- 'name', 'workGroupSummary_name' - The name of the workgroup.
--
-- 'state', 'workGroupSummary_state' - The state of the workgroup.
newWorkGroupSummary ::
  WorkGroupSummary
newWorkGroupSummary :: WorkGroupSummary
newWorkGroupSummary =
  WorkGroupSummary'
    { $sel:creationTime:WorkGroupSummary' :: Maybe POSIX
creationTime = forall a. Maybe a
Prelude.Nothing,
      $sel:description:WorkGroupSummary' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:engineVersion:WorkGroupSummary' :: Maybe EngineVersion
engineVersion = forall a. Maybe a
Prelude.Nothing,
      $sel:name:WorkGroupSummary' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:state:WorkGroupSummary' :: Maybe WorkGroupState
state = forall a. Maybe a
Prelude.Nothing
    }

-- | The workgroup creation date and time.
workGroupSummary_creationTime :: Lens.Lens' WorkGroupSummary (Prelude.Maybe Prelude.UTCTime)
workGroupSummary_creationTime :: Lens' WorkGroupSummary (Maybe UTCTime)
workGroupSummary_creationTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkGroupSummary' {Maybe POSIX
creationTime :: Maybe POSIX
$sel:creationTime:WorkGroupSummary' :: WorkGroupSummary -> Maybe POSIX
creationTime} -> Maybe POSIX
creationTime) (\s :: WorkGroupSummary
s@WorkGroupSummary' {} Maybe POSIX
a -> WorkGroupSummary
s {$sel:creationTime:WorkGroupSummary' :: Maybe POSIX
creationTime = Maybe POSIX
a} :: WorkGroupSummary) 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

-- | The workgroup description.
workGroupSummary_description :: Lens.Lens' WorkGroupSummary (Prelude.Maybe Prelude.Text)
workGroupSummary_description :: Lens' WorkGroupSummary (Maybe Text)
workGroupSummary_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkGroupSummary' {Maybe Text
description :: Maybe Text
$sel:description:WorkGroupSummary' :: WorkGroupSummary -> Maybe Text
description} -> Maybe Text
description) (\s :: WorkGroupSummary
s@WorkGroupSummary' {} Maybe Text
a -> WorkGroupSummary
s {$sel:description:WorkGroupSummary' :: Maybe Text
description = Maybe Text
a} :: WorkGroupSummary)

-- | The engine version setting for all queries on the workgroup. Queries on
-- the @AmazonAthenaPreviewFunctionality@ workgroup run on the preview
-- engine regardless of this setting.
workGroupSummary_engineVersion :: Lens.Lens' WorkGroupSummary (Prelude.Maybe EngineVersion)
workGroupSummary_engineVersion :: Lens' WorkGroupSummary (Maybe EngineVersion)
workGroupSummary_engineVersion = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkGroupSummary' {Maybe EngineVersion
engineVersion :: Maybe EngineVersion
$sel:engineVersion:WorkGroupSummary' :: WorkGroupSummary -> Maybe EngineVersion
engineVersion} -> Maybe EngineVersion
engineVersion) (\s :: WorkGroupSummary
s@WorkGroupSummary' {} Maybe EngineVersion
a -> WorkGroupSummary
s {$sel:engineVersion:WorkGroupSummary' :: Maybe EngineVersion
engineVersion = Maybe EngineVersion
a} :: WorkGroupSummary)

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

-- | The state of the workgroup.
workGroupSummary_state :: Lens.Lens' WorkGroupSummary (Prelude.Maybe WorkGroupState)
workGroupSummary_state :: Lens' WorkGroupSummary (Maybe WorkGroupState)
workGroupSummary_state = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkGroupSummary' {Maybe WorkGroupState
state :: Maybe WorkGroupState
$sel:state:WorkGroupSummary' :: WorkGroupSummary -> Maybe WorkGroupState
state} -> Maybe WorkGroupState
state) (\s :: WorkGroupSummary
s@WorkGroupSummary' {} Maybe WorkGroupState
a -> WorkGroupSummary
s {$sel:state:WorkGroupSummary' :: Maybe WorkGroupState
state = Maybe WorkGroupState
a} :: WorkGroupSummary)

instance Data.FromJSON WorkGroupSummary where
  parseJSON :: Value -> Parser WorkGroupSummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"WorkGroupSummary"
      ( \Object
x ->
          Maybe POSIX
-> Maybe Text
-> Maybe EngineVersion
-> Maybe Text
-> Maybe WorkGroupState
-> WorkGroupSummary
WorkGroupSummary'
            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
"CreationTime")
            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
"Description")
            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
"EngineVersion")
            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
"Name")
            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
"State")
      )

instance Prelude.Hashable WorkGroupSummary where
  hashWithSalt :: Int -> WorkGroupSummary -> Int
hashWithSalt Int
_salt WorkGroupSummary' {Maybe Text
Maybe POSIX
Maybe EngineVersion
Maybe WorkGroupState
state :: Maybe WorkGroupState
name :: Maybe Text
engineVersion :: Maybe EngineVersion
description :: Maybe Text
creationTime :: Maybe POSIX
$sel:state:WorkGroupSummary' :: WorkGroupSummary -> Maybe WorkGroupState
$sel:name:WorkGroupSummary' :: WorkGroupSummary -> Maybe Text
$sel:engineVersion:WorkGroupSummary' :: WorkGroupSummary -> Maybe EngineVersion
$sel:description:WorkGroupSummary' :: WorkGroupSummary -> Maybe Text
$sel:creationTime:WorkGroupSummary' :: WorkGroupSummary -> Maybe POSIX
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
creationTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe EngineVersion
engineVersion
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe WorkGroupState
state

instance Prelude.NFData WorkGroupSummary where
  rnf :: WorkGroupSummary -> ()
rnf WorkGroupSummary' {Maybe Text
Maybe POSIX
Maybe EngineVersion
Maybe WorkGroupState
state :: Maybe WorkGroupState
name :: Maybe Text
engineVersion :: Maybe EngineVersion
description :: Maybe Text
creationTime :: Maybe POSIX
$sel:state:WorkGroupSummary' :: WorkGroupSummary -> Maybe WorkGroupState
$sel:name:WorkGroupSummary' :: WorkGroupSummary -> Maybe Text
$sel:engineVersion:WorkGroupSummary' :: WorkGroupSummary -> Maybe EngineVersion
$sel:description:WorkGroupSummary' :: WorkGroupSummary -> Maybe Text
$sel:creationTime:WorkGroupSummary' :: WorkGroupSummary -> Maybe POSIX
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
creationTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe EngineVersion
engineVersion
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe WorkGroupState
state