{-# 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 #-}
module Amazonka.APIGateway.UpdateUsagePlan
(
UpdateUsagePlan (..),
newUpdateUsagePlan,
updateUsagePlan_patchOperations,
updateUsagePlan_usagePlanId,
UsagePlan (..),
newUsagePlan,
usagePlan_apiStages,
usagePlan_description,
usagePlan_id,
usagePlan_name,
usagePlan_productCode,
usagePlan_quota,
usagePlan_tags,
usagePlan_throttle,
)
where
import Amazonka.APIGateway.Types
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
data UpdateUsagePlan = UpdateUsagePlan'
{
UpdateUsagePlan -> Maybe [PatchOperation]
patchOperations :: Prelude.Maybe [PatchOperation],
UpdateUsagePlan -> Text
usagePlanId :: Prelude.Text
}
deriving (UpdateUsagePlan -> UpdateUsagePlan -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateUsagePlan -> UpdateUsagePlan -> Bool
$c/= :: UpdateUsagePlan -> UpdateUsagePlan -> Bool
== :: UpdateUsagePlan -> UpdateUsagePlan -> Bool
$c== :: UpdateUsagePlan -> UpdateUsagePlan -> Bool
Prelude.Eq, ReadPrec [UpdateUsagePlan]
ReadPrec UpdateUsagePlan
Int -> ReadS UpdateUsagePlan
ReadS [UpdateUsagePlan]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateUsagePlan]
$creadListPrec :: ReadPrec [UpdateUsagePlan]
readPrec :: ReadPrec UpdateUsagePlan
$creadPrec :: ReadPrec UpdateUsagePlan
readList :: ReadS [UpdateUsagePlan]
$creadList :: ReadS [UpdateUsagePlan]
readsPrec :: Int -> ReadS UpdateUsagePlan
$creadsPrec :: Int -> ReadS UpdateUsagePlan
Prelude.Read, Int -> UpdateUsagePlan -> ShowS
[UpdateUsagePlan] -> ShowS
UpdateUsagePlan -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateUsagePlan] -> ShowS
$cshowList :: [UpdateUsagePlan] -> ShowS
show :: UpdateUsagePlan -> String
$cshow :: UpdateUsagePlan -> String
showsPrec :: Int -> UpdateUsagePlan -> ShowS
$cshowsPrec :: Int -> UpdateUsagePlan -> ShowS
Prelude.Show, forall x. Rep UpdateUsagePlan x -> UpdateUsagePlan
forall x. UpdateUsagePlan -> Rep UpdateUsagePlan x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateUsagePlan x -> UpdateUsagePlan
$cfrom :: forall x. UpdateUsagePlan -> Rep UpdateUsagePlan x
Prelude.Generic)
newUpdateUsagePlan ::
Prelude.Text ->
UpdateUsagePlan
newUpdateUsagePlan :: Text -> UpdateUsagePlan
newUpdateUsagePlan Text
pUsagePlanId_ =
UpdateUsagePlan'
{ $sel:patchOperations:UpdateUsagePlan' :: Maybe [PatchOperation]
patchOperations = forall a. Maybe a
Prelude.Nothing,
$sel:usagePlanId:UpdateUsagePlan' :: Text
usagePlanId = Text
pUsagePlanId_
}
updateUsagePlan_patchOperations :: Lens.Lens' UpdateUsagePlan (Prelude.Maybe [PatchOperation])
updateUsagePlan_patchOperations :: Lens' UpdateUsagePlan (Maybe [PatchOperation])
updateUsagePlan_patchOperations = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateUsagePlan' {Maybe [PatchOperation]
patchOperations :: Maybe [PatchOperation]
$sel:patchOperations:UpdateUsagePlan' :: UpdateUsagePlan -> Maybe [PatchOperation]
patchOperations} -> Maybe [PatchOperation]
patchOperations) (\s :: UpdateUsagePlan
s@UpdateUsagePlan' {} Maybe [PatchOperation]
a -> UpdateUsagePlan
s {$sel:patchOperations:UpdateUsagePlan' :: Maybe [PatchOperation]
patchOperations = Maybe [PatchOperation]
a} :: UpdateUsagePlan) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
updateUsagePlan_usagePlanId :: Lens.Lens' UpdateUsagePlan Prelude.Text
updateUsagePlan_usagePlanId :: Lens' UpdateUsagePlan Text
updateUsagePlan_usagePlanId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateUsagePlan' {Text
usagePlanId :: Text
$sel:usagePlanId:UpdateUsagePlan' :: UpdateUsagePlan -> Text
usagePlanId} -> Text
usagePlanId) (\s :: UpdateUsagePlan
s@UpdateUsagePlan' {} Text
a -> UpdateUsagePlan
s {$sel:usagePlanId:UpdateUsagePlan' :: Text
usagePlanId = Text
a} :: UpdateUsagePlan)
instance Core.AWSRequest UpdateUsagePlan where
type AWSResponse UpdateUsagePlan = UsagePlan
request :: (Service -> Service) -> UpdateUsagePlan -> Request UpdateUsagePlan
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.patchJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy UpdateUsagePlan
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateUsagePlan)))
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 -> forall a. FromJSON a => Object -> Either String a
Data.eitherParseJSON Object
x)
instance Prelude.Hashable UpdateUsagePlan where
hashWithSalt :: Int -> UpdateUsagePlan -> Int
hashWithSalt Int
_salt UpdateUsagePlan' {Maybe [PatchOperation]
Text
usagePlanId :: Text
patchOperations :: Maybe [PatchOperation]
$sel:usagePlanId:UpdateUsagePlan' :: UpdateUsagePlan -> Text
$sel:patchOperations:UpdateUsagePlan' :: UpdateUsagePlan -> Maybe [PatchOperation]
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [PatchOperation]
patchOperations
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
usagePlanId
instance Prelude.NFData UpdateUsagePlan where
rnf :: UpdateUsagePlan -> ()
rnf UpdateUsagePlan' {Maybe [PatchOperation]
Text
usagePlanId :: Text
patchOperations :: Maybe [PatchOperation]
$sel:usagePlanId:UpdateUsagePlan' :: UpdateUsagePlan -> Text
$sel:patchOperations:UpdateUsagePlan' :: UpdateUsagePlan -> Maybe [PatchOperation]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [PatchOperation]
patchOperations
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
usagePlanId
instance Data.ToHeaders UpdateUsagePlan where
toHeaders :: UpdateUsagePlan -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Accept"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# (ByteString
"application/json" :: Prelude.ByteString)
]
)
instance Data.ToJSON UpdateUsagePlan where
toJSON :: UpdateUsagePlan -> Value
toJSON UpdateUsagePlan' {Maybe [PatchOperation]
Text
usagePlanId :: Text
patchOperations :: Maybe [PatchOperation]
$sel:usagePlanId:UpdateUsagePlan' :: UpdateUsagePlan -> Text
$sel:patchOperations:UpdateUsagePlan' :: UpdateUsagePlan -> Maybe [PatchOperation]
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"patchOperations" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [PatchOperation]
patchOperations
]
)
instance Data.ToPath UpdateUsagePlan where
toPath :: UpdateUsagePlan -> ByteString
toPath UpdateUsagePlan' {Maybe [PatchOperation]
Text
usagePlanId :: Text
patchOperations :: Maybe [PatchOperation]
$sel:usagePlanId:UpdateUsagePlan' :: UpdateUsagePlan -> Text
$sel:patchOperations:UpdateUsagePlan' :: UpdateUsagePlan -> Maybe [PatchOperation]
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/usageplans/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
usagePlanId]
instance Data.ToQuery UpdateUsagePlan where
toQuery :: UpdateUsagePlan -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty