{-# 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.StorageGateway.DeleteTapePool
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Delete a custom tape pool. A custom tape pool can only be deleted if
-- there are no tapes in the pool and if there are no automatic tape
-- creation policies that reference the custom tape pool.
module Amazonka.StorageGateway.DeleteTapePool
  ( -- * Creating a Request
    DeleteTapePool (..),
    newDeleteTapePool,

    -- * Request Lenses
    deleteTapePool_poolARN,

    -- * Destructuring the Response
    DeleteTapePoolResponse (..),
    newDeleteTapePoolResponse,

    -- * Response Lenses
    deleteTapePoolResponse_poolARN,
    deleteTapePoolResponse_httpStatus,
  )
where

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

-- | /See:/ 'newDeleteTapePool' smart constructor.
data DeleteTapePool = DeleteTapePool'
  { -- | The Amazon Resource Name (ARN) of the custom tape pool to delete.
    DeleteTapePool -> Text
poolARN :: Prelude.Text
  }
  deriving (DeleteTapePool -> DeleteTapePool -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteTapePool -> DeleteTapePool -> Bool
$c/= :: DeleteTapePool -> DeleteTapePool -> Bool
== :: DeleteTapePool -> DeleteTapePool -> Bool
$c== :: DeleteTapePool -> DeleteTapePool -> Bool
Prelude.Eq, ReadPrec [DeleteTapePool]
ReadPrec DeleteTapePool
Int -> ReadS DeleteTapePool
ReadS [DeleteTapePool]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteTapePool]
$creadListPrec :: ReadPrec [DeleteTapePool]
readPrec :: ReadPrec DeleteTapePool
$creadPrec :: ReadPrec DeleteTapePool
readList :: ReadS [DeleteTapePool]
$creadList :: ReadS [DeleteTapePool]
readsPrec :: Int -> ReadS DeleteTapePool
$creadsPrec :: Int -> ReadS DeleteTapePool
Prelude.Read, Int -> DeleteTapePool -> ShowS
[DeleteTapePool] -> ShowS
DeleteTapePool -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteTapePool] -> ShowS
$cshowList :: [DeleteTapePool] -> ShowS
show :: DeleteTapePool -> String
$cshow :: DeleteTapePool -> String
showsPrec :: Int -> DeleteTapePool -> ShowS
$cshowsPrec :: Int -> DeleteTapePool -> ShowS
Prelude.Show, forall x. Rep DeleteTapePool x -> DeleteTapePool
forall x. DeleteTapePool -> Rep DeleteTapePool x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteTapePool x -> DeleteTapePool
$cfrom :: forall x. DeleteTapePool -> Rep DeleteTapePool x
Prelude.Generic)

-- |
-- Create a value of 'DeleteTapePool' 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:
--
-- 'poolARN', 'deleteTapePool_poolARN' - The Amazon Resource Name (ARN) of the custom tape pool to delete.
newDeleteTapePool ::
  -- | 'poolARN'
  Prelude.Text ->
  DeleteTapePool
newDeleteTapePool :: Text -> DeleteTapePool
newDeleteTapePool Text
pPoolARN_ =
  DeleteTapePool' {$sel:poolARN:DeleteTapePool' :: Text
poolARN = Text
pPoolARN_}

-- | The Amazon Resource Name (ARN) of the custom tape pool to delete.
deleteTapePool_poolARN :: Lens.Lens' DeleteTapePool Prelude.Text
deleteTapePool_poolARN :: Lens' DeleteTapePool Text
deleteTapePool_poolARN = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteTapePool' {Text
poolARN :: Text
$sel:poolARN:DeleteTapePool' :: DeleteTapePool -> Text
poolARN} -> Text
poolARN) (\s :: DeleteTapePool
s@DeleteTapePool' {} Text
a -> DeleteTapePool
s {$sel:poolARN:DeleteTapePool' :: Text
poolARN = Text
a} :: DeleteTapePool)

instance Core.AWSRequest DeleteTapePool where
  type
    AWSResponse DeleteTapePool =
      DeleteTapePoolResponse
  request :: (Service -> Service) -> DeleteTapePool -> Request DeleteTapePool
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DeleteTapePool
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteTapePool)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text -> Int -> DeleteTapePoolResponse
DeleteTapePoolResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"PoolARN")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable DeleteTapePool where
  hashWithSalt :: Int -> DeleteTapePool -> Int
hashWithSalt Int
_salt DeleteTapePool' {Text
poolARN :: Text
$sel:poolARN:DeleteTapePool' :: DeleteTapePool -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
poolARN

instance Prelude.NFData DeleteTapePool where
  rnf :: DeleteTapePool -> ()
rnf DeleteTapePool' {Text
poolARN :: Text
$sel:poolARN:DeleteTapePool' :: DeleteTapePool -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
poolARN

instance Data.ToHeaders DeleteTapePool where
  toHeaders :: DeleteTapePool -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"StorageGateway_20130630.DeleteTapePool" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON DeleteTapePool where
  toJSON :: DeleteTapePool -> Value
toJSON DeleteTapePool' {Text
poolARN :: Text
$sel:poolARN:DeleteTapePool' :: DeleteTapePool -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [forall a. a -> Maybe a
Prelude.Just (Key
"PoolARN" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
poolARN)]
      )

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

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

-- | /See:/ 'newDeleteTapePoolResponse' smart constructor.
data DeleteTapePoolResponse = DeleteTapePoolResponse'
  { -- | The Amazon Resource Name (ARN) of the custom tape pool being deleted.
    DeleteTapePoolResponse -> Maybe Text
poolARN :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    DeleteTapePoolResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DeleteTapePoolResponse -> DeleteTapePoolResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteTapePoolResponse -> DeleteTapePoolResponse -> Bool
$c/= :: DeleteTapePoolResponse -> DeleteTapePoolResponse -> Bool
== :: DeleteTapePoolResponse -> DeleteTapePoolResponse -> Bool
$c== :: DeleteTapePoolResponse -> DeleteTapePoolResponse -> Bool
Prelude.Eq, ReadPrec [DeleteTapePoolResponse]
ReadPrec DeleteTapePoolResponse
Int -> ReadS DeleteTapePoolResponse
ReadS [DeleteTapePoolResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteTapePoolResponse]
$creadListPrec :: ReadPrec [DeleteTapePoolResponse]
readPrec :: ReadPrec DeleteTapePoolResponse
$creadPrec :: ReadPrec DeleteTapePoolResponse
readList :: ReadS [DeleteTapePoolResponse]
$creadList :: ReadS [DeleteTapePoolResponse]
readsPrec :: Int -> ReadS DeleteTapePoolResponse
$creadsPrec :: Int -> ReadS DeleteTapePoolResponse
Prelude.Read, Int -> DeleteTapePoolResponse -> ShowS
[DeleteTapePoolResponse] -> ShowS
DeleteTapePoolResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteTapePoolResponse] -> ShowS
$cshowList :: [DeleteTapePoolResponse] -> ShowS
show :: DeleteTapePoolResponse -> String
$cshow :: DeleteTapePoolResponse -> String
showsPrec :: Int -> DeleteTapePoolResponse -> ShowS
$cshowsPrec :: Int -> DeleteTapePoolResponse -> ShowS
Prelude.Show, forall x. Rep DeleteTapePoolResponse x -> DeleteTapePoolResponse
forall x. DeleteTapePoolResponse -> Rep DeleteTapePoolResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteTapePoolResponse x -> DeleteTapePoolResponse
$cfrom :: forall x. DeleteTapePoolResponse -> Rep DeleteTapePoolResponse x
Prelude.Generic)

-- |
-- Create a value of 'DeleteTapePoolResponse' 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:
--
-- 'poolARN', 'deleteTapePoolResponse_poolARN' - The Amazon Resource Name (ARN) of the custom tape pool being deleted.
--
-- 'httpStatus', 'deleteTapePoolResponse_httpStatus' - The response's http status code.
newDeleteTapePoolResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeleteTapePoolResponse
newDeleteTapePoolResponse :: Int -> DeleteTapePoolResponse
newDeleteTapePoolResponse Int
pHttpStatus_ =
  DeleteTapePoolResponse'
    { $sel:poolARN:DeleteTapePoolResponse' :: Maybe Text
poolARN = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DeleteTapePoolResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The Amazon Resource Name (ARN) of the custom tape pool being deleted.
deleteTapePoolResponse_poolARN :: Lens.Lens' DeleteTapePoolResponse (Prelude.Maybe Prelude.Text)
deleteTapePoolResponse_poolARN :: Lens' DeleteTapePoolResponse (Maybe Text)
deleteTapePoolResponse_poolARN = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteTapePoolResponse' {Maybe Text
poolARN :: Maybe Text
$sel:poolARN:DeleteTapePoolResponse' :: DeleteTapePoolResponse -> Maybe Text
poolARN} -> Maybe Text
poolARN) (\s :: DeleteTapePoolResponse
s@DeleteTapePoolResponse' {} Maybe Text
a -> DeleteTapePoolResponse
s {$sel:poolARN:DeleteTapePoolResponse' :: Maybe Text
poolARN = Maybe Text
a} :: DeleteTapePoolResponse)

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

instance Prelude.NFData DeleteTapePoolResponse where
  rnf :: DeleteTapePoolResponse -> ()
rnf DeleteTapePoolResponse' {Int
Maybe Text
httpStatus :: Int
poolARN :: Maybe Text
$sel:httpStatus:DeleteTapePoolResponse' :: DeleteTapePoolResponse -> Int
$sel:poolARN:DeleteTapePoolResponse' :: DeleteTapePoolResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
poolARN
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus