{-# 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.Wisdom.Types.SessionData
-- 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.Wisdom.Types.SessionData where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Information about the session.
--
-- /See:/ 'newSessionData' smart constructor.
data SessionData = SessionData'
  { -- | The description of the session.
    SessionData -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The tags used to organize, track, or control access for this resource.
    SessionData -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The name of the session.
    SessionData -> Text
name :: Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the session.
    SessionData -> Text
sessionArn :: Prelude.Text,
    -- | The identifier of the session.
    SessionData -> Text
sessionId :: Prelude.Text
  }
  deriving (SessionData -> SessionData -> Bool
(SessionData -> SessionData -> Bool)
-> (SessionData -> SessionData -> Bool) -> Eq SessionData
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SessionData -> SessionData -> Bool
$c/= :: SessionData -> SessionData -> Bool
== :: SessionData -> SessionData -> Bool
$c== :: SessionData -> SessionData -> Bool
Prelude.Eq, ReadPrec [SessionData]
ReadPrec SessionData
Int -> ReadS SessionData
ReadS [SessionData]
(Int -> ReadS SessionData)
-> ReadS [SessionData]
-> ReadPrec SessionData
-> ReadPrec [SessionData]
-> Read SessionData
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SessionData]
$creadListPrec :: ReadPrec [SessionData]
readPrec :: ReadPrec SessionData
$creadPrec :: ReadPrec SessionData
readList :: ReadS [SessionData]
$creadList :: ReadS [SessionData]
readsPrec :: Int -> ReadS SessionData
$creadsPrec :: Int -> ReadS SessionData
Prelude.Read, Int -> SessionData -> ShowS
[SessionData] -> ShowS
SessionData -> String
(Int -> SessionData -> ShowS)
-> (SessionData -> String)
-> ([SessionData] -> ShowS)
-> Show SessionData
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SessionData] -> ShowS
$cshowList :: [SessionData] -> ShowS
show :: SessionData -> String
$cshow :: SessionData -> String
showsPrec :: Int -> SessionData -> ShowS
$cshowsPrec :: Int -> SessionData -> ShowS
Prelude.Show, (forall x. SessionData -> Rep SessionData x)
-> (forall x. Rep SessionData x -> SessionData)
-> Generic SessionData
forall x. Rep SessionData x -> SessionData
forall x. SessionData -> Rep SessionData x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SessionData x -> SessionData
$cfrom :: forall x. SessionData -> Rep SessionData x
Prelude.Generic)

-- |
-- Create a value of 'SessionData' 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:
--
-- 'description', 'sessionData_description' - The description of the session.
--
-- 'tags', 'sessionData_tags' - The tags used to organize, track, or control access for this resource.
--
-- 'name', 'sessionData_name' - The name of the session.
--
-- 'sessionArn', 'sessionData_sessionArn' - The Amazon Resource Name (ARN) of the session.
--
-- 'sessionId', 'sessionData_sessionId' - The identifier of the session.
newSessionData ::
  -- | 'name'
  Prelude.Text ->
  -- | 'sessionArn'
  Prelude.Text ->
  -- | 'sessionId'
  Prelude.Text ->
  SessionData
newSessionData :: Text -> Text -> Text -> SessionData
newSessionData Text
pName_ Text
pSessionArn_ Text
pSessionId_ =
  SessionData' :: Maybe Text
-> Maybe (HashMap Text Text) -> Text -> Text -> Text -> SessionData
SessionData'
    { $sel:description:SessionData' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:tags:SessionData' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:name:SessionData' :: Text
name = Text
pName_,
      $sel:sessionArn:SessionData' :: Text
sessionArn = Text
pSessionArn_,
      $sel:sessionId:SessionData' :: Text
sessionId = Text
pSessionId_
    }

-- | The description of the session.
sessionData_description :: Lens.Lens' SessionData (Prelude.Maybe Prelude.Text)
sessionData_description :: (Maybe Text -> f (Maybe Text)) -> SessionData -> f SessionData
sessionData_description = (SessionData -> Maybe Text)
-> (SessionData -> Maybe Text -> SessionData)
-> Lens SessionData SessionData (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SessionData' {Maybe Text
description :: Maybe Text
$sel:description:SessionData' :: SessionData -> Maybe Text
description} -> Maybe Text
description) (\s :: SessionData
s@SessionData' {} Maybe Text
a -> SessionData
s {$sel:description:SessionData' :: Maybe Text
description = Maybe Text
a} :: SessionData)

-- | The tags used to organize, track, or control access for this resource.
sessionData_tags :: Lens.Lens' SessionData (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
sessionData_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> SessionData -> f SessionData
sessionData_tags = (SessionData -> Maybe (HashMap Text Text))
-> (SessionData -> Maybe (HashMap Text Text) -> SessionData)
-> Lens
     SessionData
     SessionData
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SessionData' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:SessionData' :: SessionData -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: SessionData
s@SessionData' {} Maybe (HashMap Text Text)
a -> SessionData
s {$sel:tags:SessionData' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: SessionData) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> SessionData -> f SessionData)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> SessionData
-> f SessionData
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
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
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The name of the session.
sessionData_name :: Lens.Lens' SessionData Prelude.Text
sessionData_name :: (Text -> f Text) -> SessionData -> f SessionData
sessionData_name = (SessionData -> Text)
-> (SessionData -> Text -> SessionData)
-> Lens SessionData SessionData Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SessionData' {Text
name :: Text
$sel:name:SessionData' :: SessionData -> Text
name} -> Text
name) (\s :: SessionData
s@SessionData' {} Text
a -> SessionData
s {$sel:name:SessionData' :: Text
name = Text
a} :: SessionData)

-- | The Amazon Resource Name (ARN) of the session.
sessionData_sessionArn :: Lens.Lens' SessionData Prelude.Text
sessionData_sessionArn :: (Text -> f Text) -> SessionData -> f SessionData
sessionData_sessionArn = (SessionData -> Text)
-> (SessionData -> Text -> SessionData)
-> Lens SessionData SessionData Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SessionData' {Text
sessionArn :: Text
$sel:sessionArn:SessionData' :: SessionData -> Text
sessionArn} -> Text
sessionArn) (\s :: SessionData
s@SessionData' {} Text
a -> SessionData
s {$sel:sessionArn:SessionData' :: Text
sessionArn = Text
a} :: SessionData)

-- | The identifier of the session.
sessionData_sessionId :: Lens.Lens' SessionData Prelude.Text
sessionData_sessionId :: (Text -> f Text) -> SessionData -> f SessionData
sessionData_sessionId = (SessionData -> Text)
-> (SessionData -> Text -> SessionData)
-> Lens SessionData SessionData Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SessionData' {Text
sessionId :: Text
$sel:sessionId:SessionData' :: SessionData -> Text
sessionId} -> Text
sessionId) (\s :: SessionData
s@SessionData' {} Text
a -> SessionData
s {$sel:sessionId:SessionData' :: Text
sessionId = Text
a} :: SessionData)

instance Core.FromJSON SessionData where
  parseJSON :: Value -> Parser SessionData
parseJSON =
    String
-> (Object -> Parser SessionData) -> Value -> Parser SessionData
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"SessionData"
      ( \Object
x ->
          Maybe Text
-> Maybe (HashMap Text Text) -> Text -> Text -> Text -> SessionData
SessionData'
            (Maybe Text
 -> Maybe (HashMap Text Text)
 -> Text
 -> Text
 -> Text
 -> SessionData)
-> Parser (Maybe Text)
-> Parser
     (Maybe (HashMap Text Text) -> Text -> Text -> Text -> SessionData)
forall (f :: * -> *) a b. Functor 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")
            Parser
  (Maybe (HashMap Text Text) -> Text -> Text -> Text -> SessionData)
-> Parser (Maybe (HashMap Text Text))
-> Parser (Text -> Text -> Text -> SessionData)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe (HashMap Text Text)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"tags" Parser (Maybe (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> Parser (Maybe (HashMap Text Text))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text Text)
forall a. Monoid a => a
Prelude.mempty)
            Parser (Text -> Text -> Text -> SessionData)
-> Parser Text -> Parser (Text -> Text -> SessionData)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"name")
            Parser (Text -> Text -> SessionData)
-> Parser Text -> Parser (Text -> SessionData)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"sessionArn")
            Parser (Text -> SessionData) -> Parser Text -> Parser SessionData
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"sessionId")
      )

instance Prelude.Hashable SessionData

instance Prelude.NFData SessionData