{-# 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.QLDBSession.Types.StartSessionRequest
-- 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.QLDBSession.Types.StartSessionRequest where

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

-- | Specifies a request to start a new session.
--
-- /See:/ 'newStartSessionRequest' smart constructor.
data StartSessionRequest = StartSessionRequest'
  { -- | The name of the ledger to start a new session against.
    StartSessionRequest -> Text
ledgerName :: Prelude.Text
  }
  deriving (StartSessionRequest -> StartSessionRequest -> Bool
(StartSessionRequest -> StartSessionRequest -> Bool)
-> (StartSessionRequest -> StartSessionRequest -> Bool)
-> Eq StartSessionRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartSessionRequest -> StartSessionRequest -> Bool
$c/= :: StartSessionRequest -> StartSessionRequest -> Bool
== :: StartSessionRequest -> StartSessionRequest -> Bool
$c== :: StartSessionRequest -> StartSessionRequest -> Bool
Prelude.Eq, ReadPrec [StartSessionRequest]
ReadPrec StartSessionRequest
Int -> ReadS StartSessionRequest
ReadS [StartSessionRequest]
(Int -> ReadS StartSessionRequest)
-> ReadS [StartSessionRequest]
-> ReadPrec StartSessionRequest
-> ReadPrec [StartSessionRequest]
-> Read StartSessionRequest
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartSessionRequest]
$creadListPrec :: ReadPrec [StartSessionRequest]
readPrec :: ReadPrec StartSessionRequest
$creadPrec :: ReadPrec StartSessionRequest
readList :: ReadS [StartSessionRequest]
$creadList :: ReadS [StartSessionRequest]
readsPrec :: Int -> ReadS StartSessionRequest
$creadsPrec :: Int -> ReadS StartSessionRequest
Prelude.Read, Int -> StartSessionRequest -> ShowS
[StartSessionRequest] -> ShowS
StartSessionRequest -> String
(Int -> StartSessionRequest -> ShowS)
-> (StartSessionRequest -> String)
-> ([StartSessionRequest] -> ShowS)
-> Show StartSessionRequest
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartSessionRequest] -> ShowS
$cshowList :: [StartSessionRequest] -> ShowS
show :: StartSessionRequest -> String
$cshow :: StartSessionRequest -> String
showsPrec :: Int -> StartSessionRequest -> ShowS
$cshowsPrec :: Int -> StartSessionRequest -> ShowS
Prelude.Show, (forall x. StartSessionRequest -> Rep StartSessionRequest x)
-> (forall x. Rep StartSessionRequest x -> StartSessionRequest)
-> Generic StartSessionRequest
forall x. Rep StartSessionRequest x -> StartSessionRequest
forall x. StartSessionRequest -> Rep StartSessionRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StartSessionRequest x -> StartSessionRequest
$cfrom :: forall x. StartSessionRequest -> Rep StartSessionRequest x
Prelude.Generic)

-- |
-- Create a value of 'StartSessionRequest' 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:
--
-- 'ledgerName', 'startSessionRequest_ledgerName' - The name of the ledger to start a new session against.
newStartSessionRequest ::
  -- | 'ledgerName'
  Prelude.Text ->
  StartSessionRequest
newStartSessionRequest :: Text -> StartSessionRequest
newStartSessionRequest Text
pLedgerName_ =
  StartSessionRequest' :: Text -> StartSessionRequest
StartSessionRequest' {$sel:ledgerName:StartSessionRequest' :: Text
ledgerName = Text
pLedgerName_}

-- | The name of the ledger to start a new session against.
startSessionRequest_ledgerName :: Lens.Lens' StartSessionRequest Prelude.Text
startSessionRequest_ledgerName :: (Text -> f Text) -> StartSessionRequest -> f StartSessionRequest
startSessionRequest_ledgerName = (StartSessionRequest -> Text)
-> (StartSessionRequest -> Text -> StartSessionRequest)
-> Lens StartSessionRequest StartSessionRequest Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartSessionRequest' {Text
ledgerName :: Text
$sel:ledgerName:StartSessionRequest' :: StartSessionRequest -> Text
ledgerName} -> Text
ledgerName) (\s :: StartSessionRequest
s@StartSessionRequest' {} Text
a -> StartSessionRequest
s {$sel:ledgerName:StartSessionRequest' :: Text
ledgerName = Text
a} :: StartSessionRequest)

instance Prelude.Hashable StartSessionRequest

instance Prelude.NFData StartSessionRequest

instance Core.ToJSON StartSessionRequest where
  toJSON :: StartSessionRequest -> Value
toJSON StartSessionRequest' {Text
ledgerName :: Text
$sel:ledgerName:StartSessionRequest' :: StartSessionRequest -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"LedgerName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
ledgerName)]
      )