{-# 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.DMS.DeleteReplicationSubnetGroup
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Deletes a subnet group.
module Amazonka.DMS.DeleteReplicationSubnetGroup
  ( -- * Creating a Request
    DeleteReplicationSubnetGroup (..),
    newDeleteReplicationSubnetGroup,

    -- * Request Lenses
    deleteReplicationSubnetGroup_replicationSubnetGroupIdentifier,

    -- * Destructuring the Response
    DeleteReplicationSubnetGroupResponse (..),
    newDeleteReplicationSubnetGroupResponse,

    -- * Response Lenses
    deleteReplicationSubnetGroupResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import Amazonka.DMS.Types
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- |
--
-- /See:/ 'newDeleteReplicationSubnetGroup' smart constructor.
data DeleteReplicationSubnetGroup = DeleteReplicationSubnetGroup'
  { -- | The subnet group name of the replication instance.
    DeleteReplicationSubnetGroup -> Text
replicationSubnetGroupIdentifier :: Prelude.Text
  }
  deriving (DeleteReplicationSubnetGroup
-> DeleteReplicationSubnetGroup -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteReplicationSubnetGroup
-> DeleteReplicationSubnetGroup -> Bool
$c/= :: DeleteReplicationSubnetGroup
-> DeleteReplicationSubnetGroup -> Bool
== :: DeleteReplicationSubnetGroup
-> DeleteReplicationSubnetGroup -> Bool
$c== :: DeleteReplicationSubnetGroup
-> DeleteReplicationSubnetGroup -> Bool
Prelude.Eq, ReadPrec [DeleteReplicationSubnetGroup]
ReadPrec DeleteReplicationSubnetGroup
Int -> ReadS DeleteReplicationSubnetGroup
ReadS [DeleteReplicationSubnetGroup]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteReplicationSubnetGroup]
$creadListPrec :: ReadPrec [DeleteReplicationSubnetGroup]
readPrec :: ReadPrec DeleteReplicationSubnetGroup
$creadPrec :: ReadPrec DeleteReplicationSubnetGroup
readList :: ReadS [DeleteReplicationSubnetGroup]
$creadList :: ReadS [DeleteReplicationSubnetGroup]
readsPrec :: Int -> ReadS DeleteReplicationSubnetGroup
$creadsPrec :: Int -> ReadS DeleteReplicationSubnetGroup
Prelude.Read, Int -> DeleteReplicationSubnetGroup -> ShowS
[DeleteReplicationSubnetGroup] -> ShowS
DeleteReplicationSubnetGroup -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteReplicationSubnetGroup] -> ShowS
$cshowList :: [DeleteReplicationSubnetGroup] -> ShowS
show :: DeleteReplicationSubnetGroup -> String
$cshow :: DeleteReplicationSubnetGroup -> String
showsPrec :: Int -> DeleteReplicationSubnetGroup -> ShowS
$cshowsPrec :: Int -> DeleteReplicationSubnetGroup -> ShowS
Prelude.Show, forall x.
Rep DeleteReplicationSubnetGroup x -> DeleteReplicationSubnetGroup
forall x.
DeleteReplicationSubnetGroup -> Rep DeleteReplicationSubnetGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteReplicationSubnetGroup x -> DeleteReplicationSubnetGroup
$cfrom :: forall x.
DeleteReplicationSubnetGroup -> Rep DeleteReplicationSubnetGroup x
Prelude.Generic)

-- |
-- Create a value of 'DeleteReplicationSubnetGroup' 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:
--
-- 'replicationSubnetGroupIdentifier', 'deleteReplicationSubnetGroup_replicationSubnetGroupIdentifier' - The subnet group name of the replication instance.
newDeleteReplicationSubnetGroup ::
  -- | 'replicationSubnetGroupIdentifier'
  Prelude.Text ->
  DeleteReplicationSubnetGroup
newDeleteReplicationSubnetGroup :: Text -> DeleteReplicationSubnetGroup
newDeleteReplicationSubnetGroup
  Text
pReplicationSubnetGroupIdentifier_ =
    DeleteReplicationSubnetGroup'
      { $sel:replicationSubnetGroupIdentifier:DeleteReplicationSubnetGroup' :: Text
replicationSubnetGroupIdentifier =
          Text
pReplicationSubnetGroupIdentifier_
      }

