{-# 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.DocumentDB.CreateDBInstance
-- 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 instance.
module Amazonka.DocumentDB.CreateDBInstance
  ( -- * Creating a Request
    CreateDBInstance (..),
    newCreateDBInstance,

    -- * Request Lenses
    createDBInstance_autoMinorVersionUpgrade,
    createDBInstance_promotionTier,
    createDBInstance_preferredMaintenanceWindow,
    createDBInstance_availabilityZone,
    createDBInstance_tags,
    createDBInstance_dbInstanceIdentifier,
    createDBInstance_dbInstanceClass,
    createDBInstance_engine,
    createDBInstance_dbClusterIdentifier,

    -- * Destructuring the Response
    CreateDBInstanceResponse (..),
    newCreateDBInstanceResponse,

    -- * Response Lenses
    createDBInstanceResponse_dbInstance,
    createDBInstanceResponse_httpStatus,
  )
where

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

-- | Represents the input to CreateDBInstance.
--
-- /See:/ 'newCreateDBInstance' smart constructor.
data CreateDBInstance = CreateDBInstance'
  { -- | This parameter does not apply to Amazon DocumentDB. Amazon DocumentDB
    -- does not perform minor version upgrades regardless of the value set.
    --
    -- Default: @false@
    CreateDBInstance -> Maybe Bool
autoMinorVersionUpgrade :: Prelude.Maybe Prelude.Bool,
    -- | A value that specifies the order in which an Amazon DocumentDB replica
    -- is promoted to the primary instance after a failure of the existing
    -- primary instance.
    --
    -- Default: 1
    --
    -- Valid values: 0-15
    CreateDBInstance -> Maybe Int
promotionTier :: Prelude.Maybe Prelude.Int,
    -- | The time range each week during which system maintenance can occur, in
    -- Universal Coordinated Time (UTC).
    --
    -- Format: @ddd:hh24:mi-ddd:hh24:mi@
    --
    -- The default is a 30-minute window selected at random from an 8-hour
    -- block of time for each Region, occurring on a random day of the week.
    --
    -- Valid days: Mon, Tue, Wed, Thu, Fri, Sat, Sun
    --
    -- Constraints: Minimum 30-minute window.
    CreateDBInstance -> Maybe Text
preferredMaintenanceWindow :: Prelude.Maybe Prelude.Text,
    -- | The Amazon EC2 Availability Zone that the instance is created in.
    --
    -- Default: A random, system-chosen Availability Zone in the endpoint\'s
    -- Region.
    --
    -- Example: @us-east-1d@
    CreateDBInstance -> Maybe Text
availabilityZone :: Prelude.Maybe Prelude.Text,
    -- | The tags to be assigned to the instance. You can assign up to 10 tags to
    -- an instance.
    CreateDBInstance -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
    -- | The instance identifier. This parameter is stored as a lowercase string.
    --
    -- Constraints:
    --
    -- -   Must contain from 1 to 63 letters, numbers, or hyphens.
    --
    -- -   The first character must be a letter.
    --
    -- -   Cannot end with a hyphen or contain two consecutive hyphens.
    --
    -- Example: @mydbinstance@
    CreateDBInstance -> Text
dbInstanceIdentifier :: Prelude.Text,
    -- | The compute and memory capacity of the instance; for example,
    -- @db.r5.large@.
    CreateDBInstance -> Text
dbInstanceClass :: Prelude.Text,
    -- | The name of the database engine to be used for this instance.
    --
    -- Valid value: @docdb@
    CreateDBInstance -> Text
engine :: Prelude.Text,
    -- | The identifier of the cluster that the instance will belong to.
    CreateDBInstance -> Text
dbClusterIdentifier :: Prelude.Text
  }
  deriving (CreateDBInstance -> CreateDBInstance -> Bool
(CreateDBInstance -> CreateDBInstance -> Bool)
-> (CreateDBInstance -> CreateDBInstance -> Bool)
-> Eq CreateDBInstance
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateDBInstance -> CreateDBInstance -> Bool
$c/= :: CreateDBInstance -> CreateDBInstance -> Bool
== :: CreateDBInstance -> CreateDBInstance -> Bool
$c== :: CreateDBInstance -> CreateDBInstance -> Bool
Prelude.Eq, ReadPrec [CreateDBInstance]
ReadPrec CreateDBInstance
Int -> ReadS CreateDBInstance
ReadS [CreateDBInstance]
(Int -> ReadS CreateDBInstance)
-> ReadS [CreateDBInstance]
-> ReadPrec CreateDBInstance
-> ReadPrec [CreateDBInstance]
-> Read CreateDBInstance
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateDBInstance]
$creadListPrec :: ReadPrec [CreateDBInstance]
readPrec :: ReadPrec CreateDBInstance
$creadPrec :: ReadPrec CreateDBInstance
readList :: ReadS [CreateDBInstance]
$creadList :: ReadS [CreateDBInstance]
readsPrec :: Int -> ReadS CreateDBInstance
$creadsPrec :: Int -> ReadS CreateDBInstance
Prelude.Read, Int -> CreateDBInstance -> ShowS
[CreateDBInstance] -> ShowS
CreateDBInstance -> String
(Int -> CreateDBInstance -> ShowS)
-> (CreateDBInstance -> String)
-> ([CreateDBInstance] -> ShowS)
-> Show CreateDBInstance
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateDBInstance] -> ShowS
$cshowList :: [CreateDBInstance] -> ShowS
show :: CreateDBInstance -> String
$cshow :: CreateDBInstance -> String
showsPrec :: Int -> CreateDBInstance -> ShowS
$cshowsPrec :: Int -> CreateDBInstance -> ShowS
Prelude.Show, (forall x. CreateDBInstance -> Rep CreateDBInstance x)
-> (forall x. Rep CreateDBInstance x -> CreateDBInstance)
-> Generic CreateDBInstance
forall x. Rep CreateDBInstance x -> CreateDBInstance
forall x. CreateDBInstance -> Rep CreateDBInstance x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateDBInstance x -> CreateDBInstance
$cfrom :: forall x. CreateDBInstance -> Rep CreateDBInstance x
Prelude.Generic)

-- |
-- Create a value of 'CreateDBInstance' 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:
--
-- 'autoMinorVersionUpgrade', 'createDBInstance_autoMinorVersionUpgrade' - This parameter does not apply to Amazon DocumentDB. Amazon DocumentDB
-- does not perform minor version upgrades regardless of the value set.
--
-- Default: @false@
--
-- 'promotionTier', 'createDBInstance_promotionTier' - A value that specifies the order in which an Amazon DocumentDB replica
-- is promoted to the primary instance after a failure of the existing
-- primary instance.
--
-- Default: 1
--
-- Valid values: 0-15
--
-- 'preferredMaintenanceWindow', 'createDBInstance_preferredMaintenanceWindow' - The time range each week during which system maintenance can occur, in
-- Universal Coordinated Time (UTC).
--
-- Format: @ddd:hh24:mi-ddd:hh24:mi@
--
-- The default is a 30-minute window selected at random from an 8-hour
-- block of time for each Region, occurring on a random day of the week.
--
-- Valid days: Mon, Tue, Wed, Thu, Fri, Sat, Sun
--
-- Constraints: Minimum 30-minute window.
--
-- 'availabilityZone', 'createDBInstance_availabilityZone' - The Amazon EC2 Availability Zone that the instance is created in.
--
-- Default: A random, system-chosen Availability Zone in the endpoint\'s
-- Region.
--
-- Example: @us-east-1d@
--
-- 'tags', 'createDBInstance_tags' - The tags to be assigned to the instance. You can assign up to 10 tags to
-- an instance.
--
-- 'dbInstanceIdentifier', 'createDBInstance_dbInstanceIdentifier' - The instance identifier. This parameter is stored as a lowercase string.
--
-- Constraints:
--
-- -   Must contain from 1 to 63 letters, numbers, or hyphens.
--
-- -   The first character must be a letter.
--
-- -   Cannot end with a hyphen or contain two consecutive hyphens.
--
-- Example: @mydbinstance@
--
-- 'dbInstanceClass', 'createDBInstance_dbInstanceClass' - The compute and memory capacity of the instance; for example,
-- @db.r5.large@.
--
-- 'engine', 'createDBInstance_engine' - The name of the database engine to be used for this instance.
--
-- Valid value: @docdb@
--
-- 'dbClusterIdentifier', 'createDBInstance_dbClusterIdentifier' - The identifier of the cluster that the instance will belong to.
newCreateDBInstance ::
  -- | 'dbInstanceIdentifier'
  Prelude.Text ->
  -- | 'dbInstanceClass'
  Prelude.Text ->
  -- | 'engine'
  Prelude.Text ->
  -- | 'dbClusterIdentifier'
  Prelude.Text ->
  CreateDBInstance
