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

import Amazonka.Athena.Types.NotebookType
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 metadata for notebook, including the notebook name, ID,
-- workgroup, and time created.
--
-- /See:/ 'newNotebookMetadata' smart constructor.
data NotebookMetadata = NotebookMetadata'
  { -- | The time when the notebook was created.
    NotebookMetadata -> Maybe POSIX
creationTime :: Prelude.Maybe Data.POSIX,
    -- | The time when the notebook was last modified.
    NotebookMetadata -> Maybe POSIX
lastModifiedTime :: Prelude.Maybe Data.POSIX,
    -- | The name of the notebook.
    NotebookMetadata -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The notebook ID.
    NotebookMetadata -> Maybe Text
notebookId :: Prelude.Maybe Prelude.Text,
    -- | The type of notebook. Currently, the only valid type is @IPYNB@.
    NotebookMetadata -> Maybe NotebookType
type' :: Prelude.Maybe NotebookType,
    -- | The name of the Spark enabled workgroup to which the notebook belongs.
    NotebookMetadata -> Maybe Text
workGroup :: Prelude.Maybe Prelude.Text
  }
  deriving (NotebookMetadata -> NotebookMetadata -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NotebookMetadata -> NotebookMetadata -> Bool
$c/= :: NotebookMetadata -> NotebookMetadata -> Bool
== :: NotebookMetadata -> NotebookMetadata -> Bool
$c== :: NotebookMetadata -> NotebookMetadata -> Bool
Prelude.Eq, ReadPrec [NotebookMetadata]
ReadPrec NotebookMetadata
Int -> ReadS NotebookMetadata
ReadS [NotebookMetadata]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NotebookMetadata]
$creadListPrec :: ReadPrec [NotebookMetadata]
readPrec :: ReadPrec NotebookMetadata
$creadPrec :: ReadPrec NotebookMetadata
readList :: ReadS [NotebookMetadata]
$creadList :: ReadS [NotebookMetadata]
readsPrec :: Int -> ReadS NotebookMetadata
$creadsPrec :: Int -> ReadS NotebookMetadata
Prelude.Read, Int -> NotebookMetadata -> ShowS
[NotebookMetadata] -> ShowS
NotebookMetadata -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NotebookMetadata] -> ShowS
$cshowList :: [NotebookMetadata] -> ShowS
show :: NotebookMetadata -> String
$cshow :: NotebookMetadata -> String
showsPrec :: Int -> NotebookMetadata -> ShowS
$cshowsPrec :: Int -> NotebookMetadata -> ShowS
Prelude.Show, forall x. Rep NotebookMetadata x -> NotebookMetadata
forall x. NotebookMetadata -> Rep NotebookMetadata x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep NotebookMetadata x -> NotebookMetadata
$cfrom :: forall x. NotebookMetadata -> Rep NotebookMetadata x
Prelude.Generic)

-- |
-- Create a value of 'NotebookMetadata' 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', 'notebookMetadata_creationTime' - The time when the notebook was created.
--
-- 'lastModifiedTime', 'notebookMetadata_lastModifiedTime' - The time when the notebook was last modified.
--
-- 'name', 'notebookMetadata_name' - The name of the notebook.
--
-- 'notebookId', 'notebookMetadata_notebookId' - The notebook ID.
--
-- 'type'', 'notebookMetadata_type' - The type of notebook. Currently, the only valid type is @IPYNB@.
--
-- 'workGroup', 'notebookMetadata_workGroup' - The name of the Spark enabled workgroup to which the notebook belongs.
newNotebookMetadata ::
  NotebookMetadata
newNotebookMetadata :: NotebookMetadata
newNotebookMetadata =
  NotebookMetadata'
    { $sel:creationTime:NotebookMetadata' :: Maybe POSIX
creationTime = forall a. Maybe a
Prelude.Nothing,
      $sel:lastModifiedTime:NotebookMetadata' :: Maybe POSIX
lastModifiedTime = forall a. Maybe a
Prelude.Nothing,
      $sel:name:NotebookMetadata' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:notebookId:NotebookMetadata' :: Maybe Text
notebookId = forall a. Maybe a
Prelude.Nothing,
      $sel:type':NotebookMetadata' :: Maybe NotebookType
type' = forall a. Maybe a
Prelude.Nothing,
      $sel:workGroup:NotebookMetadata' :: Maybe Text
workGroup = forall a. Maybe a
Prelude.Nothing
    }

-- | The time when the notebook was created.
notebookMetadata_creationTime :: Lens.Lens' NotebookMetadata (Prelude.Maybe Prelude.UTCTime)
notebookMetadata_creationTime :: Lens' NotebookMetadata (Maybe UTCTime)
notebookMetadata_creationTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NotebookMetadata' {Maybe POSIX
creationTime :: Maybe POSIX
$sel:creationTime:NotebookMetadata' :: NotebookMetadata -> Maybe POSIX
creationTime} -> Maybe POSIX
creationTime) (\s :: NotebookMetadata
s@NotebookMetadata' {} Maybe POSIX
a -> NotebookMetadata
s {$sel:creationTime:NotebookMetadata' :: Maybe POSIX
creationTime = Maybe POSIX
a} :: NotebookMetadata) 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 time when the notebook was last modified.
notebookMetadata_lastModifiedTime :: Lens.Lens' NotebookMetadata (Prelude.Maybe Prelude.UTCTime)
notebookMetadata_lastModifiedTime :: Lens' NotebookMetadata (Maybe UTCTime)
notebookMetadata_lastModifiedTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NotebookMetadata' {Maybe POSIX
lastModifiedTime :: Maybe POSIX
$sel:lastModifiedTime:NotebookMetadata' :: NotebookMetadata -> Maybe POSIX
lastModifiedTime} -> Maybe POSIX
lastModifiedTime) (\s :: NotebookMetadata
s@NotebookMetadata' {} Maybe POSIX
a -> NotebookMetadata
s {$sel:lastModifiedTime:NotebookMetadata' :: Maybe POSIX
lastModifiedTime = Maybe POSIX
a} :: NotebookMetadata) 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 name of the notebook.
notebookMetadata_name :: Lens.Lens' NotebookMetadata (Prelude.Maybe Prelude.Text)
notebookMetadata_name :: Lens' NotebookMetadata (Maybe Text)
notebookMetadata_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NotebookMetadata' {Maybe Text
name :: Maybe Text
$sel:name:NotebookMetadata' :: NotebookMetadata -> Maybe Text
name} -> Maybe Text
name) (\s :: NotebookMetadata
s@NotebookMetadata' {} Maybe Text
a -> NotebookMetadata
s {$sel:name:NotebookMetadata' :: Maybe Text
name = Maybe Text
a} :: NotebookMetadata)

-- | The notebook ID.
notebookMetadata_notebookId :: Lens.Lens' NotebookMetadata (Prelude.Maybe Prelude.Text)
notebookMetadata_notebookId :: Lens' NotebookMetadata (Maybe Text)
notebookMetadata_notebookId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NotebookMetadata' {Maybe Text
notebookId :: Maybe Text
$sel:notebookId:NotebookMetadata' :: NotebookMetadata -> Maybe Text
notebookId} -> Maybe Text
notebookId) (\s :: NotebookMetadata
s@NotebookMetadata' {} Maybe Text
a -> NotebookMetadata
s {$sel:notebookId:NotebookMetadata' :: Maybe Text
notebookId = Maybe Text
a} :: NotebookMetadata)

-- | The type of notebook. Currently, the only valid type is @IPYNB@.
notebookMetadata_type :: Lens.Lens' NotebookMetadata (Prelude.Maybe NotebookType)
notebookMetadata_type :: Lens' NotebookMetadata (Maybe NotebookType)
notebookMetadata_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NotebookMetadata' {Maybe NotebookType
type' :: Maybe NotebookType
$sel:type':NotebookMetadata' :: NotebookMetadata -> Maybe NotebookType
type'} -> Maybe NotebookType
type') (\s :: NotebookMetadata
s@NotebookMetadata' {} Maybe NotebookType
a -> NotebookMetadata
s {$sel:type':NotebookMetadata' :: Maybe NotebookType
type' = Maybe NotebookType
a} :: NotebookMetadata)

-- | The name of the Spark enabled workgroup to which the notebook belongs.
notebookMetadata_workGroup :: Lens.Lens' NotebookMetadata (Prelude.Maybe Prelude.Text)
notebookMetadata_workGroup :: Lens' NotebookMetadata (Maybe Text)
notebookMetadata_workGroup = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NotebookMetadata' {Maybe Text
workGroup :: Maybe Text
$sel:workGroup:NotebookMetadata' :: NotebookMetadata -> Maybe Text
workGroup} -> Maybe Text
workGroup) (\s :: NotebookMetadata
s@NotebookMetadata' {} Maybe Text
a -> NotebookMetadata
s {$sel:workGroup:NotebookMetadata' :: Maybe Text
workGroup = Maybe Text
a} :: NotebookMetadata)

instance Data.FromJSON NotebookMetadata where
  parseJSON :: Value -> Parser NotebookMetadata
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"NotebookMetadata"
      ( \Object
x ->
          Maybe POSIX
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe NotebookType
-> Maybe Text
-> NotebookMetadata
NotebookMetadata'
            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
"LastModifiedTime")
            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
"NotebookId")
            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
"Type")
            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
"WorkGroup")
      )

instance Prelude.Hashable NotebookMetadata where
  hashWithSalt :: Int -> NotebookMetadata -> Int
hashWithSalt Int
_salt NotebookMetadata' {Maybe Text
Maybe POSIX
Maybe NotebookType
workGroup :: Maybe Text
type' :: Maybe NotebookType
notebookId :: Maybe Text
name :: Maybe Text
lastModifiedTime :: Maybe POSIX
creationTime :: Maybe POSIX
$sel:workGroup:NotebookMetadata' :: NotebookMetadata -> Maybe Text
$sel:type':NotebookMetadata' :: NotebookMetadata -> Maybe NotebookType
$sel:notebookId:NotebookMetadata' :: NotebookMetadata -> Maybe Text
$sel:name:NotebookMetadata' :: NotebookMetadata -> Maybe Text
$sel:lastModifiedTime:NotebookMetadata' :: NotebookMetadata -> Maybe POSIX
$sel:creationTime:NotebookMetadata' :: NotebookMetadata -> 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 POSIX
lastModifiedTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
notebookId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe NotebookType
type'
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
workGroup

instance Prelude.NFData NotebookMetadata where
  rnf :: NotebookMetadata -> ()
rnf NotebookMetadata' {Maybe Text
Maybe POSIX
Maybe NotebookType
workGroup :: Maybe Text
type' :: Maybe NotebookType
notebookId :: Maybe Text
name :: Maybe Text
lastModifiedTime :: Maybe POSIX
creationTime :: Maybe POSIX
$sel:workGroup:NotebookMetadata' :: NotebookMetadata -> Maybe Text
$sel:type':NotebookMetadata' :: NotebookMetadata -> Maybe NotebookType
$sel:notebookId:NotebookMetadata' :: NotebookMetadata -> Maybe Text
$sel:name:NotebookMetadata' :: NotebookMetadata -> Maybe Text
$sel:lastModifiedTime:NotebookMetadata' :: NotebookMetadata -> Maybe POSIX
$sel:creationTime:NotebookMetadata' :: NotebookMetadata -> 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 POSIX
lastModifiedTime
      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 Text
notebookId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe NotebookType
type'
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
workGroup