-- | The subnet group name of the replication instance.
deleteReplicationSubnetGroup_replicationSubnetGroupIdentifier :: Lens.Lens' DeleteReplicationSubnetGroup Prelude.Text
deleteReplicationSubnetGroup_replicationSubnetGroupIdentifier :: Lens' DeleteReplicationSubnetGroup Text
deleteReplicationSubnetGroup_replicationSubnetGroupIdentifier = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteReplicationSubnetGroup' {Text
replicationSubnetGroupIdentifier :: Text
$sel:replicationSubnetGroupIdentifier:DeleteReplicationSubnetGroup' :: DeleteReplicationSubnetGroup -> Text
replicationSubnetGroupIdentifier} -> Text
replicationSubnetGroupIdentifier) (\s :: DeleteReplicationSubnetGroup
s@DeleteReplicationSubnetGroup' {} Text
a -> DeleteReplicationSubnetGroup
s {$sel:replicationSubnetGroupIdentifier:DeleteReplicationSubnetGroup' :: Text
replicationSubnetGroupIdentifier = Text
a} :: DeleteReplicationSubnetGroup)

instance Core.AWSRequest DeleteReplicationSubnetGroup where
  type
    AWSResponse DeleteReplicationSubnetGroup =
      DeleteReplicationSubnetGroupResponse
  request :: (Service -> Service)
-> DeleteReplicationSubnetGroup
-> Request DeleteReplicationSubnetGroup
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DeleteReplicationSubnetGroup
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteReplicationSubnetGroup)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> DeleteReplicationSubnetGroupResponse
DeleteReplicationSubnetGroupResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance
  Prelude.Hashable
    DeleteReplicationSubnetGroup
  where
  hashWithSalt :: Int -> DeleteReplicationSubnetGroup -> Int
hashWithSalt Int
_salt DeleteReplicationSubnetGroup' {Text
replicationSubnetGroupIdentifier :: Text
$sel:replicationSubnetGroupIdentifier:DeleteReplicationSubnetGroup' :: DeleteReplicationSubnetGroup -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
replicationSubnetGroupIdentifier

instance Prelude.NFData DeleteReplicationSubnetGroup where
  rnf :: DeleteReplicationSubnetGroup -> ()
rnf DeleteReplicationSubnetGroup' {Text
replicationSubnetGroupIdentifier :: Text
$sel:replicationSubnetGroupIdentifier:DeleteReplicationSubnetGroup' :: DeleteReplicationSubnetGroup -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
replicationSubnetGroupIdentifier

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

instance Data.ToJSON DeleteReplicationSubnetGroup where
  toJSON :: DeleteReplicationSubnetGroup -> Value
toJSON DeleteReplicationSubnetGroup' {Text
replicationSubnetGroupIdentifier :: Text
$sel:replicationSubnetGroupIdentifier:DeleteReplicationSubnetGroup' :: DeleteReplicationSubnetGroup -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              ( Key
"ReplicationSubnetGroupIdentifier"
                  forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
replicationSubnetGroupIdentifier
              )
          ]
      )

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

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

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

-- |
-- Create a value of 'DeleteReplicationSubnetGroupResponse' 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:
--
-- 'httpStatus', 'deleteReplicationSubnetGroupResponse_httpStatus' - The response's http status code.
newDeleteReplicationSubnetGroupResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeleteReplicationSubnetGroupResponse
newDeleteReplicationSubnetGroupResponse :: Int -> DeleteReplicationSubnetGroupResponse
newDeleteReplicationSubnetGroupResponse Int
pHttpStatus_ =
  DeleteReplicationSubnetGroupResponse'
    { $sel:httpStatus:DeleteReplicationSubnetGroupResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

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

instance
  Prelude.NFData
    DeleteReplicationSubnetGroupResponse
  where
  rnf :: DeleteReplicationSubnetGroupResponse -> ()
rnf DeleteReplicationSubnetGroupResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteReplicationSubnetGroupResponse' :: DeleteReplicationSubnetGroupResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus