{-# 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-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 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.Lens as Lens
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
(DeleteWorkspace -> DeleteWorkspace -> Bool)
-> (DeleteWorkspace -> DeleteWorkspace -> Bool)
-> Eq DeleteWorkspace
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]
(Int -> ReadS DeleteWorkspace)
-> ReadS [DeleteWorkspace]
-> ReadPrec DeleteWorkspace
-> ReadPrec [DeleteWorkspace]
-> Read 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
(Int -> DeleteWorkspace -> ShowS)
-> (DeleteWorkspace -> String)
-> ([DeleteWorkspace] -> ShowS)
-> Show DeleteWorkspace
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. DeleteWorkspace -> Rep DeleteWorkspace x)
-> (forall x. Rep DeleteWorkspace x -> DeleteWorkspace)
-> Generic DeleteWorkspace
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' :: Maybe Text -> Text -> DeleteWorkspace
DeleteWorkspace'
    { $sel:clientToken:DeleteWorkspace' :: Maybe Text
clientToken = Maybe Text
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 :: (Maybe Text -> f (Maybe Text))
-> DeleteWorkspace -> f DeleteWorkspace
deleteWorkspace_clientToken = (DeleteWorkspace -> Maybe Text)
-> (DeleteWorkspace -> Maybe Text -> DeleteWorkspace)
-> Lens DeleteWorkspace DeleteWorkspace (Maybe Text) (Maybe Text)
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 :: (Text -> f Text) -> DeleteWorkspace -> f DeleteWorkspace
deleteWorkspace_workspaceId = (DeleteWorkspace -> Text)
-> (DeleteWorkspace -> Text -> DeleteWorkspace)
-> Lens DeleteWorkspace DeleteWorkspace Text Text
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 :: DeleteWorkspace -> Request DeleteWorkspace
request = Service -> DeleteWorkspace -> Request DeleteWorkspace
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteWorkspace
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteWorkspace)))
response =
    AWSResponse DeleteWorkspace
-> Logger
-> Service
-> Proxy DeleteWorkspace
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteWorkspace)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse DeleteWorkspace
DeleteWorkspaceResponse
DeleteWorkspaceResponse'

instance Prelude.Hashable DeleteWorkspace

instance Prelude.NFData DeleteWorkspace

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

instance Core.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
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/workspaces/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
workspaceId]

instance Core.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
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"clientToken" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
clientToken]

-- | /See:/ 'newDeleteWorkspaceResponse' smart constructor.
data DeleteWorkspaceResponse = DeleteWorkspaceResponse'
  {
  }
  deriving (DeleteWorkspaceResponse -> DeleteWorkspaceResponse -> Bool
(DeleteWorkspaceResponse -> DeleteWorkspaceResponse -> Bool)
-> (DeleteWorkspaceResponse -> DeleteWorkspaceResponse -> Bool)
-> Eq DeleteWorkspaceResponse
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]
(Int -> ReadS DeleteWorkspaceResponse)
-> ReadS [DeleteWorkspaceResponse]
-> ReadPrec DeleteWorkspaceResponse
-> ReadPrec [DeleteWorkspaceResponse]
-> Read 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
(Int -> DeleteWorkspaceResponse -> ShowS)
-> (DeleteWorkspaceResponse -> String)
-> ([DeleteWorkspaceResponse] -> ShowS)
-> Show DeleteWorkspaceResponse
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.
 DeleteWorkspaceResponse -> Rep DeleteWorkspaceResponse x)
-> (forall x.
    Rep DeleteWorkspaceResponse x -> DeleteWorkspaceResponse)
-> Generic DeleteWorkspaceResponse
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