{-# 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.SageMaker.Types.ContextSummary
-- 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.SageMaker.Types.ContextSummary where

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
import Amazonka.SageMaker.Types.ContextSource

-- | Lists a summary of the properties of a context. A context provides a
-- logical grouping of other entities.
--
-- /See:/ 'newContextSummary' smart constructor.
data ContextSummary = ContextSummary'
  { -- | The Amazon Resource Name (ARN) of the context.
    ContextSummary -> Maybe Text
contextArn :: Prelude.Maybe Prelude.Text,
    -- | The name of the context.
    ContextSummary -> Maybe Text
contextName :: Prelude.Maybe Prelude.Text,
    -- | The type of the context.
    ContextSummary -> Maybe Text
contextType :: Prelude.Maybe Prelude.Text,
    -- | When the context was created.
    ContextSummary -> Maybe POSIX
creationTime :: Prelude.Maybe Data.POSIX,
    -- | When the context was last modified.
    ContextSummary -> Maybe POSIX
lastModifiedTime :: Prelude.Maybe Data.POSIX,
    -- | The source of the context.
    ContextSummary -> Maybe ContextSource
source :: Prelude.Maybe ContextSource
  }
  deriving (ContextSummary -> ContextSummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ContextSummary -> ContextSummary -> Bool
$c/= :: ContextSummary -> ContextSummary -> Bool
== :: ContextSummary -> ContextSummary -> Bool
$c== :: ContextSummary -> ContextSummary -> Bool
Prelude.Eq, ReadPrec [ContextSummary]
ReadPrec ContextSummary
Int -> ReadS ContextSummary
ReadS [ContextSummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ContextSummary]
$creadListPrec :: ReadPrec [ContextSummary]
readPrec :: ReadPrec ContextSummary
$creadPrec :: ReadPrec ContextSummary
readList :: ReadS [ContextSummary]
$creadList :: ReadS [ContextSummary]
readsPrec :: Int -> ReadS ContextSummary
$creadsPrec :: Int -> ReadS ContextSummary
Prelude.Read, Int -> ContextSummary -> ShowS
[ContextSummary] -> ShowS
ContextSummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ContextSummary] -> ShowS
$cshowList :: [ContextSummary] -> ShowS
show :: ContextSummary -> String
$cshow :: ContextSummary -> String
showsPrec :: Int -> ContextSummary -> ShowS
$cshowsPrec :: Int -> ContextSummary -> ShowS
Prelude.Show, forall x. Rep ContextSummary x -> ContextSummary
forall x. ContextSummary -> Rep ContextSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ContextSummary x -> ContextSummary
$cfrom :: forall x. ContextSummary -> Rep ContextSummary x
Prelude.Generic)

-- |
-- Create a value of 'ContextSummary' 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:
--
-- 'contextArn', 'contextSummary_contextArn' - The Amazon Resource Name (ARN) of the context.
--
-- 'contextName', 'contextSummary_contextName' - The name of the context.
--
-- 'contextType', 'contextSummary_contextType' - The type of the context.
--
-- 'creationTime', 'contextSummary_creationTime' - When the context was created.
--
-- 'lastModifiedTime', 'contextSummary_lastModifiedTime' - When the context was last modified.
--
-- 'source', 'contextSummary_source' - The source of the context.
newContextSummary ::
  ContextSummary
newContextSummary :: ContextSummary
newContextSummary =
  ContextSummary'
    { $sel:contextArn:ContextSummary' :: Maybe Text
contextArn = forall a. Maybe a
Prelude.Nothing,
      $sel:contextName:ContextSummary' :: Maybe Text
contextName = forall a. Maybe a
Prelude.Nothing,
      $sel:contextType:ContextSummary' :: Maybe Text
contextType = forall a. Maybe a
Prelude.Nothing,
      $sel:creationTime:ContextSummary' :: Maybe POSIX
creationTime = forall a. Maybe a
Prelude.Nothing,
      $sel:lastModifiedTime:ContextSummary' :: Maybe POSIX
lastModifiedTime = forall a. Maybe a
Prelude.Nothing,
      $sel:source:ContextSummary' :: Maybe ContextSource
source = forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon Resource Name (ARN) of the context.
contextSummary_contextArn :: Lens.Lens' ContextSummary (Prelude.Maybe Prelude.Text)
contextSummary_contextArn :: Lens' ContextSummary (Maybe Text)
contextSummary_contextArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContextSummary' {Maybe Text
contextArn :: Maybe Text
$sel:contextArn:ContextSummary' :: ContextSummary -> Maybe Text
contextArn} -> Maybe Text
contextArn) (\s :: ContextSummary
s@ContextSummary' {} Maybe Text
a -> ContextSummary
s {$sel:contextArn:ContextSummary' :: Maybe Text
contextArn = Maybe Text
a} :: ContextSummary)

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

-- | The type of the context.
contextSummary_contextType :: Lens.Lens' ContextSummary (Prelude.Maybe Prelude.Text)
contextSummary_contextType :: Lens' ContextSummary (Maybe Text)
contextSummary_contextType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContextSummary' {Maybe Text
contextType :: Maybe Text
$sel:contextType:ContextSummary' :: ContextSummary -> Maybe Text
contextType} -> Maybe Text
contextType) (\s :: ContextSummary
s@ContextSummary' {} Maybe Text
a -> ContextSummary
s {$sel:contextType:ContextSummary' :: Maybe Text
contextType = Maybe Text
a} :: ContextSummary)

-- | When the context was created.
contextSummary_creationTime :: Lens.Lens' ContextSummary (Prelude.Maybe Prelude.UTCTime)
contextSummary_creationTime :: Lens' ContextSummary (Maybe UTCTime)
contextSummary_creationTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContextSummary' {Maybe POSIX
creationTime :: Maybe POSIX
$sel:creationTime:ContextSummary' :: ContextSummary -> Maybe POSIX
creationTime} -> Maybe POSIX
creationTime) (\s :: ContextSummary
s@ContextSummary' {} Maybe POSIX
a -> ContextSummary
s {$sel:creationTime:ContextSummary' :: Maybe POSIX
creationTime = Maybe POSIX
a} :: ContextSummary) 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

-- | When the context was last modified.
contextSummary_lastModifiedTime :: Lens.Lens' ContextSummary (Prelude.Maybe Prelude.UTCTime)
contextSummary_lastModifiedTime :: Lens' ContextSummary (Maybe UTCTime)
contextSummary_lastModifiedTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContextSummary' {Maybe POSIX
lastModifiedTime :: Maybe POSIX
$sel:lastModifiedTime:ContextSummary' :: ContextSummary -> Maybe POSIX
lastModifiedTime} -> Maybe POSIX
lastModifiedTime) (\s :: ContextSummary
s@ContextSummary' {} Maybe POSIX
a -> ContextSummary
s {$sel:lastModifiedTime:ContextSummary' :: Maybe POSIX
lastModifiedTime = Maybe POSIX
a} :: ContextSummary) 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 source of the context.
contextSummary_source :: Lens.Lens' ContextSummary (Prelude.Maybe ContextSource)
contextSummary_source :: Lens' ContextSummary (Maybe ContextSource)
contextSummary_source = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContextSummary' {Maybe ContextSource
source :: Maybe ContextSource
$sel:source:ContextSummary' :: ContextSummary -> Maybe ContextSource
source} -> Maybe ContextSource
source) (\s :: ContextSummary
s@ContextSummary' {} Maybe ContextSource
a -> ContextSummary
s {$sel:source:ContextSummary' :: Maybe ContextSource
source = Maybe ContextSource
a} :: ContextSummary)

instance Data.FromJSON ContextSummary where
  parseJSON :: Value -> Parser ContextSummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ContextSummary"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe POSIX
-> Maybe ContextSource
-> ContextSummary
ContextSummary'
            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
"ContextArn")
            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
"ContextName")
            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
"ContextType")
            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
"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
"Source")
      )

instance Prelude.Hashable ContextSummary where
  hashWithSalt :: Int -> ContextSummary -> Int
hashWithSalt Int
_salt ContextSummary' {Maybe Text
Maybe POSIX
Maybe ContextSource
source :: Maybe ContextSource
lastModifiedTime :: Maybe POSIX
creationTime :: Maybe POSIX
contextType :: Maybe Text
contextName :: Maybe Text
contextArn :: Maybe Text
$sel:source:ContextSummary' :: ContextSummary -> Maybe ContextSource
$sel:lastModifiedTime:ContextSummary' :: ContextSummary -> Maybe POSIX
$sel:creationTime:ContextSummary' :: ContextSummary -> Maybe POSIX
$sel:contextType:ContextSummary' :: ContextSummary -> Maybe Text
$sel:contextName:ContextSummary' :: ContextSummary -> Maybe Text
$sel:contextArn:ContextSummary' :: ContextSummary -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
contextArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
contextName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
contextType
      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 ContextSource
source

instance Prelude.NFData ContextSummary where
  rnf :: ContextSummary -> ()
rnf ContextSummary' {Maybe Text
Maybe POSIX
Maybe ContextSource
source :: Maybe ContextSource
lastModifiedTime :: Maybe POSIX
creationTime :: Maybe POSIX
contextType :: Maybe Text
contextName :: Maybe Text
contextArn :: Maybe Text
$sel:source:ContextSummary' :: ContextSummary -> Maybe ContextSource
$sel:lastModifiedTime:ContextSummary' :: ContextSummary -> Maybe POSIX
$sel:creationTime:ContextSummary' :: ContextSummary -> Maybe POSIX
$sel:contextType:ContextSummary' :: ContextSummary -> Maybe Text
$sel:contextName:ContextSummary' :: ContextSummary -> Maybe Text
$sel:contextArn:ContextSummary' :: ContextSummary -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
contextArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
contextName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
contextType
      seq :: forall a b. a -> b -> b
`Prelude.seq` 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 ContextSource
source