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

import Amazonka.Athena.Types.EngineVersion
import Amazonka.Athena.Types.WorkGroupState
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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 Core.POSIX,
    -- | 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 state of the workgroup.
    WorkGroupSummary -> Maybe WorkGroupState
state :: Prelude.Maybe WorkGroupState,
    -- | The name of the workgroup.
    WorkGroupSummary -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The workgroup description.
    WorkGroupSummary -> Maybe Text
description :: Prelude.Maybe Prelude.Text
  }
  deriving (WorkGroupSummary -> WorkGroupSummary -> Bool
(WorkGroupSummary -> WorkGroupSummary -> Bool)
-> (WorkGroupSummary -> WorkGroupSummary -> Bool)
-> Eq WorkGroupSummary
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]
(Int -> ReadS WorkGroupSummary)
-> ReadS [WorkGroupSummary]
-> ReadPrec WorkGroupSummary
-> ReadPrec [WorkGroupSummary]
-> Read 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
(Int -> WorkGroupSummary -> ShowS)
-> (WorkGroupSummary -> String)
-> ([WorkGroupSummary] -> ShowS)
-> Show WorkGroupSummary
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. WorkGroupSummary -> Rep WorkGroupSummary x)
-> (forall x. Rep WorkGroupSummary x -> WorkGroupSummary)
-> Generic WorkGroupSummary
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.
--
-- '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.
--
-- 'state', 'workGroupSummary_state' - The state of the workgroup.
--
-- 'name', 'workGroupSummary_name' - The name of the workgroup.
--
-- 'description', 'workGroupSummary_description' - The workgroup description.
newWorkGroupSummary ::
  WorkGroupSummary
newWorkGroupSummary :: WorkGroupSummary
newWorkGroupSummary =
  WorkGroupSummary' :: Maybe POSIX
-> Maybe EngineVersion
-> Maybe WorkGroupState
-> Maybe Text
-> Maybe Text
-> WorkGroupSummary
WorkGroupSummary'
    { $sel:creationTime:WorkGroupSummary' :: Maybe POSIX
creationTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:engineVersion:WorkGroupSummary' :: Maybe EngineVersion
engineVersion = Maybe EngineVersion
forall a. Maybe a
Prelude.Nothing,
      $sel:state:WorkGroupSummary' :: Maybe WorkGroupState
state = Maybe WorkGroupState
forall a. Maybe a
Prelude.Nothing,
      $sel:name:WorkGroupSummary' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:description:WorkGroupSummary' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The workgroup creation date and time.
workGroupSummary_creationTime :: Lens.Lens' WorkGroupSummary (Prelude.Maybe Prelude.UTCTime)
workGroupSummary_creationTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> WorkGroupSummary -> f WorkGroupSummary
workGroupSummary_creationTime = (WorkGroupSummary -> Maybe POSIX)
-> (WorkGroupSummary -> Maybe POSIX -> WorkGroupSummary)
-> Lens
     WorkGroupSummary WorkGroupSummary (Maybe POSIX) (Maybe POSIX)
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) ((Maybe POSIX -> f (Maybe POSIX))
 -> WorkGroupSummary -> f WorkGroupSummary)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> WorkGroupSummary
-> f WorkGroupSummary
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | 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 :: (Maybe EngineVersion -> f (Maybe EngineVersion))
-> WorkGroupSummary -> f WorkGroupSummary
workGroupSummary_engineVersion = (WorkGroupSummary -> Maybe EngineVersion)
-> (WorkGroupSummary -> Maybe EngineVersion -> WorkGroupSummary)
-> Lens
     WorkGroupSummary
     WorkGroupSummary
     (Maybe EngineVersion)
     (Maybe 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 state of the workgroup.
workGroupSummary_state :: Lens.Lens' WorkGroupSummary (Prelude.Maybe WorkGroupState)
workGroupSummary_state :: (Maybe WorkGroupState -> f (Maybe WorkGroupState))
-> WorkGroupSummary -> f WorkGroupSummary
workGroupSummary_state = (WorkGroupSummary -> Maybe WorkGroupState)
-> (WorkGroupSummary -> Maybe WorkGroupState -> WorkGroupSummary)
-> Lens
     WorkGroupSummary
     WorkGroupSummary
     (Maybe WorkGroupState)
     (Maybe WorkGroupState)
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)

-- | The name of the workgroup.
workGroupSummary_name :: Lens.Lens' WorkGroupSummary (Prelude.Maybe Prelude.Text)
workGroupSummary_name :: (Maybe Text -> f (Maybe Text))
-> WorkGroupSummary -> f WorkGroupSummary
workGroupSummary_name = (WorkGroupSummary -> Maybe Text)
-> (WorkGroupSummary -> Maybe Text -> WorkGroupSummary)
-> Lens WorkGroupSummary WorkGroupSummary (Maybe Text) (Maybe Text)
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 workgroup description.
workGroupSummary_description :: Lens.Lens' WorkGroupSummary (Prelude.Maybe Prelude.Text)
workGroupSummary_description :: (Maybe Text -> f (Maybe Text))
-> WorkGroupSummary -> f WorkGroupSummary
workGroupSummary_description = (WorkGroupSummary -> Maybe Text)
-> (WorkGroupSummary -> Maybe Text -> WorkGroupSummary)
-> Lens WorkGroupSummary WorkGroupSummary (Maybe Text) (Maybe Text)
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)

instance Core.FromJSON WorkGroupSummary where
  parseJSON :: Value -> Parser WorkGroupSummary
parseJSON =
    String
-> (Object -> Parser WorkGroupSummary)
-> Value
-> Parser WorkGroupSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"WorkGroupSummary"
      ( \Object
x ->
          Maybe POSIX
-> Maybe EngineVersion
-> Maybe WorkGroupState
-> Maybe Text
-> Maybe Text
-> WorkGroupSummary
WorkGroupSummary'
            (Maybe POSIX
 -> Maybe EngineVersion
 -> Maybe WorkGroupState
 -> Maybe Text
 -> Maybe Text
 -> WorkGroupSummary)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe EngineVersion
      -> Maybe WorkGroupState
      -> Maybe Text
      -> Maybe Text
      -> WorkGroupSummary)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CreationTime")
            Parser
  (Maybe EngineVersion
   -> Maybe WorkGroupState
   -> Maybe Text
   -> Maybe Text
   -> WorkGroupSummary)
-> Parser (Maybe EngineVersion)
-> Parser
     (Maybe WorkGroupState
      -> Maybe Text -> Maybe Text -> WorkGroupSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe EngineVersion)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"EngineVersion")
            Parser
  (Maybe WorkGroupState
   -> Maybe Text -> Maybe Text -> WorkGroupSummary)
-> Parser (Maybe WorkGroupState)
-> Parser (Maybe Text -> Maybe Text -> WorkGroupSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe WorkGroupState)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"State")
            Parser (Maybe Text -> Maybe Text -> WorkGroupSummary)
-> Parser (Maybe Text) -> Parser (Maybe Text -> WorkGroupSummary)
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
"Name")
            Parser (Maybe Text -> WorkGroupSummary)
-> Parser (Maybe Text) -> Parser WorkGroupSummary
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
"Description")
      )

instance Prelude.Hashable WorkGroupSummary

instance Prelude.NFData WorkGroupSummary