{-# 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-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)
--
-- 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 Amazonka.DMS.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

-- |
--
-- /See:/ 'newDeleteReplicationSubnetGroup' smart constructor.
data DeleteReplicationSubnetGroup = DeleteReplicationSubnetGroup'
  { -- | The subnet group name of the replication instance.
    DeleteReplicationSubnetGroup -> Text
replicationSubnetGroupIdentifier :: Prelude.Text
  }
  deriving (DeleteReplicationSubnetGroup
-> DeleteReplicationSubnetGroup -> Bool
(DeleteReplicationSubnetGroup
 -> DeleteReplicationSubnetGroup -> Bool)
-> (DeleteReplicationSubnetGroup
    -> DeleteReplicationSubnetGroup -> Bool)
-> Eq DeleteReplicationSubnetGroup
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]
(Int -> ReadS DeleteReplicationSubnetGroup)
-> ReadS [DeleteReplicationSubnetGroup]
-> ReadPrec DeleteReplicationSubnetGroup
-> ReadPrec [DeleteReplicationSubnetGroup]
-> Read 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
(Int -> DeleteReplicationSubnetGroup -> ShowS)
-> (DeleteReplicationSubnetGroup -> String)
-> ([DeleteReplicationSubnetGroup] -> ShowS)
-> Show DeleteReplicationSubnetGroup
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.
 DeleteReplicationSubnetGroup -> Rep DeleteReplicationSubnetGroup x)
-> (forall x.
    Rep DeleteReplicationSubnetGroup x -> DeleteReplicationSubnetGroup)
-> Generic DeleteReplicationSubnetGroup
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' :: Text -> DeleteReplicationSubnetGroup
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 :: (Text -> f Text)
-> DeleteReplicationSubnetGroup -> f DeleteReplicationSubnetGroup
deleteReplicationSubnetGroup_replicationSubnetGroupIdentifier = (DeleteReplicationSubnetGroup -> Text)
-> (DeleteReplicationSubnetGroup
    -> Text -> DeleteReplicationSubnetGroup)
-> Lens
     DeleteReplicationSubnetGroup DeleteReplicationSubnetGroup Text Text
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 :: DeleteReplicationSubnetGroup
-> Request DeleteReplicationSubnetGroup
request = Service
-> DeleteReplicationSubnetGroup
-> Request DeleteReplicationSubnetGroup
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteReplicationSubnetGroup
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteReplicationSubnetGroup)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse DeleteReplicationSubnetGroup))
-> Logger
-> Service
-> Proxy DeleteReplicationSubnetGroup
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteReplicationSubnetGroup)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> DeleteReplicationSubnetGroupResponse
DeleteReplicationSubnetGroupResponse'
            (Int -> DeleteReplicationSubnetGroupResponse)
-> Either String Int
-> Either String DeleteReplicationSubnetGroupResponse
forall (f :: * -> *) a b. Functor 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
    DeleteReplicationSubnetGroup

instance Prelude.NFData DeleteReplicationSubnetGroup

instance Core.ToHeaders DeleteReplicationSubnetGroup where
  toHeaders :: DeleteReplicationSubnetGroup -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DeleteReplicationSubnetGroup -> 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
"AmazonDMSv20160101.DeleteReplicationSubnetGroup" ::
                          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 DeleteReplicationSubnetGroup where
  toJSON :: DeleteReplicationSubnetGroup -> Value
toJSON DeleteReplicationSubnetGroup' {Text
replicationSubnetGroupIdentifier :: Text
$sel:replicationSubnetGroupIdentifier:DeleteReplicationSubnetGroup' :: DeleteReplicationSubnetGroup -> 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
"ReplicationSubnetGroupIdentifier"
                  Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
replicationSubnetGroupIdentifier
              )
          ]
      )

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

instance Core.ToQuery DeleteReplicationSubnetGroup where
  toQuery :: DeleteReplicationSubnetGroup -> QueryString
toQuery = QueryString -> DeleteReplicationSubnetGroup -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(DeleteReplicationSubnetGroupResponse
 -> DeleteReplicationSubnetGroupResponse -> Bool)
-> (DeleteReplicationSubnetGroupResponse
    -> DeleteReplicationSubnetGroupResponse -> Bool)
-> Eq DeleteReplicationSubnetGroupResponse
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]
(Int -> ReadS DeleteReplicationSubnetGroupResponse)
-> ReadS [DeleteReplicationSubnetGroupResponse]
-> ReadPrec DeleteReplicationSubnetGroupResponse
-> ReadPrec [DeleteReplicationSubnetGroupResponse]
-> Read 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
(Int -> DeleteReplicationSubnetGroupResponse -> ShowS)
-> (DeleteReplicationSubnetGroupResponse -> String)
-> ([DeleteReplicationSubnetGroupResponse] -> ShowS)
-> Show DeleteReplicationSubnetGroupResponse
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.
 DeleteReplicationSubnetGroupResponse
 -> Rep DeleteReplicationSubnetGroupResponse x)
-> (forall x.
    Rep DeleteReplicationSubnetGroupResponse x
    -> DeleteReplicationSubnetGroupResponse)
-> Generic DeleteReplicationSubnetGroupResponse
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' :: Int -> DeleteReplicationSubnetGroupResponse
DeleteReplicationSubnetGroupResponse'
    { $sel:httpStatus:DeleteReplicationSubnetGroupResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

-- | The response's http status code.
deleteReplicationSubnetGroupResponse_httpStatus :: Lens.Lens' DeleteReplicationSubnetGroupResponse Prelude.Int
deleteReplicationSubnetGroupResponse_httpStatus :: (Int -> f Int)
-> DeleteReplicationSubnetGroupResponse
-> f DeleteReplicationSubnetGroupResponse
deleteReplicationSubnetGroupResponse_httpStatus = (DeleteReplicationSubnetGroupResponse -> Int)
-> (DeleteReplicationSubnetGroupResponse
    -> Int -> DeleteReplicationSubnetGroupResponse)
-> Lens
     DeleteReplicationSubnetGroupResponse
     DeleteReplicationSubnetGroupResponse
     Int
     Int
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