{-# 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.Route53RecoveryControlConfig.DeleteRoutingControl
-- 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 routing control.
module Amazonka.Route53RecoveryControlConfig.DeleteRoutingControl
  ( -- * Creating a Request
    DeleteRoutingControl (..),
    newDeleteRoutingControl,

    -- * Request Lenses
    deleteRoutingControl_routingControlArn,

    -- * Destructuring the Response
    DeleteRoutingControlResponse (..),
    newDeleteRoutingControlResponse,

    -- * Response Lenses
    deleteRoutingControlResponse_httpStatus,
  )
where

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

-- | /See:/ 'newDeleteRoutingControl' smart constructor.
data DeleteRoutingControl = DeleteRoutingControl'
  { -- | The Amazon Resource Name (ARN) of the routing control that you\'re
    -- deleting.
    DeleteRoutingControl -> Text
routingControlArn :: Prelude.Text
  }
  deriving (DeleteRoutingControl -> DeleteRoutingControl -> Bool
(DeleteRoutingControl -> DeleteRoutingControl -> Bool)
-> (DeleteRoutingControl -> DeleteRoutingControl -> Bool)
-> Eq DeleteRoutingControl
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteRoutingControl -> DeleteRoutingControl -> Bool
$c/= :: DeleteRoutingControl -> DeleteRoutingControl -> Bool
== :: DeleteRoutingControl -> DeleteRoutingControl -> Bool
$c== :: DeleteRoutingControl -> DeleteRoutingControl -> Bool
Prelude.Eq, ReadPrec [DeleteRoutingControl]
ReadPrec DeleteRoutingControl
Int -> ReadS DeleteRoutingControl
ReadS [DeleteRoutingControl]
(Int -> ReadS DeleteRoutingControl)
-> ReadS [DeleteRoutingControl]
-> ReadPrec DeleteRoutingControl
-> ReadPrec [DeleteRoutingControl]
-> Read DeleteRoutingControl
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteRoutingControl]
$creadListPrec :: ReadPrec [DeleteRoutingControl]
readPrec :: ReadPrec DeleteRoutingControl
$creadPrec :: ReadPrec DeleteRoutingControl
readList :: ReadS [DeleteRoutingControl]
$creadList :: ReadS [DeleteRoutingControl]
readsPrec :: Int -> ReadS DeleteRoutingControl
$creadsPrec :: Int -> ReadS DeleteRoutingControl
Prelude.Read, Int -> DeleteRoutingControl -> ShowS
[DeleteRoutingControl] -> ShowS
DeleteRoutingControl -> String
(Int -> DeleteRoutingControl -> ShowS)
-> (DeleteRoutingControl -> String)
-> ([DeleteRoutingControl] -> ShowS)
-> Show DeleteRoutingControl
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteRoutingControl] -> ShowS
$cshowList :: [DeleteRoutingControl] -> ShowS
show :: DeleteRoutingControl -> String
$cshow :: DeleteRoutingControl -> String
showsPrec :: Int -> DeleteRoutingControl -> ShowS
$cshowsPrec :: Int -> DeleteRoutingControl -> ShowS
Prelude.Show, (forall x. DeleteRoutingControl -> Rep DeleteRoutingControl x)
-> (forall x. Rep DeleteRoutingControl x -> DeleteRoutingControl)
-> Generic DeleteRoutingControl
forall x. Rep DeleteRoutingControl x -> DeleteRoutingControl
forall x. DeleteRoutingControl -> Rep DeleteRoutingControl x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteRoutingControl x -> DeleteRoutingControl
$cfrom :: forall x. DeleteRoutingControl -> Rep DeleteRoutingControl x
Prelude.Generic)

-- |
-- Create a value of 'DeleteRoutingControl' 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:
--
-- 'routingControlArn', 'deleteRoutingControl_routingControlArn' - The Amazon Resource Name (ARN) of the routing control that you\'re
-- deleting.
newDeleteRoutingControl ::
  -- | 'routingControlArn'
  Prelude.Text ->
  DeleteRoutingControl
newDeleteRoutingControl :: Text -> DeleteRoutingControl
newDeleteRoutingControl Text
pRoutingControlArn_ =
  DeleteRoutingControl' :: Text -> DeleteRoutingControl
DeleteRoutingControl'
    { $sel:routingControlArn:DeleteRoutingControl' :: Text
routingControlArn =
        Text
pRoutingControlArn_
    }

-- | The Amazon Resource Name (ARN) of the routing control that you\'re
-- deleting.
deleteRoutingControl_routingControlArn :: Lens.Lens' DeleteRoutingControl Prelude.Text
deleteRoutingControl_routingControlArn :: (Text -> f Text) -> DeleteRoutingControl -> f DeleteRoutingControl
deleteRoutingControl_routingControlArn = (DeleteRoutingControl -> Text)
-> (DeleteRoutingControl -> Text -> DeleteRoutingControl)
-> Lens DeleteRoutingControl DeleteRoutingControl Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteRoutingControl' {Text
routingControlArn :: Text
$sel:routingControlArn:DeleteRoutingControl' :: DeleteRoutingControl -> Text
routingControlArn} -> Text
routingControlArn) (\s :: DeleteRoutingControl
s@DeleteRoutingControl' {} Text
a -> DeleteRoutingControl
s {$sel:routingControlArn:DeleteRoutingControl' :: Text
routingControlArn = Text
a} :: DeleteRoutingControl)

instance Core.AWSRequest DeleteRoutingControl where
  type
    AWSResponse DeleteRoutingControl =
      DeleteRoutingControlResponse
  request :: DeleteRoutingControl -> Request DeleteRoutingControl
request = Service -> DeleteRoutingControl -> Request DeleteRoutingControl
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteRoutingControl
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteRoutingControl)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse DeleteRoutingControl))
-> Logger
-> Service
-> Proxy DeleteRoutingControl
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteRoutingControl)))
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 -> DeleteRoutingControlResponse
DeleteRoutingControlResponse'
            (Int -> DeleteRoutingControlResponse)
-> Either String Int -> Either String DeleteRoutingControlResponse
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 DeleteRoutingControl

instance Prelude.NFData DeleteRoutingControl

instance Core.ToHeaders DeleteRoutingControl where
  toHeaders :: DeleteRoutingControl -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DeleteRoutingControl -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ 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.ToPath DeleteRoutingControl where
  toPath :: DeleteRoutingControl -> ByteString
toPath DeleteRoutingControl' {Text
routingControlArn :: Text
$sel:routingControlArn:DeleteRoutingControl' :: DeleteRoutingControl -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/routingcontrol/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
routingControlArn]

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

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

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

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

instance Prelude.NFData DeleteRoutingControlResponse