{-# 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.GetSubscriptionState
(
GetSubscriptionState (..),
newGetSubscriptionState,
GetSubscriptionStateResponse (..),
newGetSubscriptionStateResponse,
getSubscriptionStateResponse_httpStatus,
getSubscriptionStateResponse_subscriptionState,
)
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.Shield.Types
data GetSubscriptionState = GetSubscriptionState'
{
}
deriving (GetSubscriptionState -> GetSubscriptionState -> Bool
(GetSubscriptionState -> GetSubscriptionState -> Bool)
-> (GetSubscriptionState -> GetSubscriptionState -> Bool)
-> Eq GetSubscriptionState
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetSubscriptionState -> GetSubscriptionState -> Bool
$c/= :: GetSubscriptionState -> GetSubscriptionState -> Bool
== :: GetSubscriptionState -> GetSubscriptionState -> Bool
$c== :: GetSubscriptionState -> GetSubscriptionState -> Bool
Prelude.Eq, ReadPrec [GetSubscriptionState]
ReadPrec GetSubscriptionState
Int -> ReadS GetSubscriptionState
ReadS [GetSubscriptionState]
(Int -> ReadS GetSubscriptionState)
-> ReadS [GetSubscriptionState]
-> ReadPrec GetSubscriptionState
-> ReadPrec [GetSubscriptionState]
-> Read GetSubscriptionState
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetSubscriptionState]
$creadListPrec :: ReadPrec [GetSubscriptionState]
readPrec :: ReadPrec GetSubscriptionState
$creadPrec :: ReadPrec GetSubscriptionState
readList :: ReadS [GetSubscriptionState]
$creadList :: ReadS [GetSubscriptionState]
readsPrec :: Int -> ReadS GetSubscriptionState
$creadsPrec :: Int -> ReadS GetSubscriptionState
Prelude.Read, Int -> GetSubscriptionState -> ShowS
[GetSubscriptionState] -> ShowS
GetSubscriptionState -> String
(Int -> GetSubscriptionState -> ShowS)
-> (GetSubscriptionState -> String)
-> ([GetSubscriptionState] -> ShowS)
-> Show GetSubscriptionState
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetSubscriptionState] -> ShowS
$cshowList :: [GetSubscriptionState] -> ShowS
show :: GetSubscriptionState -> String
$cshow :: GetSubscriptionState -> String
showsPrec :: Int -> GetSubscriptionState -> ShowS
$cshowsPrec :: Int -> GetSubscriptionState -> ShowS
Prelude.Show, (forall x. GetSubscriptionState -> Rep GetSubscriptionState x)
-> (forall x. Rep GetSubscriptionState x -> GetSubscriptionState)
-> Generic GetSubscriptionState
forall x. Rep GetSubscriptionState x -> GetSubscriptionState
forall x. GetSubscriptionState -> Rep GetSubscriptionState x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetSubscriptionState x -> GetSubscriptionState
$cfrom :: forall x. GetSubscriptionState -> Rep GetSubscriptionState x
Prelude.Generic)
newGetSubscriptionState ::
GetSubscriptionState
newGetSubscriptionState :: GetSubscriptionState
newGetSubscriptionState = GetSubscriptionState
GetSubscriptionState'
instance Core.AWSRequest GetSubscriptionState where
type
AWSResponse GetSubscriptionState =
GetSubscriptionStateResponse
request :: GetSubscriptionState -> Request GetSubscriptionState
request = Service -> GetSubscriptionState -> Request GetSubscriptionState
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetSubscriptionState
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetSubscriptionState)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetSubscriptionState))
-> Logger
-> Service
-> Proxy GetSubscriptionState
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetSubscriptionState)))
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 ->
Int -> SubscriptionState -> GetSubscriptionStateResponse
GetSubscriptionStateResponse'
(Int -> SubscriptionState -> GetSubscriptionStateResponse)
-> Either String Int
-> Either
String (SubscriptionState -> GetSubscriptionStateResponse)
forall (f :: * -> *) a b. Functor 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))
Either String (SubscriptionState -> GetSubscriptionStateResponse)
-> Either String SubscriptionState
-> Either String GetSubscriptionStateResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Key -> Either String SubscriptionState
forall a. FromJSON a => Object -> Key -> Either String a
Core..:> Key
"SubscriptionState")
)
instance Prelude.Hashable GetSubscriptionState
instance Prelude.NFData GetSubscriptionState
instance Core.ToHeaders GetSubscriptionState where
toHeaders :: GetSubscriptionState -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetSubscriptionState -> 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
"AWSShield_20160616.GetSubscriptionState" ::
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 GetSubscriptionState where
toJSON :: GetSubscriptionState -> Value
toJSON = Value -> GetSubscriptionState -> Value
forall a b. a -> b -> a
Prelude.const (Object -> Value
Core.Object Object
forall a. Monoid a => a
Prelude.mempty)
instance Core.ToPath GetSubscriptionState where
toPath :: GetSubscriptionState -> ByteString
toPath = ByteString -> GetSubscriptionState -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetSubscriptionState where
toQuery :: GetSubscriptionState -> QueryString
toQuery = QueryString -> GetSubscriptionState -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetSubscriptionStateResponse = GetSubscriptionStateResponse'
{
GetSubscriptionStateResponse -> Int
httpStatus :: Prelude.Int,
GetSubscriptionStateResponse -> SubscriptionState
subscriptionState :: SubscriptionState
}
deriving (GetSubscriptionStateResponse
-> GetSubscriptionStateResponse -> Bool
(GetSubscriptionStateResponse
-> GetSubscriptionStateResponse -> Bool)
-> (GetSubscriptionStateResponse
-> GetSubscriptionStateResponse -> Bool)
-> Eq GetSubscriptionStateResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetSubscriptionStateResponse
-> GetSubscriptionStateResponse -> Bool
$c/= :: GetSubscriptionStateResponse
-> GetSubscriptionStateResponse -> Bool
== :: GetSubscriptionStateResponse
-> GetSubscriptionStateResponse -> Bool
$c== :: GetSubscriptionStateResponse
-> GetSubscriptionStateResponse -> Bool
Prelude.Eq, ReadPrec [GetSubscriptionStateResponse]
ReadPrec GetSubscriptionStateResponse
Int -> ReadS GetSubscriptionStateResponse
ReadS [GetSubscriptionStateResponse]
(Int -> ReadS GetSubscriptionStateResponse)
-> ReadS [GetSubscriptionStateResponse]
-> ReadPrec GetSubscriptionStateResponse
-> ReadPrec [GetSubscriptionStateResponse]
-> Read GetSubscriptionStateResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetSubscriptionStateResponse]
$creadListPrec :: ReadPrec [GetSubscriptionStateResponse]
readPrec :: ReadPrec GetSubscriptionStateResponse
$creadPrec :: ReadPrec GetSubscriptionStateResponse
readList :: ReadS [GetSubscriptionStateResponse]
$creadList :: ReadS [GetSubscriptionStateResponse]
readsPrec :: Int -> ReadS GetSubscriptionStateResponse
$creadsPrec :: Int -> ReadS GetSubscriptionStateResponse
Prelude.Read, Int -> GetSubscriptionStateResponse -> ShowS
[GetSubscriptionStateResponse] -> ShowS
GetSubscriptionStateResponse -> String
(Int -> GetSubscriptionStateResponse -> ShowS)
-> (GetSubscriptionStateResponse -> String)
-> ([GetSubscriptionStateResponse] -> ShowS)
-> Show GetSubscriptionStateResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetSubscriptionStateResponse] -> ShowS
$cshowList :: [GetSubscriptionStateResponse] -> ShowS
show :: GetSubscriptionStateResponse -> String
$cshow :: GetSubscriptionStateResponse -> String
showsPrec :: Int -> GetSubscriptionStateResponse -> ShowS
$cshowsPrec :: Int -> GetSubscriptionStateResponse -> ShowS
Prelude.Show, (forall x.
GetSubscriptionStateResponse -> Rep GetSubscriptionStateResponse x)
-> (forall x.
Rep GetSubscriptionStateResponse x -> GetSubscriptionStateResponse)
-> Generic GetSubscriptionStateResponse
forall x.
Rep GetSubscriptionStateResponse x -> GetSubscriptionStateResponse
forall x.
GetSubscriptionStateResponse -> Rep GetSubscriptionStateResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetSubscriptionStateResponse x -> GetSubscriptionStateResponse
$cfrom :: forall x.
GetSubscriptionStateResponse -> Rep GetSubscriptionStateResponse x
Prelude.Generic)
newGetSubscriptionStateResponse ::
Prelude.Int ->
SubscriptionState ->
GetSubscriptionStateResponse
newGetSubscriptionStateResponse :: Int -> SubscriptionState -> GetSubscriptionStateResponse
newGetSubscriptionStateResponse
Int
pHttpStatus_
SubscriptionState
pSubscriptionState_ =
GetSubscriptionStateResponse' :: Int -> SubscriptionState -> GetSubscriptionStateResponse
GetSubscriptionStateResponse'
{ $sel:httpStatus:GetSubscriptionStateResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:subscriptionState:GetSubscriptionStateResponse' :: SubscriptionState
subscriptionState = SubscriptionState
pSubscriptionState_
}
getSubscriptionStateResponse_httpStatus :: Lens.Lens' GetSubscriptionStateResponse Prelude.Int
getSubscriptionStateResponse_httpStatus :: (Int -> f Int)
-> GetSubscriptionStateResponse -> f GetSubscriptionStateResponse
getSubscriptionStateResponse_httpStatus = (GetSubscriptionStateResponse -> Int)
-> (GetSubscriptionStateResponse
-> Int -> GetSubscriptionStateResponse)
-> Lens
GetSubscriptionStateResponse GetSubscriptionStateResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSubscriptionStateResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetSubscriptionStateResponse' :: GetSubscriptionStateResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetSubscriptionStateResponse
s@GetSubscriptionStateResponse' {} Int
a -> GetSubscriptionStateResponse
s {$sel:httpStatus:GetSubscriptionStateResponse' :: Int
httpStatus = Int
a} :: GetSubscriptionStateResponse)
getSubscriptionStateResponse_subscriptionState :: Lens.Lens' GetSubscriptionStateResponse SubscriptionState
getSubscriptionStateResponse_subscriptionState :: (SubscriptionState -> f SubscriptionState)
-> GetSubscriptionStateResponse -> f GetSubscriptionStateResponse
getSubscriptionStateResponse_subscriptionState = (GetSubscriptionStateResponse -> SubscriptionState)
-> (GetSubscriptionStateResponse
-> SubscriptionState -> GetSubscriptionStateResponse)
-> Lens
GetSubscriptionStateResponse
GetSubscriptionStateResponse
SubscriptionState
SubscriptionState
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSubscriptionStateResponse' {SubscriptionState
subscriptionState :: SubscriptionState
$sel:subscriptionState:GetSubscriptionStateResponse' :: GetSubscriptionStateResponse -> SubscriptionState
subscriptionState} -> SubscriptionState
subscriptionState) (\s :: GetSubscriptionStateResponse
s@GetSubscriptionStateResponse' {} SubscriptionState
a -> GetSubscriptionStateResponse
s {$sel:subscriptionState:GetSubscriptionStateResponse' :: SubscriptionState
subscriptionState = SubscriptionState
a} :: GetSubscriptionStateResponse)
instance Prelude.NFData GetSubscriptionStateResponse