{-# 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.DeletePlaceIndex
-- 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 place index resource from your AWS account.
--
-- This operation deletes the resource permanently.
module Amazonka.Location.DeletePlaceIndex
  ( -- * Creating a Request
    DeletePlaceIndex (..),
    newDeletePlaceIndex,

    -- * Request Lenses
    deletePlaceIndex_indexName,

    -- * Destructuring the Response
    DeletePlaceIndexResponse (..),
    newDeletePlaceIndexResponse,

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

-- |
-- Create a value of 'DeletePlaceIndex' 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:
--
-- 'indexName', 'deletePlaceIndex_indexName' - The name of the place index resource to be deleted.
newDeletePlaceIndex ::
  -- | 'indexName'
  Prelude.Text ->
  DeletePlaceIndex
newDeletePlaceIndex :: Text -> DeletePlaceIndex
newDeletePlaceIndex Text
pIndexName_ =
  DeletePlaceIndex' :: Text -> DeletePlaceIndex
DeletePlaceIndex' {$sel:indexName:DeletePlaceIndex' :: Text
indexName = Text
pIndexName_}

-- | The name of the place index resource to be deleted.
deletePlaceIndex_indexName :: Lens.Lens' DeletePlaceIndex Prelude.Text
deletePlaceIndex_indexName :: (Text -> f Text) -> DeletePlaceIndex -> f DeletePlaceIndex
deletePlaceIndex_indexName = (DeletePlaceIndex -> Text)
-> (DeletePlaceIndex -> Text -> DeletePlaceIndex)
-> Lens DeletePlaceIndex DeletePlaceIndex Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeletePlaceIndex' {Text
indexName :: Text
$sel:indexName:DeletePlaceIndex' :: DeletePlaceIndex -> Text
indexName} -> Text
indexName) (\s :: DeletePlaceIndex
s@DeletePlaceIndex' {} Text
a -> DeletePlaceIndex
s {$sel:indexName:DeletePlaceIndex' :: Text
indexName = Text
a} :: DeletePlaceIndex)

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

instance Prelude.NFData DeletePlaceIndex

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

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

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

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

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

instance Prelude.NFData DeletePlaceIndexResponse