{-# 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.Shield.UpdateSubscription
(
UpdateSubscription (..),
newUpdateSubscription,
updateSubscription_autoRenew,
UpdateSubscriptionResponse (..),
newUpdateSubscriptionResponse,
updateSubscriptionResponse_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.Shield.Types
data UpdateSubscription = UpdateSubscription'
{
UpdateSubscription -> Maybe AutoRenew
autoRenew :: Prelude.Maybe AutoRenew
}
deriving (UpdateSubscription -> UpdateSubscription -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateSubscription -> UpdateSubscription -> Bool
$c/= :: UpdateSubscription -> UpdateSubscription -> Bool
== :: UpdateSubscription -> UpdateSubscription -> Bool
$c== :: UpdateSubscription -> UpdateSubscription -> Bool
Prelude.Eq, ReadPrec [UpdateSubscription]
ReadPrec UpdateSubscription
Int -> ReadS UpdateSubscription
ReadS [UpdateSubscription]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateSubscription]
$creadListPrec :: ReadPrec [UpdateSubscription]
readPrec :: ReadPrec UpdateSubscription
$creadPrec :: ReadPrec UpdateSubscription
readList :: ReadS [UpdateSubscription]
$creadList :: ReadS [UpdateSubscription]
readsPrec :: Int -> ReadS UpdateSubscription
$creadsPrec :: Int -> ReadS UpdateSubscription
Prelude.Read, Int -> UpdateSubscription -> ShowS
[UpdateSubscription] -> ShowS
UpdateSubscription -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateSubscription] -> ShowS
$cshowList :: [UpdateSubscription] -> ShowS
show :: UpdateSubscription -> String
$cshow :: UpdateSubscription -> String
showsPrec :: Int -> UpdateSubscription -> ShowS
$cshowsPrec :: Int -> UpdateSubscription -> ShowS
Prelude.Show, forall x. Rep UpdateSubscription x -> UpdateSubscription
forall x. UpdateSubscription -> Rep UpdateSubscription x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateSubscription x -> UpdateSubscription
$cfrom :: forall x. UpdateSubscription -> Rep UpdateSubscription x
Prelude.Generic)
newUpdateSubscription ::
UpdateSubscription
newUpdateSubscription :: UpdateSubscription
newUpdateSubscription =
UpdateSubscription' {$sel:autoRenew:UpdateSubscription' :: Maybe AutoRenew
autoRenew = forall a. Maybe a
Prelude.Nothing}
updateSubscription_autoRenew :: Lens.Lens' UpdateSubscription (Prelude.Maybe AutoRenew)
updateSubscription_autoRenew :: Lens' UpdateSubscription (Maybe AutoRenew)
updateSubscription_autoRenew = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateSubscription' {Maybe AutoRenew
autoRenew :: Maybe AutoRenew
$sel:autoRenew:UpdateSubscription' :: UpdateSubscription -> Maybe AutoRenew
autoRenew} -> Maybe AutoRenew
autoRenew) (\s :: UpdateSubscription
s@UpdateSubscription' {} Maybe AutoRenew
a -> UpdateSubscription
s {$sel:autoRenew:UpdateSubscription' :: Maybe AutoRenew
autoRenew = Maybe AutoRenew
a} :: UpdateSubscription)
instance Core.AWSRequest UpdateSubscription where
type
AWSResponse UpdateSubscription =
UpdateSubscriptionResponse
request :: (Service -> Service)
-> UpdateSubscription -> Request UpdateSubscription
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 UpdateSubscription
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateSubscription)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
( \Int
s ResponseHeaders
h ()
x ->
Int -> UpdateSubscriptionResponse
UpdateSubscriptionResponse'
forall (f :: * -> *) a b. Functor 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 UpdateSubscription where
hashWithSalt :: Int -> UpdateSubscription -> Int
hashWithSalt Int
_salt UpdateSubscription' {Maybe AutoRenew
autoRenew :: Maybe AutoRenew
$sel:autoRenew:UpdateSubscription' :: UpdateSubscription -> Maybe AutoRenew
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe AutoRenew
autoRenew
instance Prelude.NFData UpdateSubscription where
rnf :: UpdateSubscription -> ()
rnf UpdateSubscription' {Maybe AutoRenew
autoRenew :: Maybe AutoRenew
$sel:autoRenew:UpdateSubscription' :: UpdateSubscription -> Maybe AutoRenew
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe AutoRenew
autoRenew
instance Data.ToHeaders UpdateSubscription where
toHeaders :: UpdateSubscription -> 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
"AWSShield_20160616.UpdateSubscription" ::
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 UpdateSubscription where
toJSON :: UpdateSubscription -> Value
toJSON UpdateSubscription' {Maybe AutoRenew
autoRenew :: Maybe AutoRenew
$sel:autoRenew:UpdateSubscription' :: UpdateSubscription -> Maybe AutoRenew
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[(Key
"AutoRenew" 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 AutoRenew
autoRenew]
)
instance Data.ToPath UpdateSubscription where
toPath :: UpdateSubscription -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery UpdateSubscription where
toQuery :: UpdateSubscription -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data UpdateSubscriptionResponse = UpdateSubscriptionResponse'
{
UpdateSubscriptionResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateSubscriptionResponse -> UpdateSubscriptionResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateSubscriptionResponse -> UpdateSubscriptionResponse -> Bool
$c/= :: UpdateSubscriptionResponse -> UpdateSubscriptionResponse -> Bool
== :: UpdateSubscriptionResponse -> UpdateSubscriptionResponse -> Bool
$c== :: UpdateSubscriptionResponse -> UpdateSubscriptionResponse -> Bool
Prelude.Eq, ReadPrec [UpdateSubscriptionResponse]
ReadPrec UpdateSubscriptionResponse
Int -> ReadS UpdateSubscriptionResponse
ReadS [UpdateSubscriptionResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateSubscriptionResponse]
$creadListPrec :: ReadPrec [UpdateSubscriptionResponse]
readPrec :: ReadPrec UpdateSubscriptionResponse
$creadPrec :: ReadPrec UpdateSubscriptionResponse
readList :: ReadS [UpdateSubscriptionResponse]
$creadList :: ReadS [UpdateSubscriptionResponse]
readsPrec :: Int -> ReadS UpdateSubscriptionResponse
$creadsPrec :: Int -> ReadS UpdateSubscriptionResponse
Prelude.Read, Int -> UpdateSubscriptionResponse -> ShowS
[UpdateSubscriptionResponse] -> ShowS
UpdateSubscriptionResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateSubscriptionResponse] -> ShowS
$cshowList :: [UpdateSubscriptionResponse] -> ShowS
show :: UpdateSubscriptionResponse -> String
$cshow :: UpdateSubscriptionResponse -> String
showsPrec :: Int -> UpdateSubscriptionResponse -> ShowS
$cshowsPrec :: Int -> UpdateSubscriptionResponse -> ShowS
Prelude.Show, forall x.
Rep UpdateSubscriptionResponse x -> UpdateSubscriptionResponse
forall x.
UpdateSubscriptionResponse -> Rep UpdateSubscriptionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateSubscriptionResponse x -> UpdateSubscriptionResponse
$cfrom :: forall x.
UpdateSubscriptionResponse -> Rep UpdateSubscriptionResponse x
Prelude.Generic)
newUpdateSubscriptionResponse ::
Prelude.Int ->
UpdateSubscriptionResponse
newUpdateSubscriptionResponse :: Int -> UpdateSubscriptionResponse
newUpdateSubscriptionResponse Int
pHttpStatus_ =
UpdateSubscriptionResponse'
{ $sel:httpStatus:UpdateSubscriptionResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
updateSubscriptionResponse_httpStatus :: Lens.Lens' UpdateSubscriptionResponse Prelude.Int
updateSubscriptionResponse_httpStatus :: Lens' UpdateSubscriptionResponse Int
updateSubscriptionResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateSubscriptionResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateSubscriptionResponse' :: UpdateSubscriptionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateSubscriptionResponse
s@UpdateSubscriptionResponse' {} Int
a -> UpdateSubscriptionResponse
s {$sel:httpStatus:UpdateSubscriptionResponse' :: Int
httpStatus = Int
a} :: UpdateSubscriptionResponse)
instance Prelude.NFData UpdateSubscriptionResponse where
rnf :: UpdateSubscriptionResponse -> ()
rnf UpdateSubscriptionResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateSubscriptionResponse' :: UpdateSubscriptionResponse -> Int
..} =
forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus