{-# 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.Neptune.PromoteReadReplicaDBCluster
-- 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)
--
-- Not supported.
module Amazonka.Neptune.PromoteReadReplicaDBCluster
  ( -- * Creating a Request
    PromoteReadReplicaDBCluster (..),
    newPromoteReadReplicaDBCluster,

    -- * Request Lenses
    promoteReadReplicaDBCluster_dbClusterIdentifier,

    -- * Destructuring the Response
    PromoteReadReplicaDBClusterResponse (..),
    newPromoteReadReplicaDBClusterResponse,

    -- * Response Lenses
    promoteReadReplicaDBClusterResponse_dbCluster,
    promoteReadReplicaDBClusterResponse_httpStatus,
  )
where

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

-- | /See:/ 'newPromoteReadReplicaDBCluster' smart constructor.
data PromoteReadReplicaDBCluster = PromoteReadReplicaDBCluster'
  { -- | Not supported.
    PromoteReadReplicaDBCluster -> Text
dbClusterIdentifier :: Prelude.Text
  }
  deriving (PromoteReadReplicaDBCluster -> PromoteReadReplicaDBCluster -> Bool
(PromoteReadReplicaDBCluster
 -> PromoteReadReplicaDBCluster -> Bool)
-> (PromoteReadReplicaDBCluster
    -> PromoteReadReplicaDBCluster -> Bool)
-> Eq PromoteReadReplicaDBCluster
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PromoteReadReplicaDBCluster -> PromoteReadReplicaDBCluster -> Bool
$c/= :: PromoteReadReplicaDBCluster -> PromoteReadReplicaDBCluster -> Bool
== :: PromoteReadReplicaDBCluster -> PromoteReadReplicaDBCluster -> Bool
$c== :: PromoteReadReplicaDBCluster -> PromoteReadReplicaDBCluster -> Bool
Prelude.Eq, ReadPrec [PromoteReadReplicaDBCluster]
ReadPrec PromoteReadReplicaDBCluster
Int -> ReadS PromoteReadReplicaDBCluster
ReadS [PromoteReadReplicaDBCluster]
(Int -> ReadS PromoteReadReplicaDBCluster)
-> ReadS [PromoteReadReplicaDBCluster]
-> ReadPrec PromoteReadReplicaDBCluster
-> ReadPrec [PromoteReadReplicaDBCluster]
-> Read PromoteReadReplicaDBCluster
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PromoteReadReplicaDBCluster]
$creadListPrec :: ReadPrec [PromoteReadReplicaDBCluster]
readPrec :: ReadPrec PromoteReadReplicaDBCluster
$creadPrec :: ReadPrec PromoteReadReplicaDBCluster
readList :: ReadS [PromoteReadReplicaDBCluster]
$creadList :: ReadS [PromoteReadReplicaDBCluster]
readsPrec :: Int -> ReadS PromoteReadReplicaDBCluster
$creadsPrec :: Int -> ReadS PromoteReadReplicaDBCluster
Prelude.Read, Int -> PromoteReadReplicaDBCluster -> ShowS
[PromoteReadReplicaDBCluster] -> ShowS
PromoteReadReplicaDBCluster -> String
(Int -> PromoteReadReplicaDBCluster -> ShowS)
-> (PromoteReadReplicaDBCluster -> String)
-> ([PromoteReadReplicaDBCluster] -> ShowS)
-> Show PromoteReadReplicaDBCluster
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PromoteReadReplicaDBCluster] -> ShowS
$cshowList :: [PromoteReadReplicaDBCluster] -> ShowS
show :: PromoteReadReplicaDBCluster -> String
$cshow :: PromoteReadReplicaDBCluster -> String
showsPrec :: Int -> PromoteReadReplicaDBCluster -> ShowS
$cshowsPrec :: Int -> PromoteReadReplicaDBCluster -> ShowS
Prelude.Show, (forall x.
 PromoteReadReplicaDBCluster -> Rep PromoteReadReplicaDBCluster x)
-> (forall x.
    Rep PromoteReadReplicaDBCluster x -> PromoteReadReplicaDBCluster)
-> Generic PromoteReadReplicaDBCluster
forall x.
Rep PromoteReadReplicaDBCluster x -> PromoteReadReplicaDBCluster
forall x.
PromoteReadReplicaDBCluster -> Rep PromoteReadReplicaDBCluster x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PromoteReadReplicaDBCluster x -> PromoteReadReplicaDBCluster
$cfrom :: forall x.
PromoteReadReplicaDBCluster -> Rep PromoteReadReplicaDBCluster x
Prelude.Generic)

-- |
-- Create a value of 'PromoteReadReplicaDBCluster' 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:
--
-- 'dbClusterIdentifier', 'promoteReadReplicaDBCluster_dbClusterIdentifier' - Not supported.
newPromoteReadReplicaDBCluster ::
  -- | 'dbClusterIdentifier'
  Prelude.Text ->
  PromoteReadReplicaDBCluster
newPromoteReadReplicaDBCluster :: Text -> PromoteReadReplicaDBCluster
newPromoteReadReplicaDBCluster Text
pDBClusterIdentifier_ =
  PromoteReadReplicaDBCluster' :: Text -> PromoteReadReplicaDBCluster
PromoteReadReplicaDBCluster'
    { $sel:dbClusterIdentifier:PromoteReadReplicaDBCluster' :: Text
dbClusterIdentifier =
        Text
pDBClusterIdentifier_
    }

-- | Not supported.
promoteReadReplicaDBCluster_dbClusterIdentifier :: Lens.Lens' PromoteReadReplicaDBCluster Prelude.Text
promoteReadReplicaDBCluster_dbClusterIdentifier :: (Text -> f Text)
-> PromoteReadReplicaDBCluster -> f PromoteReadReplicaDBCluster
promoteReadReplicaDBCluster_dbClusterIdentifier = (PromoteReadReplicaDBCluster -> Text)
-> (PromoteReadReplicaDBCluster
    -> Text -> PromoteReadReplicaDBCluster)
-> Lens
     PromoteReadReplicaDBCluster PromoteReadReplicaDBCluster Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PromoteReadReplicaDBCluster' {Text
dbClusterIdentifier :: Text
$sel:dbClusterIdentifier:PromoteReadReplicaDBCluster' :: PromoteReadReplicaDBCluster -> Text
dbClusterIdentifier} -> Text
dbClusterIdentifier) (\s :: PromoteReadReplicaDBCluster
s@PromoteReadReplicaDBCluster' {} Text
a -> PromoteReadReplicaDBCluster
s {$sel:dbClusterIdentifier:PromoteReadReplicaDBCluster' :: Text
dbClusterIdentifier = Text
a} :: PromoteReadReplicaDBCluster)

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

instance Prelude.NFData PromoteReadReplicaDBCluster

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

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

instance Core.ToQuery PromoteReadReplicaDBCluster where
  toQuery :: PromoteReadReplicaDBCluster -> QueryString
toQuery PromoteReadReplicaDBCluster' {Text
dbClusterIdentifier :: Text
$sel:dbClusterIdentifier:PromoteReadReplicaDBCluster' :: PromoteReadReplicaDBCluster -> Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: ( ByteString
"PromoteReadReplicaDBCluster" ::
                      Prelude.ByteString
                  ),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2014-10-31" :: Prelude.ByteString),
        ByteString
"DBClusterIdentifier" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
dbClusterIdentifier
      ]

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

-- |
-- Create a value of 'PromoteReadReplicaDBClusterResponse' 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:
--
-- 'dbCluster', 'promoteReadReplicaDBClusterResponse_dbCluster' - Undocumented member.
--
-- 'httpStatus', 'promoteReadReplicaDBClusterResponse_httpStatus' - The response's http status code.
newPromoteReadReplicaDBClusterResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  PromoteReadReplicaDBClusterResponse
newPromoteReadReplicaDBClusterResponse :: Int -> PromoteReadReplicaDBClusterResponse
newPromoteReadReplicaDBClusterResponse Int
pHttpStatus_ =
  PromoteReadReplicaDBClusterResponse' :: Maybe DBCluster -> Int -> PromoteReadReplicaDBClusterResponse
PromoteReadReplicaDBClusterResponse'
    { $sel:dbCluster:PromoteReadReplicaDBClusterResponse' :: Maybe DBCluster
dbCluster =
        Maybe DBCluster
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:PromoteReadReplicaDBClusterResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Undocumented member.
promoteReadReplicaDBClusterResponse_dbCluster :: Lens.Lens' PromoteReadReplicaDBClusterResponse (Prelude.Maybe DBCluster)
promoteReadReplicaDBClusterResponse_dbCluster :: (Maybe DBCluster -> f (Maybe DBCluster))
-> PromoteReadReplicaDBClusterResponse
-> f PromoteReadReplicaDBClusterResponse
promoteReadReplicaDBClusterResponse_dbCluster = (PromoteReadReplicaDBClusterResponse -> Maybe DBCluster)
-> (PromoteReadReplicaDBClusterResponse
    -> Maybe DBCluster -> PromoteReadReplicaDBClusterResponse)
-> Lens
     PromoteReadReplicaDBClusterResponse
     PromoteReadReplicaDBClusterResponse
     (Maybe DBCluster)
     (Maybe DBCluster)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PromoteReadReplicaDBClusterResponse' {Maybe DBCluster
dbCluster :: Maybe DBCluster
$sel:dbCluster:PromoteReadReplicaDBClusterResponse' :: PromoteReadReplicaDBClusterResponse -> Maybe DBCluster
dbCluster} -> Maybe DBCluster
dbCluster) (\s :: PromoteReadReplicaDBClusterResponse
s@PromoteReadReplicaDBClusterResponse' {} Maybe DBCluster
a -> PromoteReadReplicaDBClusterResponse
s {$sel:dbCluster:PromoteReadReplicaDBClusterResponse' :: Maybe DBCluster
dbCluster = Maybe DBCluster
a} :: PromoteReadReplicaDBClusterResponse)

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

instance
  Prelude.NFData
    PromoteReadReplicaDBClusterResponse