{-# 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.OpsWorks.DeregisterRdsDbInstance
-- 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)
--
-- Deregisters an Amazon RDS instance.
--
-- __Required Permissions__: To use this action, an IAM user must have a
-- Manage permissions level for the stack, or an attached policy that
-- explicitly grants permissions. For more information on user permissions,
-- see
-- <https://docs.aws.amazon.com/opsworks/latest/userguide/opsworks-security-users.html Managing User Permissions>.
module Amazonka.OpsWorks.DeregisterRdsDbInstance
  ( -- * Creating a Request
    DeregisterRdsDbInstance (..),
    newDeregisterRdsDbInstance,

    -- * Request Lenses
    deregisterRdsDbInstance_rdsDbInstanceArn,

    -- * Destructuring the Response
    DeregisterRdsDbInstanceResponse (..),
    newDeregisterRdsDbInstanceResponse,
  )
where

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

-- | /See:/ 'newDeregisterRdsDbInstance' smart constructor.
data DeregisterRdsDbInstance = DeregisterRdsDbInstance'
  { -- | The Amazon RDS instance\'s ARN.
    DeregisterRdsDbInstance -> Text
rdsDbInstanceArn :: Prelude.Text
  }
  deriving (DeregisterRdsDbInstance -> DeregisterRdsDbInstance -> Bool
(DeregisterRdsDbInstance -> DeregisterRdsDbInstance -> Bool)
-> (DeregisterRdsDbInstance -> DeregisterRdsDbInstance -> Bool)
-> Eq DeregisterRdsDbInstance
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeregisterRdsDbInstance -> DeregisterRdsDbInstance -> Bool
$c/= :: DeregisterRdsDbInstance -> DeregisterRdsDbInstance -> Bool
== :: DeregisterRdsDbInstance -> DeregisterRdsDbInstance -> Bool
$c== :: DeregisterRdsDbInstance -> DeregisterRdsDbInstance -> Bool
Prelude.Eq, ReadPrec [DeregisterRdsDbInstance]
ReadPrec DeregisterRdsDbInstance
Int -> ReadS DeregisterRdsDbInstance
ReadS [DeregisterRdsDbInstance]
(Int -> ReadS DeregisterRdsDbInstance)
-> ReadS [DeregisterRdsDbInstance]
-> ReadPrec DeregisterRdsDbInstance
-> ReadPrec [DeregisterRdsDbInstance]
-> Read DeregisterRdsDbInstance
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeregisterRdsDbInstance]
$creadListPrec :: ReadPrec [DeregisterRdsDbInstance]
readPrec :: ReadPrec DeregisterRdsDbInstance
$creadPrec :: ReadPrec DeregisterRdsDbInstance
readList :: ReadS [DeregisterRdsDbInstance]
$creadList :: ReadS [DeregisterRdsDbInstance]
readsPrec :: Int -> ReadS DeregisterRdsDbInstance
$creadsPrec :: Int -> ReadS DeregisterRdsDbInstance
Prelude.Read, Int -> DeregisterRdsDbInstance -> ShowS
[DeregisterRdsDbInstance] -> ShowS
DeregisterRdsDbInstance -> String
(Int -> DeregisterRdsDbInstance -> ShowS)
-> (DeregisterRdsDbInstance -> String)
-> ([DeregisterRdsDbInstance] -> ShowS)
-> Show DeregisterRdsDbInstance
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeregisterRdsDbInstance] -> ShowS
$cshowList :: [DeregisterRdsDbInstance] -> ShowS
show :: DeregisterRdsDbInstance -> String
$cshow :: DeregisterRdsDbInstance -> String
showsPrec :: Int -> DeregisterRdsDbInstance -> ShowS
$cshowsPrec :: Int -> DeregisterRdsDbInstance -> ShowS
Prelude.Show, (forall x.
 DeregisterRdsDbInstance -> Rep DeregisterRdsDbInstance x)
-> (forall x.
    Rep DeregisterRdsDbInstance x -> DeregisterRdsDbInstance)
-> Generic DeregisterRdsDbInstance
forall x. Rep DeregisterRdsDbInstance x -> DeregisterRdsDbInstance
forall x. DeregisterRdsDbInstance -> Rep DeregisterRdsDbInstance x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeregisterRdsDbInstance x -> DeregisterRdsDbInstance
$cfrom :: forall x. DeregisterRdsDbInstance -> Rep DeregisterRdsDbInstance x
Prelude.Generic)

-- |
-- Create a value of 'DeregisterRdsDbInstance' 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:
--
-- 'rdsDbInstanceArn', 'deregisterRdsDbInstance_rdsDbInstanceArn' - The Amazon RDS instance\'s ARN.
newDeregisterRdsDbInstance ::
  -- | 'rdsDbInstanceArn'
  Prelude.Text ->
  DeregisterRdsDbInstance
newDeregisterRdsDbInstance :: Text -> DeregisterRdsDbInstance
newDeregisterRdsDbInstance Text
pRdsDbInstanceArn_ =
  DeregisterRdsDbInstance' :: Text -> DeregisterRdsDbInstance
DeregisterRdsDbInstance'
    { $sel:rdsDbInstanceArn:DeregisterRdsDbInstance' :: Text
rdsDbInstanceArn =
        Text
pRdsDbInstanceArn_
    }

-- | The Amazon RDS instance\'s ARN.
deregisterRdsDbInstance_rdsDbInstanceArn :: Lens.Lens' DeregisterRdsDbInstance Prelude.Text
deregisterRdsDbInstance_rdsDbInstanceArn :: (Text -> f Text)
-> DeregisterRdsDbInstance -> f DeregisterRdsDbInstance
deregisterRdsDbInstance_rdsDbInstanceArn = (DeregisterRdsDbInstance -> Text)
-> (DeregisterRdsDbInstance -> Text -> DeregisterRdsDbInstance)
-> Lens DeregisterRdsDbInstance DeregisterRdsDbInstance Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeregisterRdsDbInstance' {Text
rdsDbInstanceArn :: Text
$sel:rdsDbInstanceArn:DeregisterRdsDbInstance' :: DeregisterRdsDbInstance -> Text
rdsDbInstanceArn} -> Text
rdsDbInstanceArn) (\s :: DeregisterRdsDbInstance
s@DeregisterRdsDbInstance' {} Text
a -> DeregisterRdsDbInstance
s {$sel:rdsDbInstanceArn:DeregisterRdsDbInstance' :: Text
rdsDbInstanceArn = Text
a} :: DeregisterRdsDbInstance)

instance Core.AWSRequest DeregisterRdsDbInstance where
  type
    AWSResponse DeregisterRdsDbInstance =
      DeregisterRdsDbInstanceResponse
  request :: DeregisterRdsDbInstance -> Request DeregisterRdsDbInstance
request = Service
-> DeregisterRdsDbInstance -> Request DeregisterRdsDbInstance
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DeregisterRdsDbInstance
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeregisterRdsDbInstance)))
response =
    AWSResponse DeregisterRdsDbInstance
-> Logger
-> Service
-> Proxy DeregisterRdsDbInstance
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeregisterRdsDbInstance)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull
      AWSResponse DeregisterRdsDbInstance
DeregisterRdsDbInstanceResponse
DeregisterRdsDbInstanceResponse'

instance Prelude.Hashable DeregisterRdsDbInstance

instance Prelude.NFData DeregisterRdsDbInstance

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

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

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

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

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

-- |
-- Create a value of 'DeregisterRdsDbInstanceResponse' 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.
newDeregisterRdsDbInstanceResponse ::
  DeregisterRdsDbInstanceResponse
newDeregisterRdsDbInstanceResponse :: DeregisterRdsDbInstanceResponse
newDeregisterRdsDbInstanceResponse =
  DeregisterRdsDbInstanceResponse
DeregisterRdsDbInstanceResponse'

instance
  Prelude.NFData
    DeregisterRdsDbInstanceResponse