{-# 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.WorkSpaces.DeleteWorkspaceBundle
-- 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 specified WorkSpace bundle. For more information about
-- deleting WorkSpace bundles, see
-- <https://docs.aws.amazon.com/workspaces/latest/adminguide/delete_bundle.html Delete a Custom WorkSpaces Bundle or Image>.
module Amazonka.WorkSpaces.DeleteWorkspaceBundle
  ( -- * Creating a Request
    DeleteWorkspaceBundle (..),
    newDeleteWorkspaceBundle,

    -- * Request Lenses
    deleteWorkspaceBundle_bundleId,

    -- * Destructuring the Response
    DeleteWorkspaceBundleResponse (..),
    newDeleteWorkspaceBundleResponse,

    -- * Response Lenses
    deleteWorkspaceBundleResponse_httpStatus,
  )
where

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
import Amazonka.WorkSpaces.Types

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

-- |
-- Create a value of 'DeleteWorkspaceBundle' 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:
--
-- 'bundleId', 'deleteWorkspaceBundle_bundleId' - The identifier of the bundle.
newDeleteWorkspaceBundle ::
  DeleteWorkspaceBundle
newDeleteWorkspaceBundle :: DeleteWorkspaceBundle
newDeleteWorkspaceBundle =
  DeleteWorkspaceBundle' :: Maybe Text -> DeleteWorkspaceBundle
DeleteWorkspaceBundle' {$sel:bundleId:DeleteWorkspaceBundle' :: Maybe Text
bundleId = Maybe Text
forall a. Maybe a
Prelude.Nothing}

-- | The identifier of the bundle.
deleteWorkspaceBundle_bundleId :: Lens.Lens' DeleteWorkspaceBundle (Prelude.Maybe Prelude.Text)
deleteWorkspaceBundle_bundleId :: (Maybe Text -> f (Maybe Text))
-> DeleteWorkspaceBundle -> f DeleteWorkspaceBundle
deleteWorkspaceBundle_bundleId = (DeleteWorkspaceBundle -> Maybe Text)
-> (DeleteWorkspaceBundle -> Maybe Text -> DeleteWorkspaceBundle)
-> Lens
     DeleteWorkspaceBundle
     DeleteWorkspaceBundle
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteWorkspaceBundle' {Maybe Text
bundleId :: Maybe Text
$sel:bundleId:DeleteWorkspaceBundle' :: DeleteWorkspaceBundle -> Maybe Text
bundleId} -> Maybe Text
bundleId) (\s :: DeleteWorkspaceBundle
s@DeleteWorkspaceBundle' {} Maybe Text
a -> DeleteWorkspaceBundle
s {$sel:bundleId:DeleteWorkspaceBundle' :: Maybe Text
bundleId = Maybe Text
a} :: DeleteWorkspaceBundle)

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

instance Prelude.NFData DeleteWorkspaceBundle

instance Core.ToHeaders DeleteWorkspaceBundle where
  toHeaders :: DeleteWorkspaceBundle -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DeleteWorkspaceBundle -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"WorkspacesService.DeleteWorkspaceBundle" ::
                          Prelude.ByteString
                      ),
            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.ToJSON DeleteWorkspaceBundle where
  toJSON :: DeleteWorkspaceBundle -> Value
toJSON DeleteWorkspaceBundle' {Maybe Text
bundleId :: Maybe Text
$sel:bundleId:DeleteWorkspaceBundle' :: DeleteWorkspaceBundle -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Text
"BundleId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
bundleId]
      )

instance Core.ToPath DeleteWorkspaceBundle where
  toPath :: DeleteWorkspaceBundle -> ByteString
toPath = ByteString -> DeleteWorkspaceBundle -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

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

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

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

instance Prelude.NFData DeleteWorkspaceBundleResponse