{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.QLDB.CreateLedger
-- 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)
--
-- Creates a new ledger in your account in the current Region.
module Amazonka.QLDB.CreateLedger
  ( -- * Creating a Request
    CreateLedger (..),
    newCreateLedger,

    -- * Request Lenses
    createLedger_deletionProtection,
    createLedger_kmsKey,
    createLedger_tags,
    createLedger_name,
    createLedger_permissionsMode,

    -- * Destructuring the Response
    CreateLedgerResponse (..),
    newCreateLedgerResponse,

    -- * Response Lenses
    createLedgerResponse_state,
    createLedgerResponse_deletionProtection,
    createLedgerResponse_kmsKeyArn,
    createLedgerResponse_arn,
    createLedgerResponse_name,
    createLedgerResponse_creationDateTime,
    createLedgerResponse_permissionsMode,
    createLedgerResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.QLDB.Types
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newCreateLedger' smart constructor.
data CreateLedger = CreateLedger'
  { -- | The flag that prevents a ledger from being deleted by any user. If not
    -- provided on ledger creation, this feature is enabled (@true@) by
    -- default.
    --
    -- If deletion protection is enabled, you must first disable it before you
    -- can delete the ledger. You can disable it by calling the @UpdateLedger@
    -- operation to set the flag to @false@.
    CreateLedger -> Maybe Bool
deletionProtection :: Prelude.Maybe Prelude.Bool,
    -- | The key in Key Management Service (KMS) to use for encryption of data at
    -- rest in the ledger. For more information, see
    -- <https://docs.aws.amazon.com/qldb/latest/developerguide/encryption-at-rest.html Encryption at rest>
    -- in the /Amazon QLDB Developer Guide/.
    --
    -- Use one of the following options to specify this parameter:
    --
    -- -   @AWS_OWNED_KMS_KEY@: Use an KMS key that is owned and managed by
    --     Amazon Web Services on your behalf.
    --
    -- -   __Undefined__: By default, use an Amazon Web Services owned KMS key.
    --
    -- -   __A valid symmetric customer managed KMS key__: Use the specified
    --     KMS key in your account that you create, own, and manage.
    --
    --     Amazon QLDB does not support asymmetric keys. For more information,
    --     see
    --     <https://docs.aws.amazon.com/kms/latest/developerguide/symmetric-asymmetric.html Using symmetric and asymmetric keys>
    --     in the /Key Management Service Developer Guide/.
    --
    -- To specify a customer managed KMS key, you can use its key ID, Amazon
    -- Resource Name (ARN), alias name, or alias ARN. When using an alias name,
    -- prefix it with @\"alias\/\"@. To specify a key in a different account,
    -- you must use the key ARN or alias ARN.
    --
    -- For example:
    --
    -- -   Key ID: @1234abcd-12ab-34cd-56ef-1234567890ab@
    --
    -- -   Key ARN:
    --     @arn:aws:kms:us-east-2:111122223333:key\/1234abcd-12ab-34cd-56ef-1234567890ab@
    --
    -- -   Alias name: @alias\/ExampleAlias@
    --
    -- -   Alias ARN: @arn:aws:kms:us-east-2:111122223333:alias\/ExampleAlias@
    --
    -- For more information, see
    -- <https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#key-id Key identifiers (KeyId)>
    -- in the /Key Management Service Developer Guide/.
    CreateLedger -> Maybe Text
kmsKey :: Prelude.Maybe Prelude.Text,
    -- | The key-value pairs to add as tags to the ledger that you want to
    -- create. Tag keys are case sensitive. Tag values are case sensitive and
    -- can be null.
    CreateLedger -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The name of the ledger that you want to create. The name must be unique
    -- among all of the ledgers in your account in the current Region.
    --
    -- Naming constraints for ledger names are defined in
    -- <https://docs.aws.amazon.com/qldb/latest/developerguide/limits.html#limits.naming Quotas in Amazon QLDB>
    -- in the /Amazon QLDB Developer Guide/.
    CreateLedger -> Text
name :: Prelude.Text,
    -- | The permissions mode to assign to the ledger that you want to create.
    -- This parameter can have one of the following values:
    --
    -- -   @ALLOW_ALL@: A legacy permissions mode that enables access control
    --     with API-level granularity for ledgers.
    --
    --     This mode allows users who have the @SendCommand@ API permission for
    --     this ledger to run all PartiQL commands (hence, @ALLOW_ALL@) on any
    --     tables in the specified ledger. This mode disregards any table-level
    --     or command-level IAM permissions policies that you create for the
    --     ledger.
    --
    -- -   @STANDARD@: (/Recommended/) A permissions mode that enables access
    --     control with finer granularity for ledgers, tables, and PartiQL
    --     commands.
    --
    --     By default, this mode denies all user requests to run any PartiQL
    --     commands on any tables in this ledger. To allow PartiQL commands to
    --     run, you must create IAM permissions policies for specific table
    --     resources and PartiQL actions, in addition to the @SendCommand@ API
    --     permission for the ledger. For information, see
    --     <https://docs.aws.amazon.com/qldb/latest/developerguide/getting-started-standard-mode.html Getting started with the standard permissions mode>
    --     in the /Amazon QLDB Developer Guide/.
    --
    -- We strongly recommend using the @STANDARD@ permissions mode to maximize
    -- the security of your ledger data.
    CreateLedger -> PermissionsMode
permissionsMode :: PermissionsMode
  }
  deriving (CreateLedger -> CreateLedger -> Bool
(CreateLedger -> CreateLedger -> Bool)
-> (CreateLedger -> CreateLedger -> Bool) -> Eq CreateLedger
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateLedger -> CreateLedger -> Bool
$c/= :: CreateLedger -> CreateLedger -> Bool
== :: CreateLedger -> CreateLedger -> Bool
$c== :: CreateLedger -> CreateLedger -> Bool
Prelude.Eq, ReadPrec [CreateLedger]
ReadPrec CreateLedger
Int -> ReadS CreateLedger
ReadS [CreateLedger]
(Int -> ReadS CreateLedger)
-> ReadS [CreateLedger]
-> ReadPrec CreateLedger
-> ReadPrec [CreateLedger]
-> Read CreateLedger
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateLedger]
$creadListPrec :: ReadPrec [CreateLedger]
readPrec :: ReadPrec CreateLedger
$creadPrec :: ReadPrec CreateLedger
readList :: ReadS [CreateLedger]
$creadList :: ReadS [CreateLedger]
readsPrec :: Int -> ReadS CreateLedger
$creadsPrec :: Int -> ReadS CreateLedger
Prelude.Read, Int -> CreateLedger -> ShowS
[CreateLedger] -> ShowS
CreateLedger -> String
(Int -> CreateLedger -> ShowS)
-> (CreateLedger -> String)
-> ([CreateLedger] -> ShowS)
-> Show CreateLedger
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateLedger] -> ShowS
$cshowList :: [CreateLedger] -> ShowS
show :: CreateLedger -> String
$cshow :: CreateLedger -> String
showsPrec :: Int -> CreateLedger -> ShowS
$cshowsPrec :: Int -> CreateLedger -> ShowS
Prelude.Show, (forall x. CreateLedger -> Rep CreateLedger x)
-> (forall x. Rep CreateLedger x -> CreateLedger)
-> Generic CreateLedger
forall x. Rep CreateLedger x -> CreateLedger
forall x. CreateLedger -> Rep CreateLedger x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateLedger x -> CreateLedger
$cfrom :: forall x. CreateLedger -> Rep CreateLedger x
Prelude.Generic)

