{-# 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.Location.DeleteRouteCalculator
-- 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 route calculator resource from your AWS account.
--
-- This operation deletes the resource permanently.
module Amazonka.Location.DeleteRouteCalculator
  ( -- * Creating a Request
    DeleteRouteCalculator (..),
    newDeleteRouteCalculator,

    -- * Request Lenses
    deleteRouteCalculator_calculatorName,

    -- * Destructuring the Response
    DeleteRouteCalculatorResponse (..),
    newDeleteRouteCalculatorResponse,

    -- * Response Lenses
    deleteRouteCalculatorResponse_httpStatus,
  )
where

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

-- | /See:/ 'newDeleteRouteCalculator' smart constructor.
data DeleteRouteCalculator = DeleteRouteCalculator'
  { -- | The name of the route calculator resource to be deleted.
    DeleteRouteCalculator -> Text
calculatorName :: Prelude.Text
  }
  deriving (DeleteRouteCalculator -> DeleteRouteCalculator -> Bool
(DeleteRouteCalculator -> DeleteRouteCalculator -> Bool)
-> (DeleteRouteCalculator -> DeleteRouteCalculator -> Bool)
-> Eq DeleteRouteCalculator
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteRouteCalculator -> DeleteRouteCalculator -> Bool
$c/= :: DeleteRouteCalculator -> DeleteRouteCalculator -> Bool
== :: DeleteRouteCalculator -> DeleteRouteCalculator -> Bool
$c== :: DeleteRouteCalculator -> DeleteRouteCalculator -> Bool
Prelude.Eq, ReadPrec [DeleteRouteCalculator]
ReadPrec DeleteRouteCalculator
Int -> ReadS DeleteRouteCalculator
ReadS [DeleteRouteCalculator]
(Int -> ReadS DeleteRouteCalculator)
-> ReadS [DeleteRouteCalculator]
-> ReadPrec DeleteRouteCalculator
-> ReadPrec [DeleteRouteCalculator]
-> Read DeleteRouteCalculator
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteRouteCalculator]
$creadListPrec :: ReadPrec [DeleteRouteCalculator]
readPrec :: ReadPrec DeleteRouteCalculator
$creadPrec :: ReadPrec DeleteRouteCalculator
readList :: ReadS [DeleteRouteCalculator]
$creadList :: ReadS [DeleteRouteCalculator]
readsPrec :: Int -> ReadS DeleteRouteCalculator
$creadsPrec :: Int -> ReadS DeleteRouteCalculator
Prelude.Read, Int -> DeleteRouteCalculator -> ShowS
[DeleteRouteCalculator] -> ShowS
DeleteRouteCalculator -> String
(Int -> DeleteRouteCalculator -> ShowS)
-> (DeleteRouteCalculator -> String)
-> ([DeleteRouteCalculator] -> ShowS)
-> Show DeleteRouteCalculator
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteRouteCalculator] -> ShowS
$cshowList :: [DeleteRouteCalculator] -> ShowS
show :: DeleteRouteCalculator -> String
$cshow :: DeleteRouteCalculator -> String
showsPrec :: Int -> DeleteRouteCalculator -> ShowS
$cshowsPrec :: Int -> DeleteRouteCalculator -> ShowS
Prelude.Show, (forall x. DeleteRouteCalculator -> Rep DeleteRouteCalculator x)
-> (forall x. Rep DeleteRouteCalculator x -> DeleteRouteCalculator)
-> Generic DeleteRouteCalculator
forall x. Rep DeleteRouteCalculator x -> DeleteRouteCalculator
forall x. DeleteRouteCalculator -> Rep DeleteRouteCalculator x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteRouteCalculator x -> DeleteRouteCalculator
$cfrom :: forall x. DeleteRouteCalculator -> Rep DeleteRouteCalculator x
Prelude.Generic)

-- |
-- Create a value of 'DeleteRouteCalculator' 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:
--
-- 'calculatorName', 'deleteRouteCalculator_calculatorName' - The name of the route calculator resource to be deleted.
newDeleteRouteCalculator ::
  -- | 'calculatorName'
  Prelude.Text ->
  DeleteRouteCalculator
newDeleteRouteCalculator :: Text -> DeleteRouteCalculator
newDeleteRouteCalculator Text
pCalculatorName_ =
  DeleteRouteCalculator' :: Text -> DeleteRouteCalculator
DeleteRouteCalculator'
    { $sel:calculatorName:DeleteRouteCalculator' :: Text
calculatorName =
        Text
pCalculatorName_
    }

-- | The name of the route calculator resource to be deleted.
deleteRouteCalculator_calculatorName :: Lens.Lens' DeleteRouteCalculator Prelude.Text
deleteRouteCalculator_calculatorName :: (Text -> f Text)
-> DeleteRouteCalculator -> f DeleteRouteCalculator
deleteRouteCalculator_calculatorName = (DeleteRouteCalculator -> Text)
-> (DeleteRouteCalculator -> Text -> DeleteRouteCalculator)
-> Lens DeleteRouteCalculator DeleteRouteCalculator Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteRouteCalculator' {Text
calculatorName :: Text
$sel:calculatorName:DeleteRouteCalculator' :: DeleteRouteCalculator -> Text
calculatorName} -> Text
calculatorName) (\s :: DeleteRouteCalculator
s@DeleteRouteCalculator' {} Text
a -> DeleteRouteCalculator
s {$sel:calculatorName:DeleteRouteCalculator' :: Text
calculatorName = Text
a} :: DeleteRouteCalculator)

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

instance Prelude.NFData DeleteRouteCalculator

instance Core.ToHeaders DeleteRouteCalculator where
  toHeaders :: DeleteRouteCalculator -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DeleteRouteCalculator -> 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 DeleteRouteCalculator where
  toPath :: DeleteRouteCalculator -> ByteString
toPath DeleteRouteCalculator' {Text
calculatorName :: Text
$sel:calculatorName:DeleteRouteCalculator' :: DeleteRouteCalculator -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/routes/v0/calculators/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
calculatorName]

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

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

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

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

instance Prelude.NFData DeleteRouteCalculatorResponse