{-# 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.CloudControl.GetResourceRequestStatus
(
GetResourceRequestStatus (..),
newGetResourceRequestStatus,
getResourceRequestStatus_requestToken,
GetResourceRequestStatusResponse (..),
newGetResourceRequestStatusResponse,
getResourceRequestStatusResponse_progressEvent,
getResourceRequestStatusResponse_httpStatus,
)
where
import Amazonka.CloudControl.Types
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
data GetResourceRequestStatus = GetResourceRequestStatus'
{
GetResourceRequestStatus -> Text
requestToken :: Prelude.Text
}
deriving (GetResourceRequestStatus -> GetResourceRequestStatus -> Bool
(GetResourceRequestStatus -> GetResourceRequestStatus -> Bool)
-> (GetResourceRequestStatus -> GetResourceRequestStatus -> Bool)
-> Eq GetResourceRequestStatus
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetResourceRequestStatus -> GetResourceRequestStatus -> Bool
$c/= :: GetResourceRequestStatus -> GetResourceRequestStatus -> Bool
== :: GetResourceRequestStatus -> GetResourceRequestStatus -> Bool
$c== :: GetResourceRequestStatus -> GetResourceRequestStatus -> Bool
Prelude.Eq, ReadPrec [GetResourceRequestStatus]
ReadPrec GetResourceRequestStatus
Int -> ReadS GetResourceRequestStatus
ReadS [GetResourceRequestStatus]
(Int -> ReadS GetResourceRequestStatus)
-> ReadS [GetResourceRequestStatus]
-> ReadPrec GetResourceRequestStatus
-> ReadPrec [GetResourceRequestStatus]
-> Read GetResourceRequestStatus
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetResourceRequestStatus]
$creadListPrec :: ReadPrec [GetResourceRequestStatus]
readPrec :: ReadPrec GetResourceRequestStatus
$creadPrec :: ReadPrec GetResourceRequestStatus
readList :: ReadS [GetResourceRequestStatus]
$creadList :: ReadS [GetResourceRequestStatus]
readsPrec :: Int -> ReadS GetResourceRequestStatus
$creadsPrec :: Int -> ReadS GetResourceRequestStatus
Prelude.Read, Int -> GetResourceRequestStatus -> ShowS
[GetResourceRequestStatus] -> ShowS
GetResourceRequestStatus -> String
(Int -> GetResourceRequestStatus -> ShowS)
-> (GetResourceRequestStatus -> String)
-> ([GetResourceRequestStatus] -> ShowS)
-> Show GetResourceRequestStatus
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetResourceRequestStatus] -> ShowS
$cshowList :: [GetResourceRequestStatus] -> ShowS
show :: GetResourceRequestStatus -> String
$cshow :: GetResourceRequestStatus -> String
showsPrec :: Int -> GetResourceRequestStatus -> ShowS
$cshowsPrec :: Int -> GetResourceRequestStatus -> ShowS
Prelude.Show, (forall x.
GetResourceRequestStatus -> Rep GetResourceRequestStatus x)
-> (forall x.
Rep GetResourceRequestStatus x -> GetResourceRequestStatus)
-> Generic GetResourceRequestStatus
forall x.
Rep GetResourceRequestStatus x -> GetResourceRequestStatus
forall x.
GetResourceRequestStatus -> Rep GetResourceRequestStatus x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetResourceRequestStatus x -> GetResourceRequestStatus
$cfrom :: forall x.
GetResourceRequestStatus -> Rep GetResourceRequestStatus x
Prelude.Generic)
newGetResourceRequestStatus ::
Prelude.Text ->
GetResourceRequestStatus
newGetResourceRequestStatus :: Text -> GetResourceRequestStatus
newGetResourceRequestStatus Text
pRequestToken_ =
GetResourceRequestStatus' :: Text -> GetResourceRequestStatus
GetResourceRequestStatus'
{ $sel:requestToken:GetResourceRequestStatus' :: Text
requestToken =
Text
pRequestToken_
}
getResourceRequestStatus_requestToken :: Lens.Lens' GetResourceRequestStatus Prelude.Text
getResourceRequestStatus_requestToken :: (Text -> f Text)
-> GetResourceRequestStatus -> f GetResourceRequestStatus
getResourceRequestStatus_requestToken = (GetResourceRequestStatus -> Text)
-> (GetResourceRequestStatus -> Text -> GetResourceRequestStatus)
-> Lens GetResourceRequestStatus GetResourceRequestStatus Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetResourceRequestStatus' {Text
requestToken :: Text
$sel:requestToken:GetResourceRequestStatus' :: GetResourceRequestStatus -> Text
requestToken} -> Text
requestToken) (\s :: GetResourceRequestStatus
s@GetResourceRequestStatus' {} Text
a -> GetResourceRequestStatus
s {$sel:requestToken:GetResourceRequestStatus' :: Text
requestToken = Text
a} :: GetResourceRequestStatus)
instance Core.AWSRequest GetResourceRequestStatus where
type
AWSResponse GetResourceRequestStatus =
GetResourceRequestStatusResponse
request :: GetResourceRequestStatus -> Request GetResourceRequestStatus
request = Service
-> GetResourceRequestStatus -> Request GetResourceRequestStatus
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetResourceRequestStatus
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetResourceRequestStatus)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetResourceRequestStatus))
-> Logger
-> Service
-> Proxy GetResourceRequestStatus
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetResourceRequestStatus)))
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 ->
Maybe ProgressEvent -> Int -> GetResourceRequestStatusResponse
GetResourceRequestStatusResponse'
(Maybe ProgressEvent -> Int -> GetResourceRequestStatusResponse)
-> Either String (Maybe ProgressEvent)
-> Either String (Int -> GetResourceRequestStatusResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe ProgressEvent)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ProgressEvent")
Either String (Int -> GetResourceRequestStatusResponse)
-> Either String Int
-> Either String GetResourceRequestStatusResponse
forall (f :: * -> *) a b. Applicative f => 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))
)
instance Prelude.Hashable GetResourceRequestStatus
instance Prelude.NFData GetResourceRequestStatus
instance Core.ToHeaders GetResourceRequestStatus where
toHeaders :: GetResourceRequestStatus -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetResourceRequestStatus -> 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
"CloudApiService.GetResourceRequestStatus" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.0" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON GetResourceRequestStatus where
toJSON :: GetResourceRequestStatus -> Value
toJSON GetResourceRequestStatus' {Text
requestToken :: Text
$sel:requestToken:GetResourceRequestStatus' :: GetResourceRequestStatus -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"RequestToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
requestToken)]
)
instance Core.ToPath GetResourceRequestStatus where
toPath :: GetResourceRequestStatus -> ByteString
toPath = ByteString -> GetResourceRequestStatus -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetResourceRequestStatus where
toQuery :: GetResourceRequestStatus -> QueryString
toQuery = QueryString -> GetResourceRequestStatus -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetResourceRequestStatusResponse = GetResourceRequestStatusResponse'
{
GetResourceRequestStatusResponse -> Maybe ProgressEvent
progressEvent :: Prelude.Maybe ProgressEvent,
GetResourceRequestStatusResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetResourceRequestStatusResponse
-> GetResourceRequestStatusResponse -> Bool
(GetResourceRequestStatusResponse
-> GetResourceRequestStatusResponse -> Bool)
-> (GetResourceRequestStatusResponse
-> GetResourceRequestStatusResponse -> Bool)
-> Eq GetResourceRequestStatusResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetResourceRequestStatusResponse
-> GetResourceRequestStatusResponse -> Bool
$c/= :: GetResourceRequestStatusResponse
-> GetResourceRequestStatusResponse -> Bool
== :: GetResourceRequestStatusResponse
-> GetResourceRequestStatusResponse -> Bool
$c== :: GetResourceRequestStatusResponse
-> GetResourceRequestStatusResponse -> Bool
Prelude.Eq, Int -> GetResourceRequestStatusResponse -> ShowS
[GetResourceRequestStatusResponse] -> ShowS
GetResourceRequestStatusResponse -> String
(Int -> GetResourceRequestStatusResponse -> ShowS)
-> (GetResourceRequestStatusResponse -> String)
-> ([GetResourceRequestStatusResponse] -> ShowS)
-> Show GetResourceRequestStatusResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetResourceRequestStatusResponse] -> ShowS
$cshowList :: [GetResourceRequestStatusResponse] -> ShowS
show :: GetResourceRequestStatusResponse -> String
$cshow :: GetResourceRequestStatusResponse -> String
showsPrec :: Int -> GetResourceRequestStatusResponse -> ShowS
$cshowsPrec :: Int -> GetResourceRequestStatusResponse -> ShowS
Prelude.Show, (forall x.
GetResourceRequestStatusResponse
-> Rep GetResourceRequestStatusResponse x)
-> (forall x.
Rep GetResourceRequestStatusResponse x
-> GetResourceRequestStatusResponse)
-> Generic GetResourceRequestStatusResponse
forall x.
Rep GetResourceRequestStatusResponse x
-> GetResourceRequestStatusResponse
forall x.
GetResourceRequestStatusResponse
-> Rep GetResourceRequestStatusResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetResourceRequestStatusResponse x
-> GetResourceRequestStatusResponse
$cfrom :: forall x.
GetResourceRequestStatusResponse
-> Rep GetResourceRequestStatusResponse x
Prelude.Generic)
newGetResourceRequestStatusResponse ::
Prelude.Int ->
GetResourceRequestStatusResponse
newGetResourceRequestStatusResponse :: Int -> GetResourceRequestStatusResponse
newGetResourceRequestStatusResponse Int
pHttpStatus_ =
GetResourceRequestStatusResponse' :: Maybe ProgressEvent -> Int -> GetResourceRequestStatusResponse
GetResourceRequestStatusResponse'
{ $sel:progressEvent:GetResourceRequestStatusResponse' :: Maybe ProgressEvent
progressEvent =
Maybe ProgressEvent
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetResourceRequestStatusResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getResourceRequestStatusResponse_progressEvent :: Lens.Lens' GetResourceRequestStatusResponse (Prelude.Maybe ProgressEvent)
getResourceRequestStatusResponse_progressEvent :: (Maybe ProgressEvent -> f (Maybe ProgressEvent))
-> GetResourceRequestStatusResponse
-> f GetResourceRequestStatusResponse
getResourceRequestStatusResponse_progressEvent = (GetResourceRequestStatusResponse -> Maybe ProgressEvent)
-> (GetResourceRequestStatusResponse
-> Maybe ProgressEvent -> GetResourceRequestStatusResponse)
-> Lens
GetResourceRequestStatusResponse
GetResourceRequestStatusResponse
(Maybe ProgressEvent)
(Maybe ProgressEvent)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetResourceRequestStatusResponse' {Maybe ProgressEvent
progressEvent :: Maybe ProgressEvent
$sel:progressEvent:GetResourceRequestStatusResponse' :: GetResourceRequestStatusResponse -> Maybe ProgressEvent
progressEvent} -> Maybe ProgressEvent
progressEvent) (\s :: GetResourceRequestStatusResponse
s@GetResourceRequestStatusResponse' {} Maybe ProgressEvent
a -> GetResourceRequestStatusResponse
s {$sel:progressEvent:GetResourceRequestStatusResponse' :: Maybe ProgressEvent
progressEvent = Maybe ProgressEvent
a} :: GetResourceRequestStatusResponse)
getResourceRequestStatusResponse_httpStatus :: Lens.Lens' GetResourceRequestStatusResponse Prelude.Int
getResourceRequestStatusResponse_httpStatus :: (Int -> f Int)
-> GetResourceRequestStatusResponse
-> f GetResourceRequestStatusResponse
getResourceRequestStatusResponse_httpStatus = (GetResourceRequestStatusResponse -> Int)
-> (GetResourceRequestStatusResponse
-> Int -> GetResourceRequestStatusResponse)
-> Lens
GetResourceRequestStatusResponse
GetResourceRequestStatusResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetResourceRequestStatusResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetResourceRequestStatusResponse' :: GetResourceRequestStatusResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetResourceRequestStatusResponse
s@GetResourceRequestStatusResponse' {} Int
a -> GetResourceRequestStatusResponse
s {$sel:httpStatus:GetResourceRequestStatusResponse' :: Int
httpStatus = Int
a} :: GetResourceRequestStatusResponse)
instance
Prelude.NFData
GetResourceRequestStatusResponse