newCreateDBInstance :: Text -> Text -> Text -> Text -> CreateDBInstance
newCreateDBInstance
  Text
pDBInstanceIdentifier_
  Text
pDBInstanceClass_
  Text
pEngine_
  Text
pDBClusterIdentifier_ =
    CreateDBInstance' :: Maybe Bool
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> Maybe [Tag]
-> Text
-> Text
-> Text
-> Text
-> CreateDBInstance
CreateDBInstance'
      { $sel:autoMinorVersionUpgrade:CreateDBInstance' :: Maybe Bool
autoMinorVersionUpgrade =
          Maybe Bool
forall a. Maybe a
Prelude.Nothing,
        $sel:promotionTier:CreateDBInstance' :: Maybe Int
promotionTier = Maybe Int
forall a. Maybe a
Prelude.Nothing,
        $sel:preferredMaintenanceWindow:CreateDBInstance' :: Maybe Text
preferredMaintenanceWindow = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:availabilityZone:CreateDBInstance' :: Maybe Text
availabilityZone = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreateDBInstance' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
        $sel:dbInstanceIdentifier:CreateDBInstance' :: Text
dbInstanceIdentifier = Text
pDBInstanceIdentifier_,
        $sel:dbInstanceClass:CreateDBInstance' :: Text
dbInstanceClass = Text
pDBInstanceClass_,
        $sel:engine:CreateDBInstance' :: Text
engine = Text
pEngine_,
        $sel:dbClusterIdentifier:CreateDBInstance' :: Text
dbClusterIdentifier = Text
pDBClusterIdentifier_
      }

-- | This parameter does not apply to Amazon DocumentDB. Amazon DocumentDB
-- does not perform minor version upgrades regardless of the value set.
--
-- Default: @false@
createDBInstance_autoMinorVersionUpgrade :: Lens.Lens' CreateDBInstance (Prelude.Maybe Prelude.Bool)
createDBInstance_autoMinorVersionUpgrade :: (Maybe Bool -> f (Maybe Bool))
-> CreateDBInstance -> f CreateDBInstance
createDBInstance_autoMinorVersionUpgrade = (CreateDBInstance -> Maybe Bool)
-> (CreateDBInstance -> Maybe Bool -> CreateDBInstance)
-> Lens CreateDBInstance CreateDBInstance (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDBInstance' {Maybe Bool
autoMinorVersionUpgrade :: Maybe Bool
$sel:autoMinorVersionUpgrade:CreateDBInstance' :: CreateDBInstance -> Maybe Bool
autoMinorVersionUpgrade} -> Maybe Bool
autoMinorVersionUpgrade) (\s :: CreateDBInstance
s@CreateDBInstance' {} Maybe Bool
a -> CreateDBInstance
s {$sel:autoMinorVersionUpgrade:CreateDBInstance' :: Maybe Bool
autoMinorVersionUpgrade = Maybe Bool
a} :: CreateDBInstance)

-- | A value that specifies the order in which an Amazon DocumentDB replica
-- is promoted to the primary instance after a failure of the existing
-- primary instance.
--
-- Default: 1
--
-- Valid values: 0-15
createDBInstance_promotionTier :: Lens.Lens' CreateDBInstance (Prelude.Maybe Prelude.Int)
createDBInstance_promotionTier :: (Maybe Int -> f (Maybe Int))
-> CreateDBInstance -> f CreateDBInstance
createDBInstance_promotionTier = (CreateDBInstance -> Maybe Int)
-> (CreateDBInstance -> Maybe Int -> CreateDBInstance)
-> Lens CreateDBInstance CreateDBInstance (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDBInstance' {Maybe Int
promotionTier :: Maybe Int
$sel:promotionTier:CreateDBInstance' :: CreateDBInstance -> Maybe Int
promotionTier} -> Maybe Int
promotionTier) (\s :: CreateDBInstance
s@CreateDBInstance' {} Maybe Int
a -> CreateDBInstance
s {$sel:promotionTier:CreateDBInstance' :: Maybe Int
promotionTier = Maybe Int
a} :: CreateDBInstance)

-- | The time range each week during which system maintenance can occur, in
-- Universal Coordinated Time (UTC).
--
-- Format: @ddd:hh24:mi-ddd:hh24:mi@
--
-- The default is a 30-minute window selected at random from an 8-hour
-- block of time for each Region, occurring on a random day of the week.
--
-- Valid days: Mon, Tue, Wed, Thu, Fri, Sat, Sun
--
-- Constraints: Minimum 30-minute window.
createDBInstance_preferredMaintenanceWindow :: Lens.Lens' CreateDBInstance (Prelude.Maybe Prelude.Text)
createDBInstance_preferredMaintenanceWindow :: (Maybe Text -> f (Maybe Text))
-> CreateDBInstance -> f CreateDBInstance
createDBInstance_preferredMaintenanceWindow = (CreateDBInstance -> Maybe Text)
-> (CreateDBInstance -> Maybe Text -> CreateDBInstance)
-> Lens CreateDBInstance CreateDBInstance (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDBInstance' {Maybe Text
preferredMaintenanceWindow :: Maybe Text
$sel:preferredMaintenanceWindow:CreateDBInstance' :: CreateDBInstance -> Maybe Text
preferredMaintenanceWindow} -> Maybe Text
preferredMaintenanceWindow) (\s :: CreateDBInstance
s@CreateDBInstance' {} Maybe Text
a -> CreateDBInstance
s {$sel:preferredMaintenanceWindow:CreateDBInstance' :: Maybe Text
preferredMaintenanceWindow = Maybe Text
a} :: CreateDBInstance)

-- | The Amazon EC2 Availability Zone that the instance is created in.
--
-- Default: A random, system-chosen Availability Zone in the endpoint\'s
-- Region.
--
-- Example: @us-east-1d@
createDBInstance_availabilityZone :: Lens.Lens' CreateDBInstance (Prelude.Maybe Prelude.Text)
createDBInstance_availabilityZone :: (Maybe Text -> f (Maybe Text))
-> CreateDBInstance -> f CreateDBInstance
createDBInstance_availabilityZone = (CreateDBInstance -> Maybe Text)
-> (CreateDBInstance -> Maybe Text -> CreateDBInstance)
-> Lens CreateDBInstance CreateDBInstance (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDBInstance' {Maybe Text
availabilityZone :: Maybe Text
$sel:availabilityZone:CreateDBInstance' :: CreateDBInstance -> Maybe Text
availabilityZone} -> Maybe Text
availabilityZone) (\s :: CreateDBInstance
s@CreateDBInstance' {} Maybe Text
a -> CreateDBInstance
s {$sel:availabilityZone:CreateDBInstance' :: Maybe Text
availabilityZone = Maybe Text
a} :: CreateDBInstance)

-- | The tags to be assigned to the instance. You can assign up to 10 tags to
-- an instance.
createDBInstance_tags :: Lens.Lens' CreateDBInstance (Prelude.Maybe [Tag])
createDBInstance_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateDBInstance -> f CreateDBInstance
createDBInstance_tags = (CreateDBInstance -> Maybe [Tag])
-> (CreateDBInstance -> Maybe [Tag] -> CreateDBInstance)
-> Lens
     CreateDBInstance CreateDBInstance (Maybe [Tag]) (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDBInstance' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateDBInstance' :: CreateDBInstance -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateDBInstance
s@CreateDBInstance' {} Maybe [Tag]
a -> CreateDBInstance
s {$sel:tags:CreateDBInstance' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateDBInstance) ((Maybe [Tag] -> f (Maybe [Tag]))
 -> CreateDBInstance -> f CreateDBInstance)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
    -> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateDBInstance
-> f CreateDBInstance
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 instance identifier. This parameter is stored as a lowercase string.
--
-- Constraints:
--
-- -   Must contain from 1 to 63 letters, numbers, or hyphens.
--
-- -   The first character must be a letter.
--
-- -   Cannot end with a hyphen or contain two consecutive hyphens.
--
-- Example: @mydbinstance@
createDBInstance_dbInstanceIdentifier :: Lens.Lens' CreateDBInstance Prelude.Text
createDBInstance_dbInstanceIdentifier :: (Text -> f Text) -> CreateDBInstance -> f CreateDBInstance
createDBInstance_dbInstanceIdentifier = (CreateDBInstance -> Text)
-> (CreateDBInstance -> Text -> CreateDBInstance)
-> Lens CreateDBInstance CreateDBInstance Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDBInstance' {Text
dbInstanceIdentifier :: Text
$sel:dbInstanceIdentifier:CreateDBInstance' :: CreateDBInstance -> Text
dbInstanceIdentifier} -> Text
dbInstanceIdentifier) (\s :: CreateDBInstance
s@CreateDBInstance' {} Text
a -> CreateDBInstance
s {$sel:dbInstanceIdentifier:CreateDBInstance' :: Text
dbInstanceIdentifier = Text
a} :: CreateDBInstance)

-- | The compute and memory capacity of the instance; for example,
-- @db.r5.large@.
createDBInstance_dbInstanceClass :: Lens.Lens' CreateDBInstance Prelude.Text
createDBInstance_dbInstanceClass :: (Text -> f Text) -> CreateDBInstance -> f CreateDBInstance
createDBInstance_dbInstanceClass = (CreateDBInstance -> Text)
-> (CreateDBInstance -> Text -> CreateDBInstance)
-> Lens CreateDBInstance CreateDBInstance Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDBInstance' {Text
dbInstanceClass :: Text
$sel:dbInstanceClass:CreateDBInstance' :: CreateDBInstance -> Text
dbInstanceClass} -> Text
dbInstanceClass) (\s :: CreateDBInstance
s@CreateDBInstance' {} Text
a -> CreateDBInstance
s {$sel:dbInstanceClass:CreateDBInstance' :: Text
dbInstanceClass = Text
a} :: CreateDBInstance)

-- | The name of the database engine to be used for this instance.
--
-- Valid value: @docdb@
createDBInstance_engine :: Lens.Lens' CreateDBInstance Prelude.Text
createDBInstance_engine :: (Text -> f Text) -> CreateDBInstance -> f CreateDBInstance
createDBInstance_engine = (CreateDBInstance -> Text)
-> (CreateDBInstance -> Text -> CreateDBInstance)
-> Lens CreateDBInstance CreateDBInstance Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDBInstance' {Text
engine :: Text
$sel:engine:CreateDBInstance' :: CreateDBInstance -> Text
engine} -> Text
engine) (\s :: CreateDBInstance
s@CreateDBInstance' {} Text
a -> CreateDBInstance
s {$sel:engine:CreateDBInstance' :: Text
engine = Text
a} :: CreateDBInstance)

-- | The identifier of the cluster that the instance will belong to.
createDBInstance_dbClusterIdentifier :: Lens.Lens' CreateDBInstance Prelude.Text
createDBInstance_dbClusterIdentifier :: (Text -> f Text) -> CreateDBInstance -> f CreateDBInstance
createDBInstance_dbClusterIdentifier = (CreateDBInstance -> Text)
-> (CreateDBInstance -> Text -> CreateDBInstance)
-> Lens CreateDBInstance CreateDBInstance Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDBInstance' {Text
dbClusterIdentifier :: Text
$sel:dbClusterIdentifier:CreateDBInstance' :: CreateDBInstance -> Text
dbClusterIdentifier} -> Text
dbClusterIdentifier) (\s :: CreateDBInstance
s@CreateDBInstance' {} Text
a -> CreateDBInstance
s {$sel:dbClusterIdentifier:CreateDBInstance' :: Text
dbClusterIdentifier = Text
a} :: CreateDBInstance)

instance Core.AWSRequest CreateDBInstance where
  type
    AWSResponse CreateDBInstance =
      CreateDBInstanceResponse
  request :: CreateDBInstance -> Request CreateDBInstance
request = Service -> CreateDBInstance -> Request CreateDBInstance
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateDBInstance
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateDBInstance)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either String (AWSResponse CreateDBInstance))
-> Logger
-> Service
-> Proxy CreateDBInstance
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateDBInstance)))
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
    -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
      Text
"CreateDBInstanceResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe DBInstance -> Int -> CreateDBInstanceResponse
CreateDBInstanceResponse'
            (Maybe DBInstance -> Int -> CreateDBInstanceResponse)
-> Either String (Maybe DBInstance)
-> Either String (Int -> CreateDBInstanceResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe DBInstance)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"DBInstance")
            Either String (Int -> CreateDBInstanceResponse)
-> Either String Int -> Either String CreateDBInstanceResponse
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 CreateDBInstance

instance Prelude.NFData CreateDBInstance

instance Core.ToHeaders CreateDBInstance where
  toHeaders :: CreateDBInstance -> ResponseHeaders
toHeaders = ResponseHeaders -> CreateDBInstance -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty

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

instance Core.ToQuery CreateDBInstance where
  toQuery :: CreateDBInstance -> QueryString
toQuery CreateDBInstance' {Maybe Bool
Maybe Int
Maybe [Tag]
Maybe Text
Text
dbClusterIdentifier :: Text
engine :: Text
dbInstanceClass :: Text
dbInstanceIdentifier :: Text
tags :: Maybe [Tag]
availabilityZone :: Maybe Text
preferredMaintenanceWindow :: Maybe Text
promotionTier :: Maybe Int
autoMinorVersionUpgrade :: Maybe Bool
$sel:dbClusterIdentifier:CreateDBInstance' :: CreateDBInstance -> Text
$sel:engine:CreateDBInstance' :: CreateDBInstance -> Text
$sel:dbInstanceClass:CreateDBInstance' :: CreateDBInstance -> Text
$sel:dbInstanceIdentifier:CreateDBInstance' :: CreateDBInstance -> Text
$sel:tags:CreateDBInstance' :: CreateDBInstance -> Maybe [Tag]
$sel:availabilityZone:CreateDBInstance' :: CreateDBInstance -> Maybe Text
$sel:preferredMaintenanceWindow:CreateDBInstance' :: CreateDBInstance -> Maybe Text
$sel:promotionTier:CreateDBInstance' :: CreateDBInstance -> Maybe Int
$sel:autoMinorVersionUpgrade:CreateDBInstance' :: CreateDBInstance -> Maybe Bool
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"CreateDBInstance" :: Prelude.ByteString),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2014-10-31" :: Prelude.ByteString),
        ByteString
"AutoMinorVersionUpgrade"
          ByteString -> Maybe Bool -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Bool
autoMinorVersionUpgrade,
        ByteString
"PromotionTier" ByteString -> Maybe Int -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Int
promotionTier,
        ByteString
"PreferredMaintenanceWindow"
          ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
preferredMaintenanceWindow,
        ByteString
"AvailabilityZone" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
availabilityZone,
        ByteString
"Tags"
          ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Core.toQuery
            (ByteString -> [Tag] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"Tag" ([Tag] -> QueryString) -> Maybe [Tag] -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags),
        ByteString
"DBInstanceIdentifier" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
dbInstanceIdentifier,
        ByteString
"DBInstanceClass" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
dbInstanceClass,
        ByteString
"Engine" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
engine,
        ByteString
"DBClusterIdentifier" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
dbClusterIdentifier
      ]

-- | /See:/ 'newCreateDBInstanceResponse' smart constructor.
data CreateDBInstanceResponse = CreateDBInstanceResponse'
  { CreateDBInstanceResponse -> Maybe DBInstance
dbInstance :: Prelude.Maybe DBInstance,
    -- | The response's http status code.
    CreateDBInstanceResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateDBInstanceResponse -> CreateDBInstanceResponse -> Bool
(CreateDBInstanceResponse -> CreateDBInstanceResponse -> Bool)
-> (CreateDBInstanceResponse -> CreateDBInstanceResponse -> Bool)
-> Eq CreateDBInstanceResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateDBInstanceResponse -> CreateDBInstanceResponse -> Bool
$c/= :: CreateDBInstanceResponse -> CreateDBInstanceResponse -> Bool
== :: CreateDBInstanceResponse -> CreateDBInstanceResponse -> Bool
$c== :: CreateDBInstanceResponse -> CreateDBInstanceResponse -> Bool
Prelude.Eq, ReadPrec [CreateDBInstanceResponse]
ReadPrec CreateDBInstanceResponse
Int -> ReadS CreateDBInstanceResponse
ReadS [CreateDBInstanceResponse]
(Int -> ReadS CreateDBInstanceResponse)
-> ReadS [CreateDBInstanceResponse]
-> ReadPrec CreateDBInstanceResponse
-> ReadPrec [CreateDBInstanceResponse]
-> Read CreateDBInstanceResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateDBInstanceResponse]
$creadListPrec :: ReadPrec [CreateDBInstanceResponse]
readPrec :: ReadPrec CreateDBInstanceResponse
$creadPrec :: ReadPrec CreateDBInstanceResponse
readList :: ReadS [CreateDBInstanceResponse]
$creadList :: ReadS [CreateDBInstanceResponse]
readsPrec :: Int -> ReadS CreateDBInstanceResponse
$creadsPrec :: Int -> ReadS CreateDBInstanceResponse
Prelude.Read, Int -> CreateDBInstanceResponse -> ShowS
[CreateDBInstanceResponse] -> ShowS
CreateDBInstanceResponse -> String
(Int -> CreateDBInstanceResponse -> ShowS)
-> (CreateDBInstanceResponse -> String)
-> ([CreateDBInstanceResponse] -> ShowS)
-> Show CreateDBInstanceResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateDBInstanceResponse] -> ShowS
$cshowList :: [CreateDBInstanceResponse] -> ShowS
show :: CreateDBInstanceResponse -> String
$cshow :: CreateDBInstanceResponse -> String
showsPrec :: Int -> CreateDBInstanceResponse -> ShowS
$cshowsPrec :: Int -> CreateDBInstanceResponse -> ShowS
Prelude.Show, (forall x.
 CreateDBInstanceResponse -> Rep CreateDBInstanceResponse x)
-> (forall x.
    Rep CreateDBInstanceResponse x -> CreateDBInstanceResponse)
-> Generic CreateDBInstanceResponse
forall x.
Rep CreateDBInstanceResponse x -> CreateDBInstanceResponse
forall x.
CreateDBInstanceResponse -> Rep CreateDBInstanceResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateDBInstanceResponse x -> CreateDBInstanceResponse
$cfrom :: forall x.
CreateDBInstanceResponse -> Rep CreateDBInstanceResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateDBInstanceResponse' 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:
--
-- 'dbInstance', 'createDBInstanceResponse_dbInstance' - Undocumented member.
--
-- 'httpStatus', 'createDBInstanceResponse_httpStatus' - The response's http status code.
newCreateDBInstanceResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateDBInstanceResponse
newCreateDBInstanceResponse :: Int -> CreateDBInstanceResponse
newCreateDBInstanceResponse Int
pHttpStatus_ =
  CreateDBInstanceResponse' :: Maybe DBInstance -> Int -> CreateDBInstanceResponse
CreateDBInstanceResponse'
    { $sel:dbInstance:CreateDBInstanceResponse' :: Maybe DBInstance
dbInstance =
        Maybe DBInstance
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateDBInstanceResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Undocumented member.
createDBInstanceResponse_dbInstance :: Lens.Lens' CreateDBInstanceResponse (Prelude.Maybe DBInstance)
createDBInstanceResponse_dbInstance :: (Maybe DBInstance -> f (Maybe DBInstance))
-> CreateDBInstanceResponse -> f CreateDBInstanceResponse
createDBInstanceResponse_dbInstance = (CreateDBInstanceResponse -> Maybe DBInstance)
-> (CreateDBInstanceResponse
    -> Maybe DBInstance -> CreateDBInstanceResponse)
-> Lens
     CreateDBInstanceResponse
     CreateDBInstanceResponse
     (Maybe DBInstance)
     (Maybe DBInstance)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDBInstanceResponse' {Maybe DBInstance
dbInstance :: Maybe DBInstance
$sel:dbInstance:CreateDBInstanceResponse' :: CreateDBInstanceResponse -> Maybe DBInstance
dbInstance} -> Maybe DBInstance
dbInstance) (\s :: CreateDBInstanceResponse
s@CreateDBInstanceResponse' {} Maybe DBInstance
a -> CreateDBInstanceResponse
s {$sel:dbInstance:CreateDBInstanceResponse' :: Maybe DBInstance
dbInstance = Maybe DBInstance
a} :: CreateDBInstanceResponse)

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

instance Prelude.NFData CreateDBInstanceResponse