{-# 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.Outposts.DeleteSite
-- 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 the site.
module Amazonka.Outposts.DeleteSite
  ( -- * Creating a Request
    DeleteSite (..),
    newDeleteSite,

    -- * Request Lenses
    deleteSite_siteId,

    -- * Destructuring the Response
    DeleteSiteResponse (..),
    newDeleteSiteResponse,

    -- * Response Lenses
    deleteSiteResponse_httpStatus,
  )
where

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

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

-- |
-- Create a value of 'DeleteSite' 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:
--
-- 'siteId', 'deleteSite_siteId' - Undocumented member.
newDeleteSite ::
  -- | 'siteId'
  Prelude.Text ->
  DeleteSite
newDeleteSite :: Text -> DeleteSite
newDeleteSite Text
pSiteId_ =
  DeleteSite' :: Text -> DeleteSite
DeleteSite' {$sel:siteId:DeleteSite' :: Text
siteId = Text
pSiteId_}

-- | Undocumented member.
deleteSite_siteId :: Lens.Lens' DeleteSite Prelude.Text
deleteSite_siteId :: (Text -> f Text) -> DeleteSite -> f DeleteSite
deleteSite_siteId = (DeleteSite -> Text)
-> (DeleteSite -> Text -> DeleteSite)
-> Lens DeleteSite DeleteSite Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteSite' {Text
siteId :: Text
$sel:siteId:DeleteSite' :: DeleteSite -> Text
siteId} -> Text
siteId) (\s :: DeleteSite
s@DeleteSite' {} Text
a -> DeleteSite
s {$sel:siteId:DeleteSite' :: Text
siteId = Text
a} :: DeleteSite)

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

instance Prelude.NFData DeleteSite

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

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

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

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

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

instance Prelude.NFData DeleteSiteResponse