{-# 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.DeleteBandwidthRateLimit
-- 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 the bandwidth rate limits of a gateway. You can delete either
-- the upload and download bandwidth rate limit, or you can delete both. If
-- you delete only one of the limits, the other limit remains unchanged. To
-- specify which gateway to work with, use the Amazon Resource Name (ARN)
-- of the gateway in your request. This operation is supported only for the
-- stored volume, cached volume, and tape gateway types.
module Amazonka.StorageGateway.DeleteBandwidthRateLimit
  ( -- * Creating a Request
    DeleteBandwidthRateLimit (..),
    newDeleteBandwidthRateLimit,

    -- * Request Lenses
    deleteBandwidthRateLimit_gatewayARN,
    deleteBandwidthRateLimit_bandwidthType,

    -- * Destructuring the Response
    DeleteBandwidthRateLimitResponse (..),
    newDeleteBandwidthRateLimitResponse,

    -- * Response Lenses
    deleteBandwidthRateLimitResponse_gatewayARN,
    deleteBandwidthRateLimitResponse_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

-- | A JSON object containing the following fields:
--
-- -   DeleteBandwidthRateLimitInput$BandwidthType
--
-- /See:/ 'newDeleteBandwidthRateLimit' smart constructor.
data DeleteBandwidthRateLimit = DeleteBandwidthRateLimit'
  { DeleteBandwidthRateLimit -> Text
gatewayARN :: Prelude.Text,
    -- | One of the BandwidthType values that indicates the gateway bandwidth
    -- rate limit to delete.
    --
    -- Valid Values: @UPLOAD@ | @DOWNLOAD@ | @ALL@
    DeleteBandwidthRateLimit -> Text
bandwidthType :: Prelude.Text
  }
  deriving (DeleteBandwidthRateLimit -> DeleteBandwidthRateLimit -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteBandwidthRateLimit -> DeleteBandwidthRateLimit -> Bool
$c/= :: DeleteBandwidthRateLimit -> DeleteBandwidthRateLimit -> Bool
== :: DeleteBandwidthRateLimit -> DeleteBandwidthRateLimit -> Bool
$c== :: DeleteBandwidthRateLimit -> DeleteBandwidthRateLimit -> Bool
Prelude.Eq, ReadPrec [DeleteBandwidthRateLimit]
ReadPrec DeleteBandwidthRateLimit
Int -> ReadS DeleteBandwidthRateLimit
ReadS [DeleteBandwidthRateLimit]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteBandwidthRateLimit]
$creadListPrec :: ReadPrec [DeleteBandwidthRateLimit]
readPrec :: ReadPrec DeleteBandwidthRateLimit
$creadPrec :: ReadPrec DeleteBandwidthRateLimit
readList :: ReadS [DeleteBandwidthRateLimit]
$creadList :: ReadS [DeleteBandwidthRateLimit]
readsPrec :: Int -> ReadS DeleteBandwidthRateLimit
$creadsPrec :: Int -> ReadS DeleteBandwidthRateLimit
Prelude.Read, Int -> DeleteBandwidthRateLimit -> ShowS
[DeleteBandwidthRateLimit] -> ShowS
DeleteBandwidthRateLimit -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteBandwidthRateLimit] -> ShowS
$cshowList :: [DeleteBandwidthRateLimit] -> ShowS
show :: DeleteBandwidthRateLimit -> String
$cshow :: DeleteBandwidthRateLimit -> String
showsPrec :: Int -> DeleteBandwidthRateLimit -> ShowS
$cshowsPrec :: Int -> DeleteBandwidthRateLimit -> ShowS
Prelude.Show, forall x.
Rep DeleteBandwidthRateLimit x -> DeleteBandwidthRateLimit
forall x.
DeleteBandwidthRateLimit -> Rep DeleteBandwidthRateLimit x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteBandwidthRateLimit x -> DeleteBandwidthRateLimit
$cfrom :: forall x.
DeleteBandwidthRateLimit -> Rep DeleteBandwidthRateLimit x
Prelude.Generic)

-- |
-- Create a value of 'DeleteBandwidthRateLimit' 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:
--
-- 'gatewayARN', 'deleteBandwidthRateLimit_gatewayARN' - Undocumented member.
--
-- 'bandwidthType', 'deleteBandwidthRateLimit_bandwidthType' - One of the BandwidthType values that indicates the gateway bandwidth
-- rate limit to delete.
--
-- Valid Values: @UPLOAD@ | @DOWNLOAD@ | @ALL@
newDeleteBandwidthRateLimit ::
  -- | 'gatewayARN'
  Prelude.Text ->
  -- | 'bandwidthType'
  Prelude.Text ->
  DeleteBandwidthRateLimit
newDeleteBandwidthRateLimit :: Text -> Text -> DeleteBandwidthRateLimit
newDeleteBandwidthRateLimit
  Text
pGatewayARN_
  Text
pBandwidthType_ =
    DeleteBandwidthRateLimit'
      { $sel:gatewayARN:DeleteBandwidthRateLimit' :: Text
gatewayARN =
          Text
pGatewayARN_,
        $sel:bandwidthType:DeleteBandwidthRateLimit' :: Text
bandwidthType = Text
pBandwidthType_
      }

-- | Undocumented member.
deleteBandwidthRateLimit_gatewayARN :: Lens.Lens' DeleteBandwidthRateLimit Prelude.Text
deleteBandwidthRateLimit_gatewayARN :: Lens' DeleteBandwidthRateLimit Text
deleteBandwidthRateLimit_gatewayARN = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteBandwidthRateLimit' {Text
gatewayARN :: Text
$sel:gatewayARN:DeleteBandwidthRateLimit' :: DeleteBandwidthRateLimit -> Text
gatewayARN} -> Text
gatewayARN) (\s :: DeleteBandwidthRateLimit
s@DeleteBandwidthRateLimit' {} Text
a -> DeleteBandwidthRateLimit
s {$sel:gatewayARN:DeleteBandwidthRateLimit' :: Text
gatewayARN = Text
a} :: DeleteBandwidthRateLimit)

-- | One of the BandwidthType values that indicates the gateway bandwidth
-- rate limit to delete.
--
-- Valid Values: @UPLOAD@ | @DOWNLOAD@ | @ALL@
deleteBandwidthRateLimit_bandwidthType :: Lens.Lens' DeleteBandwidthRateLimit Prelude.Text
deleteBandwidthRateLimit_bandwidthType :: Lens' DeleteBandwidthRateLimit Text
deleteBandwidthRateLimit_bandwidthType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteBandwidthRateLimit' {Text
bandwidthType :: Text
$sel:bandwidthType:DeleteBandwidthRateLimit' :: DeleteBandwidthRateLimit -> Text
bandwidthType} -> Text
bandwidthType) (\s :: DeleteBandwidthRateLimit
s@DeleteBandwidthRateLimit' {} Text
a -> DeleteBandwidthRateLimit
s {$sel:bandwidthType:DeleteBandwidthRateLimit' :: Text
bandwidthType = Text
a} :: DeleteBandwidthRateLimit)

instance Core.AWSRequest DeleteBandwidthRateLimit where
  type
    AWSResponse DeleteBandwidthRateLimit =
      DeleteBandwidthRateLimitResponse
  request :: (Service -> Service)
-> DeleteBandwidthRateLimit -> Request DeleteBandwidthRateLimit
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 DeleteBandwidthRateLimit
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteBandwidthRateLimit)))
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 -> DeleteBandwidthRateLimitResponse
DeleteBandwidthRateLimitResponse'
            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
"GatewayARN")
            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 DeleteBandwidthRateLimit where
  hashWithSalt :: Int -> DeleteBandwidthRateLimit -> Int
hashWithSalt Int
_salt DeleteBandwidthRateLimit' {Text
bandwidthType :: Text
gatewayARN :: Text
$sel:bandwidthType:DeleteBandwidthRateLimit' :: DeleteBandwidthRateLimit -> Text
$sel:gatewayARN:DeleteBandwidthRateLimit' :: DeleteBandwidthRateLimit -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
gatewayARN
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
bandwidthType

instance Prelude.NFData DeleteBandwidthRateLimit where
  rnf :: DeleteBandwidthRateLimit -> ()
rnf DeleteBandwidthRateLimit' {Text
bandwidthType :: Text
gatewayARN :: Text
$sel:bandwidthType:DeleteBandwidthRateLimit' :: DeleteBandwidthRateLimit -> Text
$sel:gatewayARN:DeleteBandwidthRateLimit' :: DeleteBandwidthRateLimit -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
gatewayARN
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
bandwidthType

instance Data.ToHeaders DeleteBandwidthRateLimit where
  toHeaders :: DeleteBandwidthRateLimit -> 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.DeleteBandwidthRateLimit" ::
                          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 DeleteBandwidthRateLimit where
  toJSON :: DeleteBandwidthRateLimit -> Value
toJSON DeleteBandwidthRateLimit' {Text
bandwidthType :: Text
gatewayARN :: Text
$sel:bandwidthType:DeleteBandwidthRateLimit' :: DeleteBandwidthRateLimit -> Text
$sel:gatewayARN:DeleteBandwidthRateLimit' :: DeleteBandwidthRateLimit -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just (Key
"GatewayARN" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
gatewayARN),
            forall a. a -> Maybe a
Prelude.Just
              (Key
"BandwidthType" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
bandwidthType)
          ]
      )

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

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

-- | A JSON object containing the Amazon Resource Name (ARN) of the gateway
-- whose bandwidth rate information was deleted.
--
-- /See:/ 'newDeleteBandwidthRateLimitResponse' smart constructor.
data DeleteBandwidthRateLimitResponse = DeleteBandwidthRateLimitResponse'
  { DeleteBandwidthRateLimitResponse -> Maybe Text
gatewayARN :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    DeleteBandwidthRateLimitResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DeleteBandwidthRateLimitResponse
-> DeleteBandwidthRateLimitResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteBandwidthRateLimitResponse
-> DeleteBandwidthRateLimitResponse -> Bool
$c/= :: DeleteBandwidthRateLimitResponse
-> DeleteBandwidthRateLimitResponse -> Bool
== :: DeleteBandwidthRateLimitResponse
-> DeleteBandwidthRateLimitResponse -> Bool
$c== :: DeleteBandwidthRateLimitResponse
-> DeleteBandwidthRateLimitResponse -> Bool
Prelude.Eq, ReadPrec [DeleteBandwidthRateLimitResponse]
ReadPrec DeleteBandwidthRateLimitResponse
Int -> ReadS DeleteBandwidthRateLimitResponse
ReadS [DeleteBandwidthRateLimitResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteBandwidthRateLimitResponse]
$creadListPrec :: ReadPrec [DeleteBandwidthRateLimitResponse]
readPrec :: ReadPrec DeleteBandwidthRateLimitResponse
$creadPrec :: ReadPrec DeleteBandwidthRateLimitResponse
readList :: ReadS [DeleteBandwidthRateLimitResponse]
$creadList :: ReadS [DeleteBandwidthRateLimitResponse]
readsPrec :: Int -> ReadS DeleteBandwidthRateLimitResponse
$creadsPrec :: Int -> ReadS DeleteBandwidthRateLimitResponse
Prelude.Read, Int -> DeleteBandwidthRateLimitResponse -> ShowS
[DeleteBandwidthRateLimitResponse] -> ShowS
DeleteBandwidthRateLimitResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteBandwidthRateLimitResponse] -> ShowS
$cshowList :: [DeleteBandwidthRateLimitResponse] -> ShowS
show :: DeleteBandwidthRateLimitResponse -> String
$cshow :: DeleteBandwidthRateLimitResponse -> String
showsPrec :: Int -> DeleteBandwidthRateLimitResponse -> ShowS
$cshowsPrec :: Int -> DeleteBandwidthRateLimitResponse -> ShowS
Prelude.Show, forall x.
Rep DeleteBandwidthRateLimitResponse x
-> DeleteBandwidthRateLimitResponse
forall x.
DeleteBandwidthRateLimitResponse
-> Rep DeleteBandwidthRateLimitResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteBandwidthRateLimitResponse x
-> DeleteBandwidthRateLimitResponse
$cfrom :: forall x.
DeleteBandwidthRateLimitResponse
-> Rep DeleteBandwidthRateLimitResponse x
Prelude.Generic)

-- |
-- Create a value of 'DeleteBandwidthRateLimitResponse' 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:
--
-- 'gatewayARN', 'deleteBandwidthRateLimitResponse_gatewayARN' - Undocumented member.
--
-- 'httpStatus', 'deleteBandwidthRateLimitResponse_httpStatus' - The response's http status code.
newDeleteBandwidthRateLimitResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeleteBandwidthRateLimitResponse
newDeleteBandwidthRateLimitResponse :: Int -> DeleteBandwidthRateLimitResponse
newDeleteBandwidthRateLimitResponse Int
pHttpStatus_ =
  DeleteBandwidthRateLimitResponse'
    { $sel:gatewayARN:DeleteBandwidthRateLimitResponse' :: Maybe Text
gatewayARN =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DeleteBandwidthRateLimitResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Undocumented member.
deleteBandwidthRateLimitResponse_gatewayARN :: Lens.Lens' DeleteBandwidthRateLimitResponse (Prelude.Maybe Prelude.Text)
deleteBandwidthRateLimitResponse_gatewayARN :: Lens' DeleteBandwidthRateLimitResponse (Maybe Text)
deleteBandwidthRateLimitResponse_gatewayARN = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteBandwidthRateLimitResponse' {Maybe Text
gatewayARN :: Maybe Text
$sel:gatewayARN:DeleteBandwidthRateLimitResponse' :: DeleteBandwidthRateLimitResponse -> Maybe Text
gatewayARN} -> Maybe Text
gatewayARN) (\s :: DeleteBandwidthRateLimitResponse
s@DeleteBandwidthRateLimitResponse' {} Maybe Text
a -> DeleteBandwidthRateLimitResponse
s {$sel:gatewayARN:DeleteBandwidthRateLimitResponse' :: Maybe Text
gatewayARN = Maybe Text
a} :: DeleteBandwidthRateLimitResponse)

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

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