{-# 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.Lightsail.CreateRelationalDatabase
-- 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 database in Amazon Lightsail.
--
-- The @create relational database@ operation supports tag-based access
-- control via request tags. For more information, see the
-- <https://lightsail.aws.amazon.com/ls/docs/en_us/articles/amazon-lightsail-controlling-access-using-tags Amazon Lightsail Developer Guide>.
module Amazonka.Lightsail.CreateRelationalDatabase
  ( -- * Creating a Request
    CreateRelationalDatabase (..),
    newCreateRelationalDatabase,

    -- * Request Lenses
    createRelationalDatabase_masterUserPassword,
    createRelationalDatabase_publiclyAccessible,
    createRelationalDatabase_preferredMaintenanceWindow,
    createRelationalDatabase_preferredBackupWindow,
    createRelationalDatabase_availabilityZone,
    createRelationalDatabase_tags,
    createRelationalDatabase_relationalDatabaseName,
    createRelationalDatabase_relationalDatabaseBlueprintId,
    createRelationalDatabase_relationalDatabaseBundleId,
    createRelationalDatabase_masterDatabaseName,
    createRelationalDatabase_masterUsername,

    -- * Destructuring the Response
    CreateRelationalDatabaseResponse (..),
    newCreateRelationalDatabaseResponse,

    -- * Response Lenses
    createRelationalDatabaseResponse_operations,
    createRelationalDatabaseResponse_httpStatus,
  )
where

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

-- | /See:/ 'newCreateRelationalDatabase' smart constructor.
data CreateRelationalDatabase = CreateRelationalDatabase'
  { -- | The password for the master user. The password can include any printable
    -- ASCII character except \"\/\", \"\"\", or \"\@\". It cannot contain
    -- spaces.
    --
    -- __MySQL__
    --
    -- Constraints: Must contain from 8 to 41 characters.
    --
    -- __PostgreSQL__
    --
    -- Constraints: Must contain from 8 to 128 characters.
    CreateRelationalDatabase -> Maybe (Sensitive Text)
masterUserPassword :: Prelude.Maybe (Core.Sensitive Prelude.Text),
    -- | Specifies the accessibility options for your new database. A value of
    -- @true@ specifies a database that is available to resources outside of
    -- your Lightsail account. A value of @false@ specifies a database that is
    -- available only to your Lightsail resources in the same region as your
    -- database.
    CreateRelationalDatabase -> Maybe Bool
publiclyAccessible :: Prelude.Maybe Prelude.Bool,
    -- | The weekly time range during which system maintenance can occur on your
    -- new database.
    --
    -- The default is a 30-minute window selected at random from an 8-hour
    -- block of time for each AWS Region, occurring on a random day of the
    -- week.
    --
    -- Constraints:
    --
    -- -   Must be in the @ddd:hh24:mi-ddd:hh24:mi@ format.
    --
    -- -   Valid days: Mon, Tue, Wed, Thu, Fri, Sat, Sun.
    --
    -- -   Must be at least 30 minutes.
    --
    -- -   Specified in Coordinated Universal Time (UTC).
    --
    -- -   Example: @Tue:17:00-Tue:17:30@
    CreateRelationalDatabase -> Maybe Text
preferredMaintenanceWindow :: Prelude.Maybe Prelude.Text,
    -- | The daily time range during which automated backups are created for your
    -- new database if automated backups are enabled.
    --
    -- The default is a 30-minute window selected at random from an 8-hour
    -- block of time for each AWS Region. For more information about the
    -- preferred backup window time blocks for each region, see the
    -- <https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_WorkingWithAutomatedBackups.html#USER_WorkingWithAutomatedBackups.BackupWindow Working With Backups>
    -- guide in the Amazon Relational Database Service (Amazon RDS)
    -- documentation.
    --
    -- Constraints:
    --
    -- -   Must be in the @hh24:mi-hh24:mi@ format.
    --
    --     Example: @16:00-16:30@
    --
    -- -   Specified in Coordinated Universal Time (UTC).
    --
    -- -   Must not conflict with the preferred maintenance window.
    --
    -- -   Must be at least 30 minutes.
    CreateRelationalDatabase -> Maybe Text
preferredBackupWindow :: Prelude.Maybe Prelude.Text,
    -- | The Availability Zone in which to create your new database. Use the
    -- @us-east-2a@ case-sensitive format.
    --
    -- You can get a list of Availability Zones by using the @get regions@
    -- operation. Be sure to add the
    -- @include relational database Availability Zones@ parameter to your
    -- request.
    CreateRelationalDatabase -> Maybe Text
availabilityZone :: Prelude.Maybe Prelude.Text,
    -- | The tag keys and optional values to add to the resource during create.
    --
    -- Use the @TagResource@ action to tag a resource after it\'s created.
    CreateRelationalDatabase -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
    -- | The name to use for your new Lightsail database resource.
    --
    -- Constraints:
    --
    -- -   Must contain from 2 to 255 alphanumeric characters, or hyphens.
    --
    -- -   The first and last character must be a letter or number.
    CreateRelationalDatabase -> Text
relationalDatabaseName :: Prelude.Text,
    -- | The blueprint ID for your new database. A blueprint describes the major
    -- engine version of a database.
    --
    -- You can get a list of database blueprints IDs by using the
    -- @get relational database blueprints@ operation.
    CreateRelationalDatabase -> Text
relationalDatabaseBlueprintId :: Prelude.Text,
    -- | The bundle ID for your new database. A bundle describes the performance
    -- specifications for your database.
    --
    -- You can get a list of database bundle IDs by using the
    -- @get relational database bundles@ operation.
    CreateRelationalDatabase -> Text
relationalDatabaseBundleId :: Prelude.Text,
    -- | The meaning of this parameter differs according to the database engine
    -- you use.
    --
    -- __MySQL__
    --
    -- The name of the database to create when the Lightsail database resource
    -- is created. If this parameter isn\'t specified, no database is created
    -- in the database resource.
    --
    -- Constraints:
    --
    -- -   Must contain 1 to 64 letters or numbers.
    --
    -- -   Must begin with a letter. Subsequent characters can be letters,
    --     underscores, or digits (0- 9).
    --
    -- -   Can\'t be a word reserved by the specified database engine.
    --
    --     For more information about reserved words in MySQL, see the Keywords
    --     and Reserved Words articles for
    --     <https://dev.mysql.com/doc/refman/5.6/en/keywords.html MySQL 5.6>,
    --     <https://dev.mysql.com/doc/refman/5.7/en/keywords.html MySQL 5.7>,
    --     and
    --     <https://dev.mysql.com/doc/refman/8.0/en/keywords.html MySQL 8.0>.
    --
    -- __PostgreSQL__
    --
    -- The name of the database to create when the Lightsail database resource
    -- is created. If this parameter isn\'t specified, a database named
    -- @postgres@ is created in the database resource.
    --
    -- Constraints:
    --
    -- -   Must contain 1 to 63 letters or numbers.
    --
    -- -   Must begin with a letter. Subsequent characters can be letters,
    --     underscores, or digits (0- 9).
    --
    -- -   Can\'t be a word reserved by the specified database engine.
    --
    --     For more information about reserved words in PostgreSQL, see the SQL
    --     Key Words articles for
    --     <https://www.postgresql.org/docs/9.6/sql-keywords-appendix.html PostgreSQL 9.6>,
    --     <https://www.postgresql.org/docs/10/sql-keywords-appendix.html PostgreSQL 10>,
    --     <https://www.postgresql.org/docs/11/sql-keywords-appendix.html PostgreSQL 11>,
    --     and
    --     <https://www.postgresql.org/docs/12/sql-keywords-appendix.html PostgreSQL 12>.
    CreateRelationalDatabase -> Text
masterDatabaseName :: Prelude.Text,
    -- | The name for the master user.
    --
    -- __MySQL__
    --
    -- Constraints:
    --
    -- -   Required for MySQL.
    --
    -- -   Must be 1 to 16 letters or numbers. Can contain underscores.
    --
    -- -   First character must be a letter.
    --
    -- -   Can\'t be a reserved word for the chosen database engine.
    --
    --     For more information about reserved words in MySQL 5.6 or 5.7, see
    --     the Keywords and Reserved Words articles for
    --     <https://dev.mysql.com/doc/refman/5.6/en/keywords.html MySQL 5.6>,
    --     <https://dev.mysql.com/doc/refman/5.7/en/keywords.html MySQL 5.7>,
    --     or
    --     <https://dev.mysql.com/doc/refman/8.0/en/keywords.html MySQL 8.0>.
    --
    -- __PostgreSQL__
    --
    -- Constraints:
    --
    -- -   Required for PostgreSQL.
    --
    -- -   Must be 1 to 63 letters or numbers. Can contain underscores.
    --
    -- -   First character must be a letter.
    --
    -- -   Can\'t be a reserved word for the chosen database engine.
    --
    --     For more information about reserved words in MySQL 5.6 or 5.7, see
    --     the Keywords and Reserved Words articles for
    --     <https://www.postgresql.org/docs/9.6/sql-keywords-appendix.html PostgreSQL 9.6>,
    --     <https://www.postgresql.org/docs/10/sql-keywords-appendix.html PostgreSQL 10>,
    --     <https://www.postgresql.org/docs/11/sql-keywords-appendix.html PostgreSQL 11>,
    --     and
    --     <https://www.postgresql.org/docs/12/sql-keywords-appendix.html PostgreSQL 12>.
    CreateRelationalDatabase -> Text
masterUsername :: Prelude.Text
  }
  deriving (CreateRelationalDatabase -> CreateRelationalDatabase -> Bool
(CreateRelationalDatabase -> CreateRelationalDatabase -> Bool)
-> (CreateRelationalDatabase -> CreateRelationalDatabase -> Bool)
-> Eq CreateRelationalDatabase
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateRelationalDatabase -> CreateRelationalDatabase -> Bool
$c/= :: CreateRelationalDatabase -> CreateRelationalDatabase -> Bool
== :: CreateRelationalDatabase -> CreateRelationalDatabase -> Bool
$c== :: CreateRelationalDatabase -> CreateRelationalDatabase -> Bool
Prelude.Eq, Int -> CreateRelationalDatabase -> ShowS
[CreateRelationalDatabase] -> ShowS
CreateRelationalDatabase -> String
(Int -> CreateRelationalDatabase -> ShowS)
-> (CreateRelationalDatabase -> String)
-> ([CreateRelationalDatabase] -> ShowS)
-> Show CreateRelationalDatabase
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateRelationalDatabase] -> ShowS
$cshowList :: [CreateRelationalDatabase] -> ShowS
show :: CreateRelationalDatabase -> String
$cshow :: CreateRelationalDatabase -> String
showsPrec :: Int -> CreateRelationalDatabase -> ShowS
$cshowsPrec :: Int -> CreateRelationalDatabase -> ShowS
Prelude.Show, (forall x.
 CreateRelationalDatabase -> Rep CreateRelationalDatabase x)
-> (forall x.
    Rep CreateRelationalDatabase x -> CreateRelationalDatabase)
-> Generic CreateRelationalDatabase
forall x.
Rep CreateRelationalDatabase x -> CreateRelationalDatabase
forall x.
CreateRelationalDatabase -> Rep CreateRelationalDatabase x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateRelationalDatabase x -> CreateRelationalDatabase
$cfrom :: forall x.
CreateRelationalDatabase -> Rep CreateRelationalDatabase x
Prelude.Generic)

-- |
-- Create a value of 'CreateRelationalDatabase' 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:
--
-- 'masterUserPassword', 'createRelationalDatabase_masterUserPassword' - The password for the master user. The password can include any printable
-- ASCII character except \"\/\", \"\"\", or \"\@\". It cannot contain
-- spaces.
--
-- __MySQL__
--
-- Constraints: Must contain from 8 to 41 characters.
--
-- __PostgreSQL__
--
-- Constraints: Must contain from 8 to 128 characters.
--
-- 'publiclyAccessible', 'createRelationalDatabase_publiclyAccessible' - Specifies the accessibility options for your new database. A value of
-- @true@ specifies a database that is available to resources outside of
-- your Lightsail account. A value of @false@ specifies a database that is
-- available only to your Lightsail resources in the same region as your
-- database.
--
-- 'preferredMaintenanceWindow', 'createRelationalDatabase_preferredMaintenanceWindow' - The weekly time range during which system maintenance can occur on your
-- new database.
--
-- The default is a 30-minute window selected at random from an 8-hour
-- block of time for each AWS Region, occurring on a random day of the
-- week.
--
-- Constraints:
--
-- -   Must be in the @ddd:hh24:mi-ddd:hh24:mi@ format.
--
-- -   Valid days: Mon, Tue, Wed, Thu, Fri, Sat, Sun.
--
-- -   Must be at least 30 minutes.
--
-- -   Specified in Coordinated Universal Time (UTC).
--
-- -   Example: @Tue:17:00-Tue:17:30@
--
-- 'preferredBackupWindow', 'createRelationalDatabase_preferredBackupWindow' - The daily time range during which automated backups are created for your
-- new database if automated backups are enabled.
--
-- The default is a 30-minute window selected at random from an 8-hour
-- block of time for each AWS Region. For more information about the
-- preferred backup window time blocks for each region, see the
-- <https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_WorkingWithAutomatedBackups.html#USER_WorkingWithAutomatedBackups.BackupWindow Working With Backups>
-- guide in the Amazon Relational Database Service (Amazon RDS)
-- documentation.
--
-- Constraints:
--
-- -   Must be in the @hh24:mi-hh24:mi@ format.
--
--     Example: @16:00-16:30@
--
-- -   Specified in Coordinated Universal Time (UTC).
--
-- -   Must not conflict with the preferred maintenance window.
--
-- -   Must be at least 30 minutes.
--
-- 'availabilityZone', 'createRelationalDatabase_availabilityZone' - The Availability Zone in which to create your new database. Use the
-- @us-east-2a@ case-sensitive format.
--
-- You can get a list of Availability Zones by using the @get regions@
-- operation. Be sure to add the
-- @include relational database Availability Zones@ parameter to your
-- request.
--
-- 'tags', 'createRelationalDatabase_tags' - The tag keys and optional values to add to the resource during create.
--
-- Use the @TagResource@ action to tag a resource after it\'s created.
--
-- 'relationalDatabaseName', 'createRelationalDatabase_relationalDatabaseName' - The name to use for your new Lightsail database resource.
--
-- Constraints:
--
-- -   Must contain from 2 to 255 alphanumeric characters, or hyphens.
--
-- -   The first and last character must be a letter or number.
--
-- 'relationalDatabaseBlueprintId', 'createRelationalDatabase_relationalDatabaseBlueprintId' - The blueprint ID for your new database. A blueprint describes the major
-- engine version of a database.
--
-- You can get a list of database blueprints IDs by using the
-- @get relational database blueprints@ operation.
--
-- 'relationalDatabaseBundleId', 'createRelationalDatabase_relationalDatabaseBundleId' - The bundle ID for your new database. A bundle describes the performance
-- specifications for your database.
--
-- You can get a list of database bundle IDs by using the
-- @get relational database bundles@ operation.
--
-- 'masterDatabaseName', 'createRelationalDatabase_masterDatabaseName' - The meaning of this parameter differs according to the database engine
-- you use.
--
-- __MySQL__
--
-- The name of the database to create when the Lightsail database resource
-- is created. If this parameter isn\'t specified, no database is created
-- in the database resource.
--
-- Constraints:
--
-- -   Must contain 1 to 64 letters or numbers.
--
-- -   Must begin with a letter. Subsequent characters can be letters,
--     underscores, or digits (0- 9).
--
-- -   Can\'t be a word reserved by the specified database engine.
--
--     For more information about reserved words in MySQL, see the Keywords
--     and Reserved Words articles for
--     <https://dev.mysql.com/doc/refman/5.6/en/keywords.html MySQL 5.6>,
--     <https://dev.mysql.com/doc/refman/5.7/en/keywords.html MySQL 5.7>,
--     and
--     <https://dev.mysql.com/doc/refman/8.0/en/keywords.html MySQL 8.0>.
--
-- __PostgreSQL__
--
-- The name of the database to create when the Lightsail database resource
-- is created. If this parameter isn\'t specified, a database named
-- @postgres@ is created in the database resource.
--
-- Constraints:
--
-- -   Must contain 1 to 63 letters or numbers.
--
-- -   Must begin with a letter. Subsequent characters can be letters,
--     underscores, or digits (0- 9).
--
-- -   Can\'t be a word reserved by the specified database engine.
--
--     For more information about reserved words in PostgreSQL, see the SQL
--     Key Words articles for
--     <https://www.postgresql.org/docs/9.6/sql-keywords-appendix.html PostgreSQL 9.6>,
--     <https://www.postgresql.org/docs/10/sql-keywords-appendix.html PostgreSQL 10>,
--     <https://www.postgresql.org/docs/11/sql-keywords-appendix.html PostgreSQL 11>,
--     and
--     <https://www.postgresql.org/docs/12/sql-keywords-appendix.html PostgreSQL 12>.
--
-- 'masterUsername', 'createRelationalDatabase_masterUsername' - The name for the master user.
--
-- __MySQL__
--
-- Constraints:
--
-- -   Required for MySQL.
--
-- -   Must be 1 to 16 letters or numbers. Can contain underscores.
--
-- -   First character must be a letter.
--
-- -   Can\'t be a reserved word for the chosen database engine.
--
--     For more information about reserved words in MySQL 5.6 or 5.7, see
--     the Keywords and Reserved Words articles for
--     <https://dev.mysql.com/doc/refman/5.6/en/keywords.html MySQL 5.6>,
--     <https://dev.mysql.com/doc/refman/5.7/en/keywords.html MySQL 5.7>,
--     or
--     <https://dev.mysql.com/doc/refman/8.0/en/keywords.html MySQL 8.0>.
--
-- __PostgreSQL__
--
-- Constraints:
--
-- -   Required for PostgreSQL.
--
-- -   Must be 1 to 63 letters or numbers. Can contain underscores.
--
-- -   First character must be a letter.
--
-- -   Can\'t be a reserved word for the chosen database engine.
--
--     For more information about reserved words in MySQL 5.6 or 5.7, see
--     the Keywords and Reserved Words articles for
--     <https://www.postgresql.org/docs/9.6/sql-keywords-appendix.html PostgreSQL 9.6>,
--     <https://www.postgresql.org/docs/10/sql-keywords-appendix.html PostgreSQL 10>,
--     <https://www.postgresql.org/docs/11/sql-keywords-appendix.html PostgreSQL 11>,
--     and
--     <https://www.postgresql.org/docs/12/sql-keywords-appendix.html PostgreSQL 12>.
newCreateRelationalDatabase ::
  -- | 'relationalDatabaseName'
  Prelude.Text ->
  -- | 'relationalDatabaseBlueprintId'
  Prelude.Text ->
  -- | 'relationalDatabaseBundleId'
  Prelude.Text ->
  -- | 'masterDatabaseName'
  Prelude.Text ->
  -- | 'masterUsername'
  Prelude.Text ->
  CreateRelationalDatabase
newCreateRelationalDatabase :: Text -> Text -> Text -> Text -> Text -> CreateRelationalDatabase
newCreateRelationalDatabase
  Text
pRelationalDatabaseName_
  Text
pRelationalDatabaseBlueprintId_
  Text
pRelationalDatabaseBundleId_
  Text
pMasterDatabaseName_
  Text
pMasterUsername_ =
    CreateRelationalDatabase' :: Maybe (Sensitive Text)
-> Maybe Bool
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe [Tag]
-> Text
-> Text
-> Text
-> Text
-> Text
-> CreateRelationalDatabase
CreateRelationalDatabase'
      { $sel:masterUserPassword:CreateRelationalDatabase' :: Maybe (Sensitive Text)
masterUserPassword =
          Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:publiclyAccessible:CreateRelationalDatabase' :: Maybe Bool
publiclyAccessible = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
        $sel:preferredMaintenanceWindow:CreateRelationalDatabase' :: Maybe Text
preferredMaintenanceWindow = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:preferredBackupWindow:CreateRelationalDatabase' :: Maybe Text
preferredBackupWindow = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:availabilityZone:CreateRelationalDatabase' :: Maybe Text
availabilityZone = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreateRelationalDatabase' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
        $sel:relationalDatabaseName:CreateRelationalDatabase' :: Text
relationalDatabaseName = Text
pRelationalDatabaseName_,
        $sel:relationalDatabaseBlueprintId:CreateRelationalDatabase' :: Text
relationalDatabaseBlueprintId =
          Text
pRelationalDatabaseBlueprintId_,
        $sel:relationalDatabaseBundleId:CreateRelationalDatabase' :: Text
relationalDatabaseBundleId =
          Text
pRelationalDatabaseBundleId_,
        $sel:masterDatabaseName:CreateRelationalDatabase' :: Text
masterDatabaseName = Text
pMasterDatabaseName_,
        $sel:masterUsername:CreateRelationalDatabase' :: Text
masterUsername = Text
pMasterUsername_
      }

-- | The password for the master user. The password can include any printable
-- ASCII character except \"\/\", \"\"\", or \"\@\". It cannot contain
-- spaces.
--
-- __MySQL__
--
-- Constraints: Must contain from 8 to 41 characters.
--
-- __PostgreSQL__
--
-- Constraints: Must contain from 8 to 128 characters.
createRelationalDatabase_masterUserPassword :: Lens.Lens' CreateRelationalDatabase (Prelude.Maybe Prelude.Text)
createRelationalDatabase_masterUserPassword :: (Maybe Text -> f (Maybe Text))
-> CreateRelationalDatabase -> f CreateRelationalDatabase
createRelationalDatabase_masterUserPassword = (CreateRelationalDatabase -> Maybe (Sensitive Text))
-> (CreateRelationalDatabase
    -> Maybe (Sensitive Text) -> CreateRelationalDatabase)
-> Lens
     CreateRelationalDatabase
     CreateRelationalDatabase
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRelationalDatabase' {Maybe (Sensitive Text)
masterUserPassword :: Maybe (Sensitive Text)
$sel:masterUserPassword:CreateRelationalDatabase' :: CreateRelationalDatabase -> Maybe (Sensitive Text)
masterUserPassword} -> Maybe (Sensitive Text)
masterUserPassword) (\s :: CreateRelationalDatabase
s@CreateRelationalDatabase' {} Maybe (Sensitive Text)
a -> CreateRelationalDatabase
s {$sel:masterUserPassword:CreateRelationalDatabase' :: Maybe (Sensitive Text)
masterUserPassword = Maybe (Sensitive Text)
a} :: CreateRelationalDatabase) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> CreateRelationalDatabase -> f CreateRelationalDatabase)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> CreateRelationalDatabase
-> f CreateRelationalDatabase
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
     (Maybe Text)
     (Maybe 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 (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive

-- | Specifies the accessibility options for your new database. A value of
-- @true@ specifies a database that is available to resources outside of
-- your Lightsail account. A value of @false@ specifies a database that is
-- available only to your Lightsail resources in the same region as your
-- database.
createRelationalDatabase_publiclyAccessible :: Lens.Lens' CreateRelationalDatabase (Prelude.Maybe Prelude.Bool)
createRelationalDatabase_publiclyAccessible :: (Maybe Bool -> f (Maybe Bool))
-> CreateRelationalDatabase -> f CreateRelationalDatabase
createRelationalDatabase_publiclyAccessible = (CreateRelationalDatabase -> Maybe Bool)
-> (CreateRelationalDatabase
    -> Maybe Bool -> CreateRelationalDatabase)
-> Lens
     CreateRelationalDatabase
     CreateRelationalDatabase
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRelationalDatabase' {Maybe Bool
publiclyAccessible :: Maybe Bool
$sel:publiclyAccessible:CreateRelationalDatabase' :: CreateRelationalDatabase -> Maybe Bool
publiclyAccessible} -> Maybe Bool
publiclyAccessible) (\s :: CreateRelationalDatabase
s@CreateRelationalDatabase' {} Maybe Bool
a -> CreateRelationalDatabase
s {$sel:publiclyAccessible:CreateRelationalDatabase' :: Maybe Bool
publiclyAccessible = Maybe Bool
a} :: CreateRelationalDatabase)

-- | The weekly time range during which system maintenance can occur on your
-- new database.
--
-- The default is a 30-minute window selected at random from an 8-hour
-- block of time for each AWS Region, occurring on a random day of the
-- week.
--
-- Constraints:
--
-- -   Must be in the @ddd:hh24:mi-ddd:hh24:mi@ format.
--
-- -   Valid days: Mon, Tue, Wed, Thu, Fri, Sat, Sun.
--
-- -   Must be at least 30 minutes.
--
-- -   Specified in Coordinated Universal Time (UTC).
--
-- -   Example: @Tue:17:00-Tue:17:30@
createRelationalDatabase_preferredMaintenanceWindow :: Lens.Lens' CreateRelationalDatabase (Prelude.Maybe Prelude.Text)
createRelationalDatabase_preferredMaintenanceWindow :: (Maybe Text -> f (Maybe Text))
-> CreateRelationalDatabase -> f CreateRelationalDatabase
createRelationalDatabase_preferredMaintenanceWindow = (CreateRelationalDatabase -> Maybe Text)
-> (CreateRelationalDatabase
    -> Maybe Text -> CreateRelationalDatabase)
-> Lens
     CreateRelationalDatabase
     CreateRelationalDatabase
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRelationalDatabase' {Maybe Text
preferredMaintenanceWindow :: Maybe Text
$sel:preferredMaintenanceWindow:CreateRelationalDatabase' :: CreateRelationalDatabase -> Maybe Text
preferredMaintenanceWindow} -> Maybe Text
preferredMaintenanceWindow) (\s :: CreateRelationalDatabase
s@CreateRelationalDatabase' {} Maybe Text
a -> CreateRelationalDatabase
s {$sel:preferredMaintenanceWindow:CreateRelationalDatabase' :: Maybe Text
preferredMaintenanceWindow = Maybe Text
a} :: CreateRelationalDatabase)

-- | The daily time range during which automated backups are created for your
-- new database if automated backups are enabled.
--
-- The default is a 30-minute window selected at random from an 8-hour
-- block of time for each AWS Region. For more information about the
-- preferred backup window time blocks for each region, see the
-- <https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_WorkingWithAutomatedBackups.html#USER_WorkingWithAutomatedBackups.BackupWindow Working With Backups>
-- guide in the Amazon Relational Database Service (Amazon RDS)
-- documentation.
--
-- Constraints:
--
-- -   Must be in the @hh24:mi-hh24:mi@ format.
--
--     Example: @16:00-16:30@
--
-- -   Specified in Coordinated Universal Time (UTC).
--
-- -   Must not conflict with the preferred maintenance window.
--
-- -   Must be at least 30 minutes.
createRelationalDatabase_preferredBackupWindow :: Lens.Lens' CreateRelationalDatabase (Prelude.Maybe Prelude.Text)
createRelationalDatabase_preferredBackupWindow :: (Maybe Text -> f (Maybe Text))
-> CreateRelationalDatabase -> f CreateRelationalDatabase
createRelationalDatabase_preferredBackupWindow = (CreateRelationalDatabase -> Maybe Text)
-> (CreateRelationalDatabase
    -> Maybe Text -> CreateRelationalDatabase)
-> Lens
     CreateRelationalDatabase
     CreateRelationalDatabase
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRelationalDatabase' {Maybe Text
preferredBackupWindow :: Maybe Text
$sel:preferredBackupWindow:CreateRelationalDatabase' :: CreateRelationalDatabase -> Maybe Text
preferredBackupWindow} -> Maybe Text
preferredBackupWindow) (\s :: CreateRelationalDatabase
s@CreateRelationalDatabase' {} Maybe Text
a -> CreateRelationalDatabase
s {$sel:preferredBackupWindow:CreateRelationalDatabase' :: Maybe Text
preferredBackupWindow = Maybe Text
a} :: CreateRelationalDatabase)

-- | The Availability Zone in which to create your new database. Use the
-- @us-east-2a@ case-sensitive format.
--
-- You can get a list of Availability Zones by using the @get regions@
-- operation. Be sure to add the
-- @include relational database Availability Zones@ parameter to your
-- request.
createRelationalDatabase_availabilityZone :: Lens.Lens' CreateRelationalDatabase (Prelude.Maybe Prelude.Text)
createRelationalDatabase_availabilityZone :: (Maybe Text -> f (Maybe Text))
-> CreateRelationalDatabase -> f CreateRelationalDatabase
createRelationalDatabase_availabilityZone = (CreateRelationalDatabase -> Maybe Text)
-> (CreateRelationalDatabase
    -> Maybe Text -> CreateRelationalDatabase)
-> Lens
     CreateRelationalDatabase
     CreateRelationalDatabase
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRelationalDatabase' {Maybe Text
availabilityZone :: Maybe Text
$sel:availabilityZone:CreateRelationalDatabase' :: CreateRelationalDatabase -> Maybe Text
availabilityZone} -> Maybe Text
availabilityZone) (\s :: CreateRelationalDatabase
s@CreateRelationalDatabase' {} Maybe Text
a -> CreateRelationalDatabase
s {$sel:availabilityZone:CreateRelationalDatabase' :: Maybe Text
availabilityZone = Maybe Text
a} :: CreateRelationalDatabase)

-- | The tag keys and optional values to add to the resource during create.
--
-- Use the @TagResource@ action to tag a resource after it\'s created.
createRelationalDatabase_tags :: Lens.Lens' CreateRelationalDatabase (Prelude.Maybe [Tag])
createRelationalDatabase_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateRelationalDatabase -> f CreateRelationalDatabase
createRelationalDatabase_tags = (CreateRelationalDatabase -> Maybe [Tag])
-> (CreateRelationalDatabase
    -> Maybe [Tag] -> CreateRelationalDatabase)
-> Lens
     CreateRelationalDatabase
     CreateRelationalDatabase
     (Maybe [Tag])
     (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRelationalDatabase' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateRelationalDatabase' :: CreateRelationalDatabase -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateRelationalDatabase
s@CreateRelationalDatabase' {} Maybe [Tag]
a -> CreateRelationalDatabase
s {$sel:tags:CreateRelationalDatabase' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateRelationalDatabase) ((Maybe [Tag] -> f (Maybe [Tag]))
 -> CreateRelationalDatabase -> f CreateRelationalDatabase)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
    -> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateRelationalDatabase
-> f CreateRelationalDatabase
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Tag] [Tag] [Tag] [Tag]
-> Iso (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag])
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 [Tag] [Tag] [Tag] [Tag]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The name to use for your new Lightsail database resource.
--
-- Constraints:
--
-- -   Must contain from 2 to 255 alphanumeric characters, or hyphens.
--
-- -   The first and last character must be a letter or number.
createRelationalDatabase_relationalDatabaseName :: Lens.Lens' CreateRelationalDatabase Prelude.Text
createRelationalDatabase_relationalDatabaseName :: (Text -> f Text)
-> CreateRelationalDatabase -> f CreateRelationalDatabase
createRelationalDatabase_relationalDatabaseName = (CreateRelationalDatabase -> Text)
-> (CreateRelationalDatabase -> Text -> CreateRelationalDatabase)
-> Lens CreateRelationalDatabase CreateRelationalDatabase Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRelationalDatabase' {Text
relationalDatabaseName :: Text
$sel:relationalDatabaseName:CreateRelationalDatabase' :: CreateRelationalDatabase -> Text
relationalDatabaseName} -> Text
relationalDatabaseName) (\s :: CreateRelationalDatabase
s@CreateRelationalDatabase' {} Text
a -> CreateRelationalDatabase
s {$sel:relationalDatabaseName:CreateRelationalDatabase' :: Text
relationalDatabaseName = Text
a} :: CreateRelationalDatabase)

-- | The blueprint ID for your new database. A blueprint describes the major
-- engine version of a database.
--
-- You can get a list of database blueprints IDs by using the
-- @get relational database blueprints@ operation.
createRelationalDatabase_relationalDatabaseBlueprintId :: Lens.Lens' CreateRelationalDatabase Prelude.Text
createRelationalDatabase_relationalDatabaseBlueprintId :: (Text -> f Text)
-> CreateRelationalDatabase -> f CreateRelationalDatabase
createRelationalDatabase_relationalDatabaseBlueprintId = (CreateRelationalDatabase -> Text)
-> (CreateRelationalDatabase -> Text -> CreateRelationalDatabase)
-> Lens CreateRelationalDatabase CreateRelationalDatabase Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRelationalDatabase' {Text
relationalDatabaseBlueprintId :: Text
$sel:relationalDatabaseBlueprintId:CreateRelationalDatabase' :: CreateRelationalDatabase -> Text
relationalDatabaseBlueprintId} -> Text
relationalDatabaseBlueprintId) (\s :: CreateRelationalDatabase
s@CreateRelationalDatabase' {} Text
a -> CreateRelationalDatabase
s {$sel:relationalDatabaseBlueprintId:CreateRelationalDatabase' :: Text
relationalDatabaseBlueprintId = Text
a} :: CreateRelationalDatabase)

-- | The bundle ID for your new database. A bundle describes the performance
-- specifications for your database.
--
-- You can get a list of database bundle IDs by using the
-- @get relational database bundles@ operation.
createRelationalDatabase_relationalDatabaseBundleId :: Lens.Lens' CreateRelationalDatabase Prelude.Text
createRelationalDatabase_relationalDatabaseBundleId :: (Text -> f Text)
-> CreateRelationalDatabase -> f CreateRelationalDatabase
createRelationalDatabase_relationalDatabaseBundleId = (CreateRelationalDatabase -> Text)
-> (CreateRelationalDatabase -> Text -> CreateRelationalDatabase)
-> Lens CreateRelationalDatabase CreateRelationalDatabase Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRelationalDatabase' {Text
relationalDatabaseBundleId :: Text
$sel:relationalDatabaseBundleId:CreateRelationalDatabase' :: CreateRelationalDatabase -> Text
relationalDatabaseBundleId} -> Text
relationalDatabaseBundleId) (\s :: CreateRelationalDatabase
s@CreateRelationalDatabase' {} Text
a -> CreateRelationalDatabase
s {$sel:relationalDatabaseBundleId:CreateRelationalDatabase' :: Text
relationalDatabaseBundleId = Text
a} :: CreateRelationalDatabase)

-- | The meaning of this parameter differs according to the database engine
-- you use.
--
-- __MySQL__
--
-- The name of the database to create when the Lightsail database resource
-- is created. If this parameter isn\'t specified, no database is created
-- in the database resource.
--
-- Constraints:
--
-- -   Must contain 1 to 64 letters or numbers.
--
-- -   Must begin with a letter. Subsequent characters can be letters,
--     underscores, or digits (0- 9).
--
-- -   Can\'t be a word reserved by the specified database engine.
--
--     For more information about reserved words in MySQL, see the Keywords
--     and Reserved Words articles for
--     <https://dev.mysql.com/doc/refman/5.6/en/keywords.html MySQL 5.6>,
--     <https://dev.mysql.com/doc/refman/5.7/en/keywords.html MySQL 5.7>,
--     and
--     <https://dev.mysql.com/doc/refman/8.0/en/keywords.html MySQL 8.0>.
--
-- __PostgreSQL__
--
-- The name of the database to create when the Lightsail database resource
-- is created. If this parameter isn\'t specified, a database named
-- @postgres@ is created in the database resource.
--
-- Constraints:
--
-- -   Must contain 1 to 63 letters or numbers.
--
-- -   Must begin with a letter. Subsequent characters can be letters,
--     underscores, or digits (0- 9).
--
-- -   Can\'t be a word reserved by the specified database engine.
--
--     For more information about reserved words in PostgreSQL, see the SQL
--     Key Words articles for
--     <https://www.postgresql.org/docs/9.6/sql-keywords-appendix.html PostgreSQL 9.6>,
--     <https://www.postgresql.org/docs/10/sql-keywords-appendix.html PostgreSQL 10>,
--     <https://www.postgresql.org/docs/11/sql-keywords-appendix.html PostgreSQL 11>,
--     and
--     <https://www.postgresql.org/docs/12/sql-keywords-appendix.html PostgreSQL 12>.
createRelationalDatabase_masterDatabaseName :: Lens.Lens' CreateRelationalDatabase Prelude.Text
createRelationalDatabase_masterDatabaseName :: (Text -> f Text)
-> CreateRelationalDatabase -> f CreateRelationalDatabase
createRelationalDatabase_masterDatabaseName = (CreateRelationalDatabase -> Text)
-> (CreateRelationalDatabase -> Text -> CreateRelationalDatabase)
-> Lens CreateRelationalDatabase CreateRelationalDatabase Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRelationalDatabase' {Text
masterDatabaseName :: Text
$sel:masterDatabaseName:CreateRelationalDatabase' :: CreateRelationalDatabase -> Text
masterDatabaseName} -> Text
masterDatabaseName) (\s :: CreateRelationalDatabase
s@CreateRelationalDatabase' {} Text
a -> CreateRelationalDatabase
s {$sel:masterDatabaseName:CreateRelationalDatabase' :: Text
masterDatabaseName = Text
a} :: CreateRelationalDatabase)

-- | The name for the master user.
--
-- __MySQL__
--
-- Constraints:
--
-- -   Required for MySQL.
--
-- -   Must be 1 to 16 letters or numbers. Can contain underscores.
--
-- -   First character must be a letter.
--
-- -   Can\'t be a reserved word for the chosen database engine.
--
--     For more information about reserved words in MySQL 5.6 or 5.7, see
--     the Keywords and Reserved Words articles for
--     <https://dev.mysql.com/doc/refman/5.6/en/keywords.html MySQL 5.6>,
--     <https://dev.mysql.com/doc/refman/5.7/en/keywords.html MySQL 5.7>,
--     or
--     <https://dev.mysql.com/doc/refman/8.0/en/keywords.html MySQL 8.0>.
--
-- __PostgreSQL__
--
-- Constraints:
--
-- -   Required for PostgreSQL.
--
-- -   Must be 1 to 63 letters or numbers. Can contain underscores.
--
-- -   First character must be a letter.
--
-- -   Can\'t be a reserved word for the chosen database engine.
--
--     For more information about reserved words in MySQL 5.6 or 5.7, see
--     the Keywords and Reserved Words articles for
--     <https://www.postgresql.org/docs/9.6/sql-keywords-appendix.html PostgreSQL 9.6>,
--     <https://www.postgresql.org/docs/10/sql-keywords-appendix.html PostgreSQL 10>,
--     <https://www.postgresql.org/docs/11/sql-keywords-appendix.html PostgreSQL 11>,
--     and
--     <https://www.postgresql.org/docs/12/sql-keywords-appendix.html PostgreSQL 12>.
createRelationalDatabase_masterUsername :: Lens.Lens' CreateRelationalDatabase Prelude.Text
createRelationalDatabase_masterUsername :: (Text -> f Text)
-> CreateRelationalDatabase -> f CreateRelationalDatabase
createRelationalDatabase_masterUsername = (CreateRelationalDatabase -> Text)
-> (CreateRelationalDatabase -> Text -> CreateRelationalDatabase)
-> Lens CreateRelationalDatabase CreateRelationalDatabase Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRelationalDatabase' {Text
masterUsername :: Text
$sel:masterUsername:CreateRelationalDatabase' :: CreateRelationalDatabase -> Text
masterUsername} -> Text
masterUsername) (\s :: CreateRelationalDatabase
s@CreateRelationalDatabase' {} Text
a -> CreateRelationalDatabase
s {$sel:masterUsername:CreateRelationalDatabase' :: Text
masterUsername = Text
a} :: CreateRelationalDatabase)

instance Core.AWSRequest CreateRelationalDatabase where
  type
    AWSResponse CreateRelationalDatabase =
      CreateRelationalDatabaseResponse
  request :: CreateRelationalDatabase -> Request CreateRelationalDatabase
request = Service
-> CreateRelationalDatabase -> Request CreateRelationalDatabase
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateRelationalDatabase
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateRelationalDatabase)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateRelationalDatabase))
-> Logger
-> Service
-> Proxy CreateRelationalDatabase
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateRelationalDatabase)))
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 [Operation] -> Int -> CreateRelationalDatabaseResponse
CreateRelationalDatabaseResponse'
            (Maybe [Operation] -> Int -> CreateRelationalDatabaseResponse)
-> Either String (Maybe [Operation])
-> Either String (Int -> CreateRelationalDatabaseResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [Operation]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"operations" Either String (Maybe (Maybe [Operation]))
-> Maybe [Operation] -> Either String (Maybe [Operation])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [Operation]
forall a. Monoid a => a
Prelude.mempty)
            Either String (Int -> CreateRelationalDatabaseResponse)
-> Either String Int
-> Either String CreateRelationalDatabaseResponse
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 CreateRelationalDatabase

instance Prelude.NFData CreateRelationalDatabase

instance Core.ToHeaders CreateRelationalDatabase where
  toHeaders :: CreateRelationalDatabase -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateRelationalDatabase -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"Lightsail_20161128.CreateRelationalDatabase" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON CreateRelationalDatabase where
  toJSON :: CreateRelationalDatabase -> Value
toJSON CreateRelationalDatabase' {Maybe Bool
Maybe [Tag]
Maybe Text
Maybe (Sensitive Text)
Text
masterUsername :: Text
masterDatabaseName :: Text
relationalDatabaseBundleId :: Text
relationalDatabaseBlueprintId :: Text
relationalDatabaseName :: Text
tags :: Maybe [Tag]
availabilityZone :: Maybe Text
preferredBackupWindow :: Maybe Text
preferredMaintenanceWindow :: Maybe Text
publiclyAccessible :: Maybe Bool
masterUserPassword :: Maybe (Sensitive Text)
$sel:masterUsername:CreateRelationalDatabase' :: CreateRelationalDatabase -> Text
$sel:masterDatabaseName:CreateRelationalDatabase' :: CreateRelationalDatabase -> Text
$sel:relationalDatabaseBundleId:CreateRelationalDatabase' :: CreateRelationalDatabase -> Text
$sel:relationalDatabaseBlueprintId:CreateRelationalDatabase' :: CreateRelationalDatabase -> Text
$sel:relationalDatabaseName:CreateRelationalDatabase' :: CreateRelationalDatabase -> Text
$sel:tags:CreateRelationalDatabase' :: CreateRelationalDatabase -> Maybe [Tag]
$sel:availabilityZone:CreateRelationalDatabase' :: CreateRelationalDatabase -> Maybe Text
$sel:preferredBackupWindow:CreateRelationalDatabase' :: CreateRelationalDatabase -> Maybe Text
$sel:preferredMaintenanceWindow:CreateRelationalDatabase' :: CreateRelationalDatabase -> Maybe Text
$sel:publiclyAccessible:CreateRelationalDatabase' :: CreateRelationalDatabase -> Maybe Bool
$sel:masterUserPassword:CreateRelationalDatabase' :: CreateRelationalDatabase -> Maybe (Sensitive Text)
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"masterUserPassword" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Sensitive Text -> Pair) -> Maybe (Sensitive Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (Sensitive Text)
masterUserPassword,
            (Text
"publiclyAccessible" 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
publiclyAccessible,
            (Text
"preferredMaintenanceWindow" 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
preferredMaintenanceWindow,
            (Text
"preferredBackupWindow" 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
preferredBackupWindow,
            (Text
"availabilityZone" 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
availabilityZone,
            (Text
"tags" Text -> [Tag] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Tag] -> Pair) -> Maybe [Tag] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"relationalDatabaseName"
                  Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
relationalDatabaseName
              ),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"relationalDatabaseBlueprintId"
                  Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
relationalDatabaseBlueprintId
              ),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"relationalDatabaseBundleId"
                  Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
relationalDatabaseBundleId
              ),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"masterDatabaseName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
masterDatabaseName),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"masterUsername" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
masterUsername)
          ]
      )

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

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

-- | /See:/ 'newCreateRelationalDatabaseResponse' smart constructor.
data CreateRelationalDatabaseResponse = CreateRelationalDatabaseResponse'
  { -- | An array of objects that describe the result of the action, such as the
    -- status of the request, the timestamp of the request, and the resources
    -- affected by the request.
    CreateRelationalDatabaseResponse -> Maybe [Operation]
operations :: Prelude.Maybe [Operation],
    -- | The response's http status code.
    CreateRelationalDatabaseResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateRelationalDatabaseResponse
-> CreateRelationalDatabaseResponse -> Bool
(CreateRelationalDatabaseResponse
 -> CreateRelationalDatabaseResponse -> Bool)
-> (CreateRelationalDatabaseResponse
    -> CreateRelationalDatabaseResponse -> Bool)
-> Eq CreateRelationalDatabaseResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateRelationalDatabaseResponse
-> CreateRelationalDatabaseResponse -> Bool
$c/= :: CreateRelationalDatabaseResponse
-> CreateRelationalDatabaseResponse -> Bool
== :: CreateRelationalDatabaseResponse
-> CreateRelationalDatabaseResponse -> Bool
$c== :: CreateRelationalDatabaseResponse
-> CreateRelationalDatabaseResponse -> Bool
Prelude.Eq, ReadPrec [CreateRelationalDatabaseResponse]
ReadPrec CreateRelationalDatabaseResponse
Int -> ReadS CreateRelationalDatabaseResponse
ReadS [CreateRelationalDatabaseResponse]
(Int -> ReadS CreateRelationalDatabaseResponse)
-> ReadS [CreateRelationalDatabaseResponse]
-> ReadPrec CreateRelationalDatabaseResponse
-> ReadPrec [CreateRelationalDatabaseResponse]
-> Read CreateRelationalDatabaseResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateRelationalDatabaseResponse]
$creadListPrec :: ReadPrec [CreateRelationalDatabaseResponse]
readPrec :: ReadPrec CreateRelationalDatabaseResponse
$creadPrec :: ReadPrec CreateRelationalDatabaseResponse
readList :: ReadS [CreateRelationalDatabaseResponse]
$creadList :: ReadS [CreateRelationalDatabaseResponse]
readsPrec :: Int -> ReadS CreateRelationalDatabaseResponse
$creadsPrec :: Int -> ReadS CreateRelationalDatabaseResponse
Prelude.Read, Int -> CreateRelationalDatabaseResponse -> ShowS
[CreateRelationalDatabaseResponse] -> ShowS
CreateRelationalDatabaseResponse -> String
(Int -> CreateRelationalDatabaseResponse -> ShowS)
-> (CreateRelationalDatabaseResponse -> String)
-> ([CreateRelationalDatabaseResponse] -> ShowS)
-> Show CreateRelationalDatabaseResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateRelationalDatabaseResponse] -> ShowS
$cshowList :: [CreateRelationalDatabaseResponse] -> ShowS
show :: CreateRelationalDatabaseResponse -> String
$cshow :: CreateRelationalDatabaseResponse -> String
showsPrec :: Int -> CreateRelationalDatabaseResponse -> ShowS
$cshowsPrec :: Int -> CreateRelationalDatabaseResponse -> ShowS
Prelude.Show, (forall x.
 CreateRelationalDatabaseResponse
 -> Rep CreateRelationalDatabaseResponse x)
-> (forall x.
    Rep CreateRelationalDatabaseResponse x
    -> CreateRelationalDatabaseResponse)
-> Generic CreateRelationalDatabaseResponse
forall x.
Rep CreateRelationalDatabaseResponse x
-> CreateRelationalDatabaseResponse
forall x.
CreateRelationalDatabaseResponse
-> Rep CreateRelationalDatabaseResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateRelationalDatabaseResponse x
-> CreateRelationalDatabaseResponse
$cfrom :: forall x.
CreateRelationalDatabaseResponse
-> Rep CreateRelationalDatabaseResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateRelationalDatabaseResponse' 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:
--
-- 'operations', 'createRelationalDatabaseResponse_operations' - An array of objects that describe the result of the action, such as the
-- status of the request, the timestamp of the request, and the resources
-- affected by the request.
--
-- 'httpStatus', 'createRelationalDatabaseResponse_httpStatus' - The response's http status code.
newCreateRelationalDatabaseResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateRelationalDatabaseResponse
newCreateRelationalDatabaseResponse :: Int -> CreateRelationalDatabaseResponse
newCreateRelationalDatabaseResponse Int
pHttpStatus_ =
  CreateRelationalDatabaseResponse' :: Maybe [Operation] -> Int -> CreateRelationalDatabaseResponse
CreateRelationalDatabaseResponse'
    { $sel:operations:CreateRelationalDatabaseResponse' :: Maybe [Operation]
operations =
        Maybe [Operation]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateRelationalDatabaseResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | An array of objects that describe the result of the action, such as the
-- status of the request, the timestamp of the request, and the resources
-- affected by the request.
createRelationalDatabaseResponse_operations :: Lens.Lens' CreateRelationalDatabaseResponse (Prelude.Maybe [Operation])
createRelationalDatabaseResponse_operations :: (Maybe [Operation] -> f (Maybe [Operation]))
-> CreateRelationalDatabaseResponse
-> f CreateRelationalDatabaseResponse
createRelationalDatabaseResponse_operations = (CreateRelationalDatabaseResponse -> Maybe [Operation])
-> (CreateRelationalDatabaseResponse
    -> Maybe [Operation] -> CreateRelationalDatabaseResponse)
-> Lens
     CreateRelationalDatabaseResponse
     CreateRelationalDatabaseResponse
     (Maybe [Operation])
     (Maybe [Operation])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRelationalDatabaseResponse' {Maybe [Operation]
operations :: Maybe [Operation]
$sel:operations:CreateRelationalDatabaseResponse' :: CreateRelationalDatabaseResponse -> Maybe [Operation]
operations} -> Maybe [Operation]
operations) (\s :: CreateRelationalDatabaseResponse
s@CreateRelationalDatabaseResponse' {} Maybe [Operation]
a -> CreateRelationalDatabaseResponse
s {$sel:operations:CreateRelationalDatabaseResponse' :: Maybe [Operation]
operations = Maybe [Operation]
a} :: CreateRelationalDatabaseResponse) ((Maybe [Operation] -> f (Maybe [Operation]))
 -> CreateRelationalDatabaseResponse
 -> f CreateRelationalDatabaseResponse)
-> ((Maybe [Operation] -> f (Maybe [Operation]))
    -> Maybe [Operation] -> f (Maybe [Operation]))
-> (Maybe [Operation] -> f (Maybe [Operation]))
-> CreateRelationalDatabaseResponse
-> f CreateRelationalDatabaseResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Operation] [Operation] [Operation] [Operation]
-> Iso
     (Maybe [Operation])
     (Maybe [Operation])
     (Maybe [Operation])
     (Maybe [Operation])
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 [Operation] [Operation] [Operation] [Operation]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance
  Prelude.NFData
    CreateRelationalDatabaseResponse