{-# 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.ServiceQuotas.RequestServiceQuotaIncrease
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Submits a quota increase request for the specified quota.
module Amazonka.ServiceQuotas.RequestServiceQuotaIncrease
  ( -- * Creating a Request
    RequestServiceQuotaIncrease (..),
    newRequestServiceQuotaIncrease,

    -- * Request Lenses
    requestServiceQuotaIncrease_serviceCode,
    requestServiceQuotaIncrease_quotaCode,
    requestServiceQuotaIncrease_desiredValue,

    -- * Destructuring the Response
    RequestServiceQuotaIncreaseResponse (..),
    newRequestServiceQuotaIncreaseResponse,

    -- * Response Lenses
    requestServiceQuotaIncreaseResponse_requestedQuota,
    requestServiceQuotaIncreaseResponse_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.ServiceQuotas.Types

-- | /See:/ 'newRequestServiceQuotaIncrease' smart constructor.
data RequestServiceQuotaIncrease = RequestServiceQuotaIncrease'
  { -- | The service identifier.
    RequestServiceQuotaIncrease -> Text
serviceCode :: Prelude.Text,
    -- | The quota identifier.
    RequestServiceQuotaIncrease -> Text
quotaCode :: Prelude.Text,
    -- | The new, increased value for the quota.
    RequestServiceQuotaIncrease -> Double
desiredValue :: Prelude.Double
  }
  deriving (RequestServiceQuotaIncrease -> RequestServiceQuotaIncrease -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RequestServiceQuotaIncrease -> RequestServiceQuotaIncrease -> Bool
$c/= :: RequestServiceQuotaIncrease -> RequestServiceQuotaIncrease -> Bool
== :: RequestServiceQuotaIncrease -> RequestServiceQuotaIncrease -> Bool
$c== :: RequestServiceQuotaIncrease -> RequestServiceQuotaIncrease -> Bool
Prelude.Eq, ReadPrec [RequestServiceQuotaIncrease]
ReadPrec RequestServiceQuotaIncrease
Int -> ReadS RequestServiceQuotaIncrease
ReadS [RequestServiceQuotaIncrease]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RequestServiceQuotaIncrease]
$creadListPrec :: ReadPrec [RequestServiceQuotaIncrease]
readPrec :: ReadPrec RequestServiceQuotaIncrease
$creadPrec :: ReadPrec RequestServiceQuotaIncrease
readList :: ReadS [RequestServiceQuotaIncrease]
$creadList :: ReadS [RequestServiceQuotaIncrease]
readsPrec :: Int -> ReadS RequestServiceQuotaIncrease
$creadsPrec :: Int -> ReadS RequestServiceQuotaIncrease
Prelude.Read, Int -> RequestServiceQuotaIncrease -> ShowS
[RequestServiceQuotaIncrease] -> ShowS
RequestServiceQuotaIncrease -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RequestServiceQuotaIncrease] -> ShowS
$cshowList :: [RequestServiceQuotaIncrease] -> ShowS
show :: RequestServiceQuotaIncrease -> String
$cshow :: RequestServiceQuotaIncrease -> String
showsPrec :: Int -> RequestServiceQuotaIncrease -> ShowS
$cshowsPrec :: Int -> RequestServiceQuotaIncrease -> ShowS
Prelude.Show, forall x.
Rep RequestServiceQuotaIncrease x -> RequestServiceQuotaIncrease
forall x.
RequestServiceQuotaIncrease -> Rep RequestServiceQuotaIncrease x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep RequestServiceQuotaIncrease x -> RequestServiceQuotaIncrease
$cfrom :: forall x.
RequestServiceQuotaIncrease -> Rep RequestServiceQuotaIncrease x
Prelude.Generic)

-- |
-- Create a value of 'RequestServiceQuotaIncrease' 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:
--
-- 'serviceCode', 'requestServiceQuotaIncrease_serviceCode' - The service identifier.
--
-- 'quotaCode', 'requestServiceQuotaIncrease_quotaCode' - The quota identifier.
--
-- 'desiredValue', 'requestServiceQuotaIncrease_desiredValue' - The new, increased value for the quota.
newRequestServiceQuotaIncrease ::
  -- | 'serviceCode'
  Prelude.Text ->
  -- | 'quotaCode'
  Prelude.Text ->
  -- | 'desiredValue'
  Prelude.Double ->
  RequestServiceQuotaIncrease
newRequestServiceQuotaIncrease :: Text -> Text -> Double -> RequestServiceQuotaIncrease
newRequestServiceQuotaIncrease
  Text
pServiceCode_
  Text
pQuotaCode_
  Double
pDesiredValue_ =
    RequestServiceQuotaIncrease'
      { $sel:serviceCode:RequestServiceQuotaIncrease' :: Text
serviceCode =
          Text
pServiceCode_,
        $sel:quotaCode:RequestServiceQuotaIncrease' :: Text
quotaCode = Text
pQuotaCode_,
        $sel:desiredValue:RequestServiceQuotaIncrease' :: Double
desiredValue = Double
pDesiredValue_
      }

-- | The service identifier.
requestServiceQuotaIncrease_serviceCode :: Lens.Lens' RequestServiceQuotaIncrease Prelude.Text
requestServiceQuotaIncrease_serviceCode :: Lens' RequestServiceQuotaIncrease Text
requestServiceQuotaIncrease_serviceCode = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RequestServiceQuotaIncrease' {Text
serviceCode :: Text
$sel:serviceCode:RequestServiceQuotaIncrease' :: RequestServiceQuotaIncrease -> Text
serviceCode} -> Text
serviceCode) (\s :: RequestServiceQuotaIncrease
s@RequestServiceQuotaIncrease' {} Text
a -> RequestServiceQuotaIncrease
s {$sel:serviceCode:RequestServiceQuotaIncrease' :: Text
serviceCode = Text
a} :: RequestServiceQuotaIncrease)

-- | The quota identifier.
requestServiceQuotaIncrease_quotaCode :: Lens.Lens' RequestServiceQuotaIncrease Prelude.Text
requestServiceQuotaIncrease_quotaCode :: Lens' RequestServiceQuotaIncrease Text
requestServiceQuotaIncrease_quotaCode = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RequestServiceQuotaIncrease' {Text
quotaCode :: Text
$sel:quotaCode:RequestServiceQuotaIncrease' :: RequestServiceQuotaIncrease -> Text
quotaCode} -> Text
quotaCode) (\s :: RequestServiceQuotaIncrease
s@RequestServiceQuotaIncrease' {} Text
a -> RequestServiceQuotaIncrease
s {$sel:quotaCode:RequestServiceQuotaIncrease' :: Text
quotaCode = Text
a} :: RequestServiceQuotaIncrease)

-- | The new, increased value for the quota.
requestServiceQuotaIncrease_desiredValue :: Lens.Lens' RequestServiceQuotaIncrease Prelude.Double
requestServiceQuotaIncrease_desiredValue :: Lens' RequestServiceQuotaIncrease Double
requestServiceQuotaIncrease_desiredValue = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RequestServiceQuotaIncrease' {Double
desiredValue :: Double
$sel:desiredValue:RequestServiceQuotaIncrease' :: RequestServiceQuotaIncrease -> Double
desiredValue} -> Double
desiredValue) (\s :: RequestServiceQuotaIncrease
s@RequestServiceQuotaIncrease' {} Double
a -> RequestServiceQuotaIncrease
s {$sel:desiredValue:RequestServiceQuotaIncrease' :: Double
desiredValue = Double
a} :: RequestServiceQuotaIncrease)

instance Core.AWSRequest RequestServiceQuotaIncrease where
  type
    AWSResponse RequestServiceQuotaIncrease =
      RequestServiceQuotaIncreaseResponse
  request :: (Service -> Service)
-> RequestServiceQuotaIncrease
-> Request RequestServiceQuotaIncrease
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 RequestServiceQuotaIncrease
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse RequestServiceQuotaIncrease)))
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 RequestedServiceQuotaChange
-> Int -> RequestServiceQuotaIncreaseResponse
RequestServiceQuotaIncreaseResponse'
            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
"RequestedQuota")
            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 RequestServiceQuotaIncrease where
  hashWithSalt :: Int -> RequestServiceQuotaIncrease -> Int
hashWithSalt Int
_salt RequestServiceQuotaIncrease' {Double
Text
desiredValue :: Double
quotaCode :: Text
serviceCode :: Text
$sel:desiredValue:RequestServiceQuotaIncrease' :: RequestServiceQuotaIncrease -> Double
$sel:quotaCode:RequestServiceQuotaIncrease' :: RequestServiceQuotaIncrease -> Text
$sel:serviceCode:RequestServiceQuotaIncrease' :: RequestServiceQuotaIncrease -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
serviceCode
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
quotaCode
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Double
desiredValue

instance Prelude.NFData RequestServiceQuotaIncrease where
  rnf :: RequestServiceQuotaIncrease -> ()
rnf RequestServiceQuotaIncrease' {Double
Text
desiredValue :: Double
quotaCode :: Text
serviceCode :: Text
$sel:desiredValue:RequestServiceQuotaIncrease' :: RequestServiceQuotaIncrease -> Double
$sel:quotaCode:RequestServiceQuotaIncrease' :: RequestServiceQuotaIncrease -> Text
$sel:serviceCode:RequestServiceQuotaIncrease' :: RequestServiceQuotaIncrease -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
serviceCode
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
quotaCode
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Double
desiredValue

instance Data.ToHeaders RequestServiceQuotaIncrease where
  toHeaders :: RequestServiceQuotaIncrease -> 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
"ServiceQuotasV20190624.RequestServiceQuotaIncrease" ::
                          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 RequestServiceQuotaIncrease where
  toJSON :: RequestServiceQuotaIncrease -> Value
toJSON RequestServiceQuotaIncrease' {Double
Text
desiredValue :: Double
quotaCode :: Text
serviceCode :: Text
$sel:desiredValue:RequestServiceQuotaIncrease' :: RequestServiceQuotaIncrease -> Double
$sel:quotaCode:RequestServiceQuotaIncrease' :: RequestServiceQuotaIncrease -> Text
$sel:serviceCode:RequestServiceQuotaIncrease' :: RequestServiceQuotaIncrease -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just (Key
"ServiceCode" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
serviceCode),
            forall a. a -> Maybe a
Prelude.Just (Key
"QuotaCode" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
quotaCode),
            forall a. a -> Maybe a
Prelude.Just (Key
"DesiredValue" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Double
desiredValue)
          ]
      )

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

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

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

-- |
-- Create a value of 'RequestServiceQuotaIncreaseResponse' 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:
--
-- 'requestedQuota', 'requestServiceQuotaIncreaseResponse_requestedQuota' - Information about the quota increase request.
--
-- 'httpStatus', 'requestServiceQuotaIncreaseResponse_httpStatus' - The response's http status code.
newRequestServiceQuotaIncreaseResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  RequestServiceQuotaIncreaseResponse
newRequestServiceQuotaIncreaseResponse :: Int -> RequestServiceQuotaIncreaseResponse
newRequestServiceQuotaIncreaseResponse Int
pHttpStatus_ =
  RequestServiceQuotaIncreaseResponse'
    { $sel:requestedQuota:RequestServiceQuotaIncreaseResponse' :: Maybe RequestedServiceQuotaChange
requestedQuota =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:RequestServiceQuotaIncreaseResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Information about the quota increase request.
requestServiceQuotaIncreaseResponse_requestedQuota :: Lens.Lens' RequestServiceQuotaIncreaseResponse (Prelude.Maybe RequestedServiceQuotaChange)
requestServiceQuotaIncreaseResponse_requestedQuota :: Lens'
  RequestServiceQuotaIncreaseResponse
  (Maybe RequestedServiceQuotaChange)
requestServiceQuotaIncreaseResponse_requestedQuota = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RequestServiceQuotaIncreaseResponse' {Maybe RequestedServiceQuotaChange
requestedQuota :: Maybe RequestedServiceQuotaChange
$sel:requestedQuota:RequestServiceQuotaIncreaseResponse' :: RequestServiceQuotaIncreaseResponse
-> Maybe RequestedServiceQuotaChange
requestedQuota} -> Maybe RequestedServiceQuotaChange
requestedQuota) (\s :: RequestServiceQuotaIncreaseResponse
s@RequestServiceQuotaIncreaseResponse' {} Maybe RequestedServiceQuotaChange
a -> RequestServiceQuotaIncreaseResponse
s {$sel:requestedQuota:RequestServiceQuotaIncreaseResponse' :: Maybe RequestedServiceQuotaChange
requestedQuota = Maybe RequestedServiceQuotaChange
a} :: RequestServiceQuotaIncreaseResponse)

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

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