{-# 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.DeleteTracker
-- 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 tracker resource from your AWS account.
--
-- This operation deletes the resource permanently. If the tracker resource
-- is in use, you may encounter an error. Make sure that the target
-- resource isn\'t a dependency for your applications.
module Amazonka.Location.DeleteTracker
  ( -- * Creating a Request
    DeleteTracker (..),
    newDeleteTracker,

    -- * Request Lenses
    deleteTracker_trackerName,

    -- * Destructuring the Response
    DeleteTrackerResponse (..),
    newDeleteTrackerResponse,

    -- * Response Lenses
    deleteTrackerResponse_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:/ 'newDeleteTracker' smart constructor.
data DeleteTracker = DeleteTracker'
  { -- | The name of the tracker resource to be deleted.
    DeleteTracker -> Text
trackerName :: Prelude.Text
  }
  deriving (DeleteTracker -> DeleteTracker -> Bool
(DeleteTracker -> DeleteTracker -> Bool)
-> (DeleteTracker -> DeleteTracker -> Bool) -> Eq DeleteTracker
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteTracker -> DeleteTracker -> Bool
$c/= :: DeleteTracker -> DeleteTracker -> Bool
== :: DeleteTracker -> DeleteTracker -> Bool
$c== :: DeleteTracker -> DeleteTracker -> Bool
Prelude.Eq, ReadPrec [DeleteTracker]
ReadPrec DeleteTracker
Int -> ReadS DeleteTracker
ReadS [DeleteTracker]
(Int -> ReadS DeleteTracker)
-> ReadS [DeleteTracker]
-> ReadPrec DeleteTracker
-> ReadPrec [DeleteTracker]
-> Read DeleteTracker
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteTracker]
$creadListPrec :: ReadPrec [DeleteTracker]
readPrec :: ReadPrec DeleteTracker
$creadPrec :: ReadPrec DeleteTracker
readList :: ReadS [DeleteTracker]
$creadList :: ReadS [DeleteTracker]
readsPrec :: Int -> ReadS DeleteTracker
$creadsPrec :: Int -> ReadS DeleteTracker
Prelude.Read, Int -> DeleteTracker -> ShowS
[DeleteTracker] -> ShowS
DeleteTracker -> String
(Int -> DeleteTracker -> ShowS)
-> (DeleteTracker -> String)
-> ([DeleteTracker] -> ShowS)
-> Show DeleteTracker
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteTracker] -> ShowS
$cshowList :: [DeleteTracker] -> ShowS
show :: DeleteTracker -> String
$cshow :: DeleteTracker -> String
showsPrec :: Int -> DeleteTracker -> ShowS
$cshowsPrec :: Int -> DeleteTracker -> ShowS
Prelude.Show, (forall x. DeleteTracker -> Rep DeleteTracker x)
-> (forall x. Rep DeleteTracker x -> DeleteTracker)
-> Generic DeleteTracker
forall x. Rep DeleteTracker x -> DeleteTracker
forall x. DeleteTracker -> Rep DeleteTracker x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteTracker x -> DeleteTracker
$cfrom :: forall x. DeleteTracker -> Rep DeleteTracker x
Prelude.Generic)

-- |
-- Create a value of 'DeleteTracker' 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:
--
-- 'trackerName', 'deleteTracker_trackerName' - The name of the tracker resource to be deleted.
newDeleteTracker ::
  -- | 'trackerName'
  Prelude.Text ->
  DeleteTracker
newDeleteTracker :: Text -> DeleteTracker
newDeleteTracker Text
pTrackerName_ =
  DeleteTracker' :: Text -> DeleteTracker
DeleteTracker' {$sel:trackerName:DeleteTracker' :: Text
trackerName = Text
pTrackerName_}

-- | The name of the tracker resource to be deleted.
deleteTracker_trackerName :: Lens.Lens' DeleteTracker Prelude.Text
deleteTracker_trackerName :: (Text -> f Text) -> DeleteTracker -> f DeleteTracker
deleteTracker_trackerName = (DeleteTracker -> Text)
-> (DeleteTracker -> Text -> DeleteTracker)
-> Lens DeleteTracker DeleteTracker Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteTracker' {Text
trackerName :: Text
$sel:trackerName:DeleteTracker' :: DeleteTracker -> Text
trackerName} -> Text
trackerName) (\s :: DeleteTracker
s@DeleteTracker' {} Text
a -> DeleteTracker
s {$sel:trackerName:DeleteTracker' :: Text
trackerName = Text
a} :: DeleteTracker)

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

instance Prelude.NFData DeleteTracker

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

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

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

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

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

instance Prelude.NFData DeleteTrackerResponse