{-# 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.AMP.DeleteWorkspace
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Deletes an AMP workspace.
module Amazonka.AMP.DeleteWorkspace
  ( -- * Creating a Request
    DeleteWorkspace (..),
    newDeleteWorkspace,

    -- * Request Lenses
    deleteWorkspace_clientToken,
    deleteWorkspace_workspaceId,

    -- * Destructuring the Response
    DeleteWorkspaceResponse (..),
    newDeleteWorkspaceResponse,
  )
where

import Amazonka.AMP.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | Represents the input of a DeleteWorkspace operation.
--
-- /See:/ 'newDeleteWorkspace' smart constructor.
data DeleteWorkspace = DeleteWorkspace'
  { -- | Optional, unique, case-sensitive, user-provided identifier to ensure the
    -- idempotency of the request.
    DeleteWorkspace -> Maybe Text
clientToken :: Prelude.Maybe Prelude.Text,
    -- | The ID of the workspace to delete.
    DeleteWorkspace -> Text
workspaceId :: Prelude.Text
  }
  deriving (DeleteWorkspace -> DeleteWorkspace -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteWorkspace -> DeleteWorkspace -> Bool
$c/= :: DeleteWorkspace -> DeleteWorkspace -> Bool
== :: DeleteWorkspace -> DeleteWorkspace -> Bool
$c== :: DeleteWorkspace -> DeleteWorkspace -> Bool
Prelude.Eq, ReadPrec [DeleteWorkspace]
ReadPrec DeleteWorkspace
Int -> ReadS DeleteWorkspace
ReadS [DeleteWorkspace]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteWorkspace]
$creadListPrec :: ReadPrec [DeleteWorkspace]
readPrec :: ReadPrec DeleteWorkspace
$creadPrec :: ReadPrec DeleteWorkspace
readList :: ReadS [DeleteWorkspace]
$creadList :: ReadS [DeleteWorkspace]
readsPrec :: Int -> ReadS DeleteWorkspace
$creadsPrec :: Int -> ReadS DeleteWorkspace
Prelude.Read, Int -> DeleteWorkspace -> ShowS
[DeleteWorkspace] -> ShowS
DeleteWorkspace -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteWorkspace] -> ShowS
$cshowList :: [DeleteWorkspace] -> ShowS
show :: DeleteWorkspace -> String
$cshow :: DeleteWorkspace -> String
showsPrec :: Int -> DeleteWorkspace -> ShowS
$cshowsPrec :: Int -> DeleteWorkspace -> ShowS
Prelude.Show, forall x. Rep DeleteWorkspace x -> DeleteWorkspace
forall x. DeleteWorkspace -> Rep DeleteWorkspace x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteWorkspace x -> DeleteWorkspace
$cfrom :: forall x. DeleteWorkspace -> Rep DeleteWorkspace x
Prelude.Generic)

-- |
-- Create a value of 'DeleteWorkspace' 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:
--
-- 'clientToken', 'deleteWorkspace_clientToken' - Optional, unique, case-sensitive, user-provided identifier to ensure the
-- idempotency of the request.
--
-- 'workspaceId', 'deleteWorkspace_workspaceId' - The ID of the workspace to delete.
newDeleteWorkspace ::
  -- | 'workspaceId'
  Prelude.Text ->
  DeleteWorkspace
newDeleteWorkspace :: Text -> DeleteWorkspace
newDeleteWorkspace Text
pWorkspaceId_ =
  DeleteWorkspace'
    { $sel:clientToken:DeleteWorkspace' :: Maybe Text
clientToken = forall a. Maybe a
Prelude.Nothing,
      $sel:workspaceId:DeleteWorkspace' :: Text
workspaceId = Text
pWorkspaceId_
    }

-- | Optional, unique, case-sensitive, user-provided identifier to ensure the
-- idempotency of the request.
deleteWorkspace_clientToken :: Lens.Lens' DeleteWorkspace (Prelude.Maybe Prelude.Text)
deleteWorkspace_clientToken :: Lens' DeleteWorkspace (Maybe Text)
deleteWorkspace_clientToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteWorkspace' {Maybe Text
clientToken :: Maybe Text
$sel:clientToken:DeleteWorkspace' :: DeleteWorkspace -> Maybe Text
clientToken} -> Maybe Text
clientToken) (\s :: DeleteWorkspace
s@DeleteWorkspace' {} Maybe Text
a -> DeleteWorkspace
s {$sel:clientToken:DeleteWorkspace' :: Maybe Text
clientToken = Maybe Text
a} :: DeleteWorkspace)

-- | The ID of the workspace to delete.
deleteWorkspace_workspaceId :: Lens.Lens' DeleteWorkspace Prelude.Text
deleteWorkspace_workspaceId :: Lens' DeleteWorkspace Text
deleteWorkspace_workspaceId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteWorkspace' {Text
workspaceId :: Text
$sel:workspaceId:DeleteWorkspace' :: DeleteWorkspace -> Text
workspaceId} -> Text
workspaceId) (\s :: DeleteWorkspace
s@DeleteWorkspace' {} Text
a -> DeleteWorkspace
s {$sel:workspaceId:DeleteWorkspace' :: Text
workspaceId = Text
a} :: DeleteWorkspace)

instance Core.AWSRequest DeleteWorkspace where
  type
    AWSResponse DeleteWorkspace =
      DeleteWorkspaceResponse
  request :: (Service -> Service) -> DeleteWorkspace -> Request DeleteWorkspace
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.delete (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DeleteWorkspace
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteWorkspace)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull DeleteWorkspaceResponse
DeleteWorkspaceResponse'

instance Prelude.Hashable DeleteWorkspace where
  hashWithSalt :: Int -> DeleteWorkspace -> Int
hashWithSalt Int
_salt DeleteWorkspace' {Maybe Text
Text
workspaceId :: Text
clientToken :: Maybe Text
$sel:workspaceId:DeleteWorkspace' :: DeleteWorkspace -> Text
$sel:clientToken:DeleteWorkspace' :: DeleteWorkspace -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
clientToken
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
workspaceId

instance Prelude.NFData DeleteWorkspace where
  rnf :: DeleteWorkspace -> ()
rnf DeleteWorkspace' {Maybe Text
Text
workspaceId :: Text
clientToken :: Maybe Text
$sel:workspaceId:DeleteWorkspace' :: DeleteWorkspace -> Text
$sel:clientToken:DeleteWorkspace' :: DeleteWorkspace -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
clientToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
workspaceId

instance Data.ToHeaders DeleteWorkspace where
  toHeaders :: DeleteWorkspace -> [Header]
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> [Header]
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToPath DeleteWorkspace where
  toPath :: DeleteWorkspace -> ByteString
toPath DeleteWorkspace' {Maybe Text
Text
workspaceId :: Text
clientToken :: Maybe Text
$sel:workspaceId:DeleteWorkspace' :: DeleteWorkspace -> Text
$sel:clientToken:DeleteWorkspace' :: DeleteWorkspace -> Maybe Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/workspaces/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
workspaceId]

instance Data.ToQuery DeleteWorkspace where
  toQuery :: DeleteWorkspace -> QueryString
toQuery DeleteWorkspace' {Maybe Text
Text
workspaceId :: Text
clientToken :: Maybe Text
$sel:workspaceId:DeleteWorkspace' :: DeleteWorkspace -> Text
$sel:clientToken:DeleteWorkspace' :: DeleteWorkspace -> Maybe Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"clientToken" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
clientToken]

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

-- |
-- Create a value of 'DeleteWorkspaceResponse' 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.
newDeleteWorkspaceResponse ::
  DeleteWorkspaceResponse
newDeleteWorkspaceResponse :: DeleteWorkspaceResponse
newDeleteWorkspaceResponse = DeleteWorkspaceResponse
DeleteWorkspaceResponse'

instance Prelude.NFData DeleteWorkspaceResponse where
  rnf :: DeleteWorkspaceResponse -> ()
rnf DeleteWorkspaceResponse
_ = ()