{-# 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-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)
--
-- 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.Lens as Lens
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
(DeleteTapePool -> DeleteTapePool -> Bool)
-> (DeleteTapePool -> DeleteTapePool -> Bool) -> Eq DeleteTapePool
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]
(Int -> ReadS DeleteTapePool)
-> ReadS [DeleteTapePool]
-> ReadPrec DeleteTapePool
-> ReadPrec [DeleteTapePool]
-> Read 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
(Int -> DeleteTapePool -> ShowS)
-> (DeleteTapePool -> String)
-> ([DeleteTapePool] -> ShowS)
-> Show DeleteTapePool
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. DeleteTapePool -> Rep DeleteTapePool x)
-> (forall x. Rep DeleteTapePool x -> DeleteTapePool)
-> Generic DeleteTapePool
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' :: Text -> DeleteTapePool
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 :: (Text -> f Text) -> DeleteTapePool -> f DeleteTapePool
deleteTapePool_poolARN = (DeleteTapePool -> Text)
-> (DeleteTapePool -> Text -> DeleteTapePool)
-> Lens DeleteTapePool DeleteTapePool Text Text
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 :: DeleteTapePool -> Request DeleteTapePool
request = Service -> DeleteTapePool -> Request DeleteTapePool
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteTapePool
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteTapePool)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DeleteTapePool))
-> Logger
-> Service
-> Proxy DeleteTapePool
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteTapePool)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text -> Int -> DeleteTapePoolResponse
DeleteTapePoolResponse'
            (Maybe Text -> Int -> DeleteTapePoolResponse)
-> Either String (Maybe Text)
-> Either String (Int -> DeleteTapePoolResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"PoolARN")
            Either String (Int -> DeleteTapePoolResponse)
-> Either String Int -> Either String DeleteTapePoolResponse
forall (f :: * -> *) a b. Applicative f => 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 DeleteTapePool

instance Prelude.NFData DeleteTapePool

instance Core.ToHeaders DeleteTapePool where
  toHeaders :: DeleteTapePool -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DeleteTapePool -> 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
"StorageGateway_20130630.DeleteTapePool" ::
                          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 DeleteTapePool where
  toJSON :: DeleteTapePool -> Value
toJSON DeleteTapePool' {Text
poolARN :: Text
$sel:poolARN:DeleteTapePool' :: DeleteTapePool -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"PoolARN" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
poolARN)]
      )

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

instance Core.ToQuery DeleteTapePool where
  toQuery :: DeleteTapePool -> QueryString
toQuery = QueryString -> DeleteTapePool -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(DeleteTapePoolResponse -> DeleteTapePoolResponse -> Bool)
-> (DeleteTapePoolResponse -> DeleteTapePoolResponse -> Bool)
-> Eq DeleteTapePoolResponse
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]
(Int -> ReadS DeleteTapePoolResponse)
-> ReadS [DeleteTapePoolResponse]
-> ReadPrec DeleteTapePoolResponse
-> ReadPrec [DeleteTapePoolResponse]
-> Read 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
(Int -> DeleteTapePoolResponse -> ShowS)
-> (DeleteTapePoolResponse -> String)
-> ([DeleteTapePoolResponse] -> ShowS)
-> Show DeleteTapePoolResponse
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. DeleteTapePoolResponse -> Rep DeleteTapePoolResponse x)
-> (forall x.
    Rep DeleteTapePoolResponse x -> DeleteTapePoolResponse)
-> Generic DeleteTapePoolResponse
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' :: Maybe Text -> Int -> DeleteTapePoolResponse
DeleteTapePoolResponse'
    { $sel:poolARN:DeleteTapePoolResponse' :: Maybe Text
poolARN = Maybe Text
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 :: (Maybe Text -> f (Maybe Text))
-> DeleteTapePoolResponse -> f DeleteTapePoolResponse
deleteTapePoolResponse_poolARN = (DeleteTapePoolResponse -> Maybe Text)
-> (DeleteTapePoolResponse -> Maybe Text -> DeleteTapePoolResponse)
-> Lens
     DeleteTapePoolResponse
     DeleteTapePoolResponse
     (Maybe Text)
     (Maybe Text)
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 :: (Int -> f Int)
-> DeleteTapePoolResponse -> f DeleteTapePoolResponse
deleteTapePoolResponse_httpStatus = (DeleteTapePoolResponse -> Int)
-> (DeleteTapePoolResponse -> Int -> DeleteTapePoolResponse)
-> Lens DeleteTapePoolResponse DeleteTapePoolResponse Int Int
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