-- |
-- Create a value of 'CreateLedger' 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:
--
-- 'deletionProtection', 'createLedger_deletionProtection' - The flag that prevents a ledger from being deleted by any user. If not
-- provided on ledger creation, this feature is enabled (@true@) by
-- default.
--
-- If deletion protection is enabled, you must first disable it before you
-- can delete the ledger. You can disable it by calling the @UpdateLedger@
-- operation to set the flag to @false@.
--
-- 'kmsKey', 'createLedger_kmsKey' - The key in Key Management Service (KMS) to use for encryption of data at
-- rest in the ledger. For more information, see
-- <https://docs.aws.amazon.com/qldb/latest/developerguide/encryption-at-rest.html Encryption at rest>
-- in the /Amazon QLDB Developer Guide/.
--
-- Use one of the following options to specify this parameter:
--
-- -   @AWS_OWNED_KMS_KEY@: Use an KMS key that is owned and managed by
--     Amazon Web Services on your behalf.
--
-- -   __Undefined__: By default, use an Amazon Web Services owned KMS key.
--
-- -   __A valid symmetric customer managed KMS key__: Use the specified
--     KMS key in your account that you create, own, and manage.
--
--     Amazon QLDB does not support asymmetric keys. For more information,
--     see
--     <https://docs.aws.amazon.com/kms/latest/developerguide/symmetric-asymmetric.html Using symmetric and asymmetric keys>
--     in the /Key Management Service Developer Guide/.
--
-- To specify a customer managed KMS key, you can use its key ID, Amazon
-- Resource Name (ARN), alias name, or alias ARN. When using an alias name,
-- prefix it with @\"alias\/\"@. To specify a key in a different account,
-- you must use the key ARN or alias ARN.
--
-- For example:
--
-- -   Key ID: @1234abcd-12ab-34cd-56ef-1234567890ab@
--
-- -   Key ARN:
--     @arn:aws:kms:us-east-2:111122223333:key\/1234abcd-12ab-34cd-56ef-1234567890ab@
--
-- -   Alias name: @alias\/ExampleAlias@
--
-- -   Alias ARN: @arn:aws:kms:us-east-2:111122223333:alias\/ExampleAlias@
--
-- For more information, see
-- <https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#key-id Key identifiers (KeyId)>
-- in the /Key Management Service Developer Guide/.
--
-- 'tags', 'createLedger_tags' - The key-value pairs to add as tags to the ledger that you want to
-- create. Tag keys are case sensitive. Tag values are case sensitive and
-- can be null.
--
-- 'name', 'createLedger_name' - The name of the ledger that you want to create. The name must be unique
-- among all of the ledgers in your account in the current Region.
--
-- Naming constraints for ledger names are defined in
-- <https://docs.aws.amazon.com/qldb/latest/developerguide/limits.html#limits.naming Quotas in Amazon QLDB>
-- in the /Amazon QLDB Developer Guide/.
--
-- 'permissionsMode', 'createLedger_permissionsMode' - The permissions mode to assign to the ledger that you want to create.
-- This parameter can have one of the following values:
--
-- -   @ALLOW_ALL@: A legacy permissions mode that enables access control
--     with API-level granularity for ledgers.
--
--     This mode allows users who have the @SendCommand@ API permission for
--     this ledger to run all PartiQL commands (hence, @ALLOW_ALL@) on any
--     tables in the specified ledger. This mode disregards any table-level
--     or command-level IAM permissions policies that you create for the
--     ledger.
--
-- -   @STANDARD@: (/Recommended/) A permissions mode that enables access
--     control with finer granularity for ledgers, tables, and PartiQL
--     commands.
--
--     By default, this mode denies all user requests to run any PartiQL
--     commands on any tables in this ledger. To allow PartiQL commands to
--     run, you must create IAM permissions policies for specific table
--     resources and PartiQL actions, in addition to the @SendCommand@ API
--     permission for the ledger. For information, see
--     <https://docs.aws.amazon.com/qldb/latest/developerguide/getting-started-standard-mode.html Getting started with the standard permissions mode>
--     in the /Amazon QLDB Developer Guide/.
--
-- We strongly recommend using the @STANDARD@ permissions mode to maximize
-- the security of your ledger data.
newCreateLedger ::
  -- | 'name'
  Prelude.Text ->
  -- | 'permissionsMode'
  PermissionsMode ->
  CreateLedger
newCreateLedger :: Text -> PermissionsMode -> CreateLedger
newCreateLedger Text
pName_ PermissionsMode
pPermissionsMode_ =
  CreateLedger' :: Maybe Bool
-> Maybe Text
-> Maybe (HashMap Text Text)
-> Text
-> PermissionsMode
-> CreateLedger
CreateLedger'
    { $sel:deletionProtection:CreateLedger' :: Maybe Bool
deletionProtection = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:kmsKey:CreateLedger' :: Maybe Text
kmsKey = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:tags:CreateLedger' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:name:CreateLedger' :: Text
name = Text
pName_,
      $sel:permissionsMode:CreateLedger' :: PermissionsMode
permissionsMode = PermissionsMode
pPermissionsMode_
    }

-- | The flag that prevents a ledger from being deleted by any user. If not
-- provided on ledger creation, this feature is enabled (@true@) by
-- default.
--
-- If deletion protection is enabled, you must first disable it before you
-- can delete the ledger. You can disable it by calling the @UpdateLedger@
-- operation to set the flag to @false@.
createLedger_deletionProtection :: Lens.Lens' CreateLedger (Prelude.Maybe Prelude.Bool)
createLedger_deletionProtection :: (Maybe Bool -> f (Maybe Bool)) -> CreateLedger -> f CreateLedger
createLedger_deletionProtection = (CreateLedger -> Maybe Bool)
-> (CreateLedger -> Maybe Bool -> CreateLedger)
-> Lens CreateLedger CreateLedger (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLedger' {Maybe Bool
deletionProtection :: Maybe Bool
$sel:deletionProtection:CreateLedger' :: CreateLedger -> Maybe Bool
deletionProtection} -> Maybe Bool
deletionProtection) (\s :: CreateLedger
s@CreateLedger' {} Maybe Bool
a -> CreateLedger
s {$sel:deletionProtection:CreateLedger' :: Maybe Bool
deletionProtection = Maybe Bool
a} :: CreateLedger)

-- | The key in Key Management Service (KMS) to use for encryption of data at
-- rest in the ledger. For more information, see
-- <https://docs.aws.amazon.com/qldb/latest/developerguide/encryption-at-rest.html Encryption at rest>
-- in the /Amazon QLDB Developer Guide/.
--
-- Use one of the following options to specify this parameter:
--
-- -   @AWS_OWNED_KMS_KEY@: Use an KMS key that is owned and managed by
--     Amazon Web Services on your behalf.
--
-- -   __Undefined__: By default, use an Amazon Web Services owned KMS key.
--
-- -   __A valid symmetric customer managed KMS key__: Use the specified
--     KMS key in your account that you create, own, and manage.
--
--     Amazon QLDB does not support asymmetric keys. For more information,
--     see
--     <https://docs.aws.amazon.com/kms/latest/developerguide/symmetric-asymmetric.html Using symmetric and asymmetric keys>
--     in the /Key Management Service Developer Guide/.
--
-- To specify a customer managed KMS key, you can use its key ID, Amazon
-- Resource Name (ARN), alias name, or alias ARN. When using an alias name,
-- prefix it with @\"alias\/\"@. To specify a key in a different account,
-- you must use the key ARN or alias ARN.
--
-- For example:
--
-- -   Key ID: @1234abcd-12ab-34cd-56ef-1234567890ab@
--
-- -   Key ARN:
--     @arn:aws:kms:us-east-2:111122223333:key\/1234abcd-12ab-34cd-56ef-1234567890ab@
--
-- -   Alias name: @alias\/ExampleAlias@
--
-- -   Alias ARN: @arn:aws:kms:us-east-2:111122223333:alias\/ExampleAlias@
--
-- For more information, see
-- <https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#key-id Key identifiers (KeyId)>
-- in the /Key Management Service Developer Guide/.
createLedger_kmsKey :: Lens.Lens' CreateLedger (Prelude.Maybe Prelude.Text)
createLedger_kmsKey :: (Maybe Text -> f (Maybe Text)) -> CreateLedger -> f CreateLedger
createLedger_kmsKey = (CreateLedger -> Maybe Text)
-> (CreateLedger -> Maybe Text -> CreateLedger)
-> Lens CreateLedger CreateLedger (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLedger' {Maybe Text
kmsKey :: Maybe Text
$sel:kmsKey:CreateLedger' :: CreateLedger -> Maybe Text
kmsKey} -> Maybe Text
kmsKey) (\s :: CreateLedger
s@CreateLedger' {} Maybe Text
a -> CreateLedger
s {$sel:kmsKey:CreateLedger' :: Maybe Text
kmsKey = Maybe Text
a} :: CreateLedger)

-- | The key-value pairs to add as tags to the ledger that you want to
-- create. Tag keys are case sensitive. Tag values are case sensitive and
-- can be null.
createLedger_tags :: Lens.Lens' CreateLedger (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createLedger_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateLedger -> f CreateLedger
createLedger_tags = (CreateLedger -> Maybe (HashMap Text Text))
-> (CreateLedger -> Maybe (HashMap Text Text) -> CreateLedger)
-> Lens
     CreateLedger
     CreateLedger
     (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 (\CreateLedger' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:CreateLedger' :: CreateLedger -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: CreateLedger
s@CreateLedger' {} Maybe (HashMap Text Text)
a -> CreateLedger
s {$sel:tags:CreateLedger' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: CreateLedger) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> CreateLedger -> f CreateLedger)
-> ((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)))
-> CreateLedger
-> f CreateLedger
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 ledger that you want to create. The name must be unique
-- among all of the ledgers in your account in the current Region.
--
-- Naming constraints for ledger names are defined in
-- <https://docs.aws.amazon.com/qldb/latest/developerguide/limits.html#limits.naming Quotas in Amazon QLDB>
-- in the /Amazon QLDB Developer Guide/.
createLedger_name :: Lens.Lens' CreateLedger Prelude.Text
createLedger_name :: (Text -> f Text) -> CreateLedger -> f CreateLedger
createLedger_name = (CreateLedger -> Text)
-> (CreateLedger -> Text -> CreateLedger)
-> Lens CreateLedger CreateLedger Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLedger' {Text
name :: Text
$sel:name:CreateLedger' :: CreateLedger -> Text
name} -> Text
name) (\s :: CreateLedger
s@CreateLedger' {} Text
a -> CreateLedger
s {$sel:name:CreateLedger' :: Text
name = Text
a} :: CreateLedger)

-- | The permissions mode to assign to the ledger that you want to create.
-- This parameter can have one of the following values:
--
-- -   @ALLOW_ALL@: A legacy permissions mode that enables access control
--     with API-level granularity for ledgers.
--
--     This mode allows users who have the @SendCommand@ API permission for
--     this ledger to run all PartiQL commands (hence, @ALLOW_ALL@) on any
--     tables in the specified ledger. This mode disregards any table-level
--     or command-level IAM permissions policies that you create for the
--     ledger.
--
-- -   @STANDARD@: (/Recommended/) A permissions mode that enables access
--     control with finer granularity for ledgers, tables, and PartiQL
--     commands.
--
--     By default, this mode denies all user requests to run any PartiQL
--     commands on any tables in this ledger. To allow PartiQL commands to
--     run, you must create IAM permissions policies for specific table
--     resources and PartiQL actions, in addition to the @SendCommand@ API
--     permission for the ledger. For information, see
--     <https://docs.aws.amazon.com/qldb/latest/developerguide/getting-started-standard-mode.html Getting started with the standard permissions mode>
--     in the /Amazon QLDB Developer Guide/.
--
-- We strongly recommend using the @STANDARD@ permissions mode to maximize
-- the security of your ledger data.
createLedger_permissionsMode :: Lens.Lens' CreateLedger PermissionsMode
createLedger_permissionsMode :: (PermissionsMode -> f PermissionsMode)
-> CreateLedger -> f CreateLedger
createLedger_permissionsMode = (CreateLedger -> PermissionsMode)
-> (CreateLedger -> PermissionsMode -> CreateLedger)
-> Lens CreateLedger CreateLedger PermissionsMode PermissionsMode
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLedger' {PermissionsMode
permissionsMode :: PermissionsMode
$sel:permissionsMode:CreateLedger' :: CreateLedger -> PermissionsMode
permissionsMode} -> PermissionsMode
permissionsMode) (\s :: CreateLedger
s@CreateLedger' {} PermissionsMode
a -> CreateLedger
s {$sel:permissionsMode:CreateLedger' :: PermissionsMode
permissionsMode = PermissionsMode
a} :: CreateLedger)

instance Core.AWSRequest CreateLedger where
  type AWSResponse CreateLedger = CreateLedgerResponse
  request :: CreateLedger -> Request CreateLedger
request = Service -> CreateLedger -> Request CreateLedger
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateLedger
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateLedger)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateLedger))
-> Logger
-> Service
-> Proxy CreateLedger
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateLedger)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe LedgerState
-> Maybe Bool
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe PermissionsMode
-> Int
-> CreateLedgerResponse
CreateLedgerResponse'
            (Maybe LedgerState
 -> Maybe Bool
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe POSIX
 -> Maybe PermissionsMode
 -> Int
 -> CreateLedgerResponse)
-> Either String (Maybe LedgerState)
-> Either
     String
     (Maybe Bool
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe PermissionsMode
      -> Int
      -> CreateLedgerResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe LedgerState)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"State")
            Either
  String
  (Maybe Bool
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe PermissionsMode
   -> Int
   -> CreateLedgerResponse)
-> Either String (Maybe Bool)
-> Either
     String
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe PermissionsMode
      -> Int
      -> CreateLedgerResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"DeletionProtection")
            Either
  String
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe PermissionsMode
   -> Int
   -> CreateLedgerResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe PermissionsMode
      -> Int
      -> CreateLedgerResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"KmsKeyArn")
            Either
  String
  (Maybe Text
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe PermissionsMode
   -> Int
   -> CreateLedgerResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe POSIX
      -> Maybe PermissionsMode
      -> Int
      -> CreateLedgerResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Arn")
            Either
  String
  (Maybe Text
   -> Maybe POSIX
   -> Maybe PermissionsMode
   -> Int
   -> CreateLedgerResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe POSIX
      -> Maybe PermissionsMode -> Int -> CreateLedgerResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Name")
            Either
  String
  (Maybe POSIX
   -> Maybe PermissionsMode -> Int -> CreateLedgerResponse)
-> Either String (Maybe POSIX)
-> Either
     String (Maybe PermissionsMode -> Int -> CreateLedgerResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"CreationDateTime")
            Either
  String (Maybe PermissionsMode -> Int -> CreateLedgerResponse)
-> Either String (Maybe PermissionsMode)
-> Either String (Int -> CreateLedgerResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe PermissionsMode)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"PermissionsMode")
            Either String (Int -> CreateLedgerResponse)
-> Either String Int -> Either String CreateLedgerResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable CreateLedger

instance Prelude.NFData CreateLedger

instance Core.ToHeaders CreateLedger where
  toHeaders :: CreateLedger -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateLedger -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.0" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON CreateLedger where
  toJSON :: CreateLedger -> Value
toJSON CreateLedger' {Maybe Bool
Maybe Text
Maybe (HashMap Text Text)
Text
PermissionsMode
permissionsMode :: PermissionsMode
name :: Text
tags :: Maybe (HashMap Text Text)
kmsKey :: Maybe Text
deletionProtection :: Maybe Bool
$sel:permissionsMode:CreateLedger' :: CreateLedger -> PermissionsMode
$sel:name:CreateLedger' :: CreateLedger -> Text
$sel:tags:CreateLedger' :: CreateLedger -> Maybe (HashMap Text Text)
$sel:kmsKey:CreateLedger' :: CreateLedger -> Maybe Text
$sel:deletionProtection:CreateLedger' :: CreateLedger -> Maybe Bool
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"DeletionProtection" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
deletionProtection,
            (Text
"KmsKey" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
kmsKey,
            (Text
"Tags" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
tags,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"PermissionsMode" Text -> PermissionsMode -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= PermissionsMode
permissionsMode)
          ]
      )

instance Core.ToPath CreateLedger where
  toPath :: CreateLedger -> ByteString
toPath = ByteString -> CreateLedger -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/ledgers"

instance Core.ToQuery CreateLedger where
  toQuery :: CreateLedger -> QueryString
toQuery = QueryString -> CreateLedger -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newCreateLedgerResponse' smart constructor.
data CreateLedgerResponse = CreateLedgerResponse'
  { -- | The current status of the ledger.
    CreateLedgerResponse -> Maybe LedgerState
state :: Prelude.Maybe LedgerState,
    -- | The flag that prevents a ledger from being deleted by any user. If not
    -- provided on ledger creation, this feature is enabled (@true@) by
    -- default.
    --
    -- If deletion protection is enabled, you must first disable it before you
    -- can delete the ledger. You can disable it by calling the @UpdateLedger@
    -- operation to set the flag to @false@.
    CreateLedgerResponse -> Maybe Bool
deletionProtection :: Prelude.Maybe Prelude.Bool,
    -- | The ARN of the customer managed KMS key that the ledger uses for
    -- encryption at rest. If this parameter is undefined, the ledger uses an
    -- Amazon Web Services owned KMS key for encryption.
    CreateLedgerResponse -> Maybe Text
kmsKeyArn :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) for the ledger.
    CreateLedgerResponse -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The name of the ledger.
    CreateLedgerResponse -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The date and time, in epoch time format, when the ledger was created.
    -- (Epoch time format is the number of seconds elapsed since 12:00:00 AM
    -- January 1, 1970 UTC.)
    CreateLedgerResponse -> Maybe POSIX
creationDateTime :: Prelude.Maybe Core.POSIX,
    -- | The permissions mode of the ledger that you created.
    CreateLedgerResponse -> Maybe PermissionsMode
permissionsMode :: Prelude.Maybe PermissionsMode,
    -- | The response's http status code.
    CreateLedgerResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateLedgerResponse -> CreateLedgerResponse -> Bool
(CreateLedgerResponse -> CreateLedgerResponse -> Bool)
-> (CreateLedgerResponse -> CreateLedgerResponse -> Bool)
-> Eq CreateLedgerResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateLedgerResponse -> CreateLedgerResponse -> Bool
$c/= :: CreateLedgerResponse -> CreateLedgerResponse -> Bool
== :: CreateLedgerResponse -> CreateLedgerResponse -> Bool
$c== :: CreateLedgerResponse -> CreateLedgerResponse -> Bool
Prelude.Eq, ReadPrec [CreateLedgerResponse]
ReadPrec CreateLedgerResponse
Int -> ReadS CreateLedgerResponse
ReadS [CreateLedgerResponse]
(Int -> ReadS CreateLedgerResponse)
-> ReadS [CreateLedgerResponse]
-> ReadPrec CreateLedgerResponse
-> ReadPrec [CreateLedgerResponse]
-> Read CreateLedgerResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateLedgerResponse]
$creadListPrec :: ReadPrec [CreateLedgerResponse]
readPrec :: ReadPrec CreateLedgerResponse
$creadPrec :: ReadPrec CreateLedgerResponse
readList :: ReadS [CreateLedgerResponse]
$creadList :: ReadS [CreateLedgerResponse]
readsPrec :: Int -> ReadS CreateLedgerResponse
$creadsPrec :: Int -> ReadS CreateLedgerResponse
Prelude.Read, Int -> CreateLedgerResponse -> ShowS
[CreateLedgerResponse] -> ShowS
CreateLedgerResponse -> String
(Int -> CreateLedgerResponse -> ShowS)
-> (CreateLedgerResponse -> String)
-> ([CreateLedgerResponse] -> ShowS)
-> Show CreateLedgerResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateLedgerResponse] -> ShowS
$cshowList :: [CreateLedgerResponse] -> ShowS
show :: CreateLedgerResponse -> String
$cshow :: CreateLedgerResponse -> String
showsPrec :: Int -> CreateLedgerResponse -> ShowS
$cshowsPrec :: Int -> CreateLedgerResponse -> ShowS
Prelude.Show, (forall x. CreateLedgerResponse -> Rep CreateLedgerResponse x)
-> (forall x. Rep CreateLedgerResponse x -> CreateLedgerResponse)
-> Generic CreateLedgerResponse
forall x. Rep CreateLedgerResponse x -> CreateLedgerResponse
forall x. CreateLedgerResponse -> Rep CreateLedgerResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateLedgerResponse x -> CreateLedgerResponse
$cfrom :: forall x. CreateLedgerResponse -> Rep CreateLedgerResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateLedgerResponse' 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:
--
-- 'state', 'createLedgerResponse_state' - The current status of the ledger.
--
-- 'deletionProtection', 'createLedgerResponse_deletionProtection' - The flag that prevents a ledger from being deleted by any user. If not
-- provided on ledger creation, this feature is enabled (@true@) by
-- default.
--
-- If deletion protection is enabled, you must first disable it before you
-- can delete the ledger. You can disable it by calling the @UpdateLedger@
-- operation to set the flag to @false@.
--
-- 'kmsKeyArn', 'createLedgerResponse_kmsKeyArn' - The ARN of the customer managed KMS key that the ledger uses for
-- encryption at rest. If this parameter is undefined, the ledger uses an
-- Amazon Web Services owned KMS key for encryption.
--
-- 'arn', 'createLedgerResponse_arn' - The Amazon Resource Name (ARN) for the ledger.
--
-- 'name', 'createLedgerResponse_name' - The name of the ledger.
--
-- 'creationDateTime', 'createLedgerResponse_creationDateTime' - The date and time, in epoch time format, when the ledger was created.
-- (Epoch time format is the number of seconds elapsed since 12:00:00 AM
-- January 1, 1970 UTC.)
--
-- 'permissionsMode', 'createLedgerResponse_permissionsMode' - The permissions mode of the ledger that you created.
--
-- 'httpStatus', 'createLedgerResponse_httpStatus' - The response's http status code.
newCreateLedgerResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateLedgerResponse
newCreateLedgerResponse :: Int -> CreateLedgerResponse
newCreateLedgerResponse Int
pHttpStatus_ =
  CreateLedgerResponse' :: Maybe LedgerState
-> Maybe Bool
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe PermissionsMode
-> Int
-> CreateLedgerResponse
CreateLedgerResponse'
    { $sel:state:CreateLedgerResponse' :: Maybe LedgerState
state = Maybe LedgerState
forall a. Maybe a
Prelude.Nothing,
      $sel:deletionProtection:CreateLedgerResponse' :: Maybe Bool
deletionProtection = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:kmsKeyArn:CreateLedgerResponse' :: Maybe Text
kmsKeyArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:arn:CreateLedgerResponse' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:CreateLedgerResponse' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:creationDateTime:CreateLedgerResponse' :: Maybe POSIX
creationDateTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:permissionsMode:CreateLedgerResponse' :: Maybe PermissionsMode
permissionsMode = Maybe PermissionsMode
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateLedgerResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The current status of the ledger.
createLedgerResponse_state :: Lens.Lens' CreateLedgerResponse (Prelude.Maybe LedgerState)
createLedgerResponse_state :: (Maybe LedgerState -> f (Maybe LedgerState))
-> CreateLedgerResponse -> f CreateLedgerResponse
createLedgerResponse_state = (CreateLedgerResponse -> Maybe LedgerState)
-> (CreateLedgerResponse
    -> Maybe LedgerState -> CreateLedgerResponse)
-> Lens
     CreateLedgerResponse
     CreateLedgerResponse
     (Maybe LedgerState)
     (Maybe LedgerState)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLedgerResponse' {Maybe LedgerState
state :: Maybe LedgerState
$sel:state:CreateLedgerResponse' :: CreateLedgerResponse -> Maybe LedgerState
state} -> Maybe LedgerState
state) (\s :: CreateLedgerResponse
s@CreateLedgerResponse' {} Maybe LedgerState
a -> CreateLedgerResponse
s {$sel:state:CreateLedgerResponse' :: Maybe LedgerState
state = Maybe LedgerState
a} :: CreateLedgerResponse)

-- | The flag that prevents a ledger from being deleted by any user. If not
-- provided on ledger creation, this feature is enabled (@true@) by
-- default.
--
-- If deletion protection is enabled, you must first disable it before you
-- can delete the ledger. You can disable it by calling the @UpdateLedger@
-- operation to set the flag to @false@.
createLedgerResponse_deletionProtection :: Lens.Lens' CreateLedgerResponse (Prelude.Maybe Prelude.Bool)
createLedgerResponse_deletionProtection :: (Maybe Bool -> f (Maybe Bool))
-> CreateLedgerResponse -> f CreateLedgerResponse
createLedgerResponse_deletionProtection = (CreateLedgerResponse -> Maybe Bool)
-> (CreateLedgerResponse -> Maybe Bool -> CreateLedgerResponse)
-> Lens
     CreateLedgerResponse CreateLedgerResponse (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLedgerResponse' {Maybe Bool
deletionProtection :: Maybe Bool
$sel:deletionProtection:CreateLedgerResponse' :: CreateLedgerResponse -> Maybe Bool
deletionProtection} -> Maybe Bool
deletionProtection) (\s :: CreateLedgerResponse
s@CreateLedgerResponse' {} Maybe Bool
a -> CreateLedgerResponse
s {$sel:deletionProtection:CreateLedgerResponse' :: Maybe Bool
deletionProtection = Maybe Bool
a} :: CreateLedgerResponse)

-- | The ARN of the customer managed KMS key that the ledger uses for
-- encryption at rest. If this parameter is undefined, the ledger uses an
-- Amazon Web Services owned KMS key for encryption.
createLedgerResponse_kmsKeyArn :: Lens.Lens' CreateLedgerResponse (Prelude.Maybe Prelude.Text)
createLedgerResponse_kmsKeyArn :: (Maybe Text -> f (Maybe Text))
-> CreateLedgerResponse -> f CreateLedgerResponse
createLedgerResponse_kmsKeyArn = (CreateLedgerResponse -> Maybe Text)
-> (CreateLedgerResponse -> Maybe Text -> CreateLedgerResponse)
-> Lens
     CreateLedgerResponse CreateLedgerResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLedgerResponse' {Maybe Text
kmsKeyArn :: Maybe Text
$sel:kmsKeyArn:CreateLedgerResponse' :: CreateLedgerResponse -> Maybe Text
kmsKeyArn} -> Maybe Text
kmsKeyArn) (\s :: CreateLedgerResponse
s@CreateLedgerResponse' {} Maybe Text
a -> CreateLedgerResponse
s {$sel:kmsKeyArn:CreateLedgerResponse' :: Maybe Text
kmsKeyArn = Maybe Text
a} :: CreateLedgerResponse)

-- | The Amazon Resource Name (ARN) for the ledger.
createLedgerResponse_arn :: Lens.Lens' CreateLedgerResponse (Prelude.Maybe Prelude.Text)
createLedgerResponse_arn :: (Maybe Text -> f (Maybe Text))
-> CreateLedgerResponse -> f CreateLedgerResponse
createLedgerResponse_arn = (CreateLedgerResponse -> Maybe Text)
-> (CreateLedgerResponse -> Maybe Text -> CreateLedgerResponse)
-> Lens
     CreateLedgerResponse CreateLedgerResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLedgerResponse' {Maybe Text
arn :: Maybe Text
$sel:arn:CreateLedgerResponse' :: CreateLedgerResponse -> Maybe Text
arn} -> Maybe Text
arn) (\s :: CreateLedgerResponse
s@CreateLedgerResponse' {} Maybe Text
a -> CreateLedgerResponse
s {$sel:arn:CreateLedgerResponse' :: Maybe Text
arn = Maybe Text
a} :: CreateLedgerResponse)

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

-- | The date and time, in epoch time format, when the ledger was created.
-- (Epoch time format is the number of seconds elapsed since 12:00:00 AM
-- January 1, 1970 UTC.)
createLedgerResponse_creationDateTime :: Lens.Lens' CreateLedgerResponse (Prelude.Maybe Prelude.UTCTime)
createLedgerResponse_creationDateTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> CreateLedgerResponse -> f CreateLedgerResponse
createLedgerResponse_creationDateTime = (CreateLedgerResponse -> Maybe POSIX)
-> (CreateLedgerResponse -> Maybe POSIX -> CreateLedgerResponse)
-> Lens
     CreateLedgerResponse
     CreateLedgerResponse
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLedgerResponse' {Maybe POSIX
creationDateTime :: Maybe POSIX
$sel:creationDateTime:CreateLedgerResponse' :: CreateLedgerResponse -> Maybe POSIX
creationDateTime} -> Maybe POSIX
creationDateTime) (\s :: CreateLedgerResponse
s@CreateLedgerResponse' {} Maybe POSIX
a -> CreateLedgerResponse
s {$sel:creationDateTime:CreateLedgerResponse' :: Maybe POSIX
creationDateTime = Maybe POSIX
a} :: CreateLedgerResponse) ((Maybe POSIX -> f (Maybe POSIX))
 -> CreateLedgerResponse -> f CreateLedgerResponse)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> CreateLedgerResponse
-> f CreateLedgerResponse
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 permissions mode of the ledger that you created.
createLedgerResponse_permissionsMode :: Lens.Lens' CreateLedgerResponse (Prelude.Maybe PermissionsMode)
createLedgerResponse_permissionsMode :: (Maybe PermissionsMode -> f (Maybe PermissionsMode))
-> CreateLedgerResponse -> f CreateLedgerResponse
createLedgerResponse_permissionsMode = (CreateLedgerResponse -> Maybe PermissionsMode)
-> (CreateLedgerResponse
    -> Maybe PermissionsMode -> CreateLedgerResponse)
-> Lens
     CreateLedgerResponse
     CreateLedgerResponse
     (Maybe PermissionsMode)
     (Maybe PermissionsMode)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLedgerResponse' {Maybe PermissionsMode
permissionsMode :: Maybe PermissionsMode
$sel:permissionsMode:CreateLedgerResponse' :: CreateLedgerResponse -> Maybe PermissionsMode
permissionsMode} -> Maybe PermissionsMode
permissionsMode) (\s :: CreateLedgerResponse
s@CreateLedgerResponse' {} Maybe PermissionsMode
a -> CreateLedgerResponse
s {$sel:permissionsMode:CreateLedgerResponse' :: Maybe PermissionsMode
permissionsMode = Maybe PermissionsMode
a} :: CreateLedgerResponse)

-- | The response's http status code.
createLedgerResponse_httpStatus :: Lens.Lens' CreateLedgerResponse Prelude.Int
createLedgerResponse_httpStatus :: (Int -> f Int) -> CreateLedgerResponse -> f CreateLedgerResponse
createLedgerResponse_httpStatus = (CreateLedgerResponse -> Int)
-> (CreateLedgerResponse -> Int -> CreateLedgerResponse)
-> Lens CreateLedgerResponse CreateLedgerResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLedgerResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateLedgerResponse' :: CreateLedgerResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateLedgerResponse
s@CreateLedgerResponse' {} Int
a -> CreateLedgerResponse
s {$sel:httpStatus:CreateLedgerResponse' :: Int
httpStatus = Int
a} :: CreateLedgerResponse)

instance Prelude.NFData CreateLedgerResponse