{-# 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.Support.ResolveCase
(
ResolveCase (..),
newResolveCase,
resolveCase_caseId,
ResolveCaseResponse (..),
newResolveCaseResponse,
resolveCaseResponse_initialCaseStatus,
resolveCaseResponse_finalCaseStatus,
resolveCaseResponse_httpStatus,
)
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.Support.Types
data ResolveCase = ResolveCase'
{
ResolveCase -> Maybe Text
caseId :: Prelude.Maybe Prelude.Text
}
deriving (ResolveCase -> ResolveCase -> Bool
(ResolveCase -> ResolveCase -> Bool)
-> (ResolveCase -> ResolveCase -> Bool) -> Eq ResolveCase
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ResolveCase -> ResolveCase -> Bool
$c/= :: ResolveCase -> ResolveCase -> Bool
== :: ResolveCase -> ResolveCase -> Bool
$c== :: ResolveCase -> ResolveCase -> Bool
Prelude.Eq, ReadPrec [ResolveCase]
ReadPrec ResolveCase
Int -> ReadS ResolveCase
ReadS [ResolveCase]
(Int -> ReadS ResolveCase)
-> ReadS [ResolveCase]
-> ReadPrec ResolveCase
-> ReadPrec [ResolveCase]
-> Read ResolveCase
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ResolveCase]
$creadListPrec :: ReadPrec [ResolveCase]
readPrec :: ReadPrec ResolveCase
$creadPrec :: ReadPrec ResolveCase
readList :: ReadS [ResolveCase]
$creadList :: ReadS [ResolveCase]
readsPrec :: Int -> ReadS ResolveCase
$creadsPrec :: Int -> ReadS ResolveCase
Prelude.Read, Int -> ResolveCase -> ShowS
[ResolveCase] -> ShowS
ResolveCase -> String
(Int -> ResolveCase -> ShowS)
-> (ResolveCase -> String)
-> ([ResolveCase] -> ShowS)
-> Show ResolveCase
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ResolveCase] -> ShowS
$cshowList :: [ResolveCase] -> ShowS
show :: ResolveCase -> String
$cshow :: ResolveCase -> String
showsPrec :: Int -> ResolveCase -> ShowS
$cshowsPrec :: Int -> ResolveCase -> ShowS
Prelude.Show, (forall x. ResolveCase -> Rep ResolveCase x)
-> (forall x. Rep ResolveCase x -> ResolveCase)
-> Generic ResolveCase
forall x. Rep ResolveCase x -> ResolveCase
forall x. ResolveCase -> Rep ResolveCase x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ResolveCase x -> ResolveCase
$cfrom :: forall x. ResolveCase -> Rep ResolveCase x
Prelude.Generic)
newResolveCase ::
ResolveCase
newResolveCase :: ResolveCase
newResolveCase =
ResolveCase' :: Maybe Text -> ResolveCase
ResolveCase' {$sel:caseId:ResolveCase' :: Maybe Text
caseId = Maybe Text
forall a. Maybe a
Prelude.Nothing}
resolveCase_caseId :: Lens.Lens' ResolveCase (Prelude.Maybe Prelude.Text)
resolveCase_caseId :: (Maybe Text -> f (Maybe Text)) -> ResolveCase -> f ResolveCase
resolveCase_caseId = (ResolveCase -> Maybe Text)
-> (ResolveCase -> Maybe Text -> ResolveCase)
-> Lens ResolveCase ResolveCase (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResolveCase' {Maybe Text
caseId :: Maybe Text
$sel:caseId:ResolveCase' :: ResolveCase -> Maybe Text
caseId} -> Maybe Text
caseId) (\s :: ResolveCase
s@ResolveCase' {} Maybe Text
a -> ResolveCase
s {$sel:caseId:ResolveCase' :: Maybe Text
caseId = Maybe Text
a} :: ResolveCase)
instance Core.AWSRequest ResolveCase where
type AWSResponse ResolveCase = ResolveCaseResponse
request :: ResolveCase -> Request ResolveCase
request = Service -> ResolveCase -> Request ResolveCase
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy ResolveCase
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ResolveCase)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ResolveCase))
-> Logger
-> Service
-> Proxy ResolveCase
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ResolveCase)))
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 Text -> Maybe Text -> Int -> ResolveCaseResponse
ResolveCaseResponse'
(Maybe Text -> Maybe Text -> Int -> ResolveCaseResponse)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Int -> ResolveCaseResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"initialCaseStatus")
Either String (Maybe Text -> Int -> ResolveCaseResponse)
-> Either String (Maybe Text)
-> Either String (Int -> ResolveCaseResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"finalCaseStatus")
Either String (Int -> ResolveCaseResponse)
-> Either String Int -> Either String ResolveCaseResponse
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 ResolveCase
instance Prelude.NFData ResolveCase
instance Core.ToHeaders ResolveCase where
toHeaders :: ResolveCase -> ResponseHeaders
toHeaders =
ResponseHeaders -> ResolveCase -> 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
"AWSSupport_20130415.ResolveCase" ::
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 ResolveCase where
toJSON :: ResolveCase -> Value
toJSON ResolveCase' {Maybe Text
caseId :: Maybe Text
$sel:caseId:ResolveCase' :: ResolveCase -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[(Text
"caseId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
caseId]
)
instance Core.ToPath ResolveCase where
toPath :: ResolveCase -> ByteString
toPath = ByteString -> ResolveCase -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery ResolveCase where
toQuery :: ResolveCase -> QueryString
toQuery = QueryString -> ResolveCase -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data ResolveCaseResponse = ResolveCaseResponse'
{
ResolveCaseResponse -> Maybe Text
initialCaseStatus :: Prelude.Maybe Prelude.Text,
ResolveCaseResponse -> Maybe Text
finalCaseStatus :: Prelude.Maybe Prelude.Text,
ResolveCaseResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ResolveCaseResponse -> ResolveCaseResponse -> Bool
(ResolveCaseResponse -> ResolveCaseResponse -> Bool)
-> (ResolveCaseResponse -> ResolveCaseResponse -> Bool)
-> Eq ResolveCaseResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ResolveCaseResponse -> ResolveCaseResponse -> Bool
$c/= :: ResolveCaseResponse -> ResolveCaseResponse -> Bool
== :: ResolveCaseResponse -> ResolveCaseResponse -> Bool
$c== :: ResolveCaseResponse -> ResolveCaseResponse -> Bool
Prelude.Eq, ReadPrec [ResolveCaseResponse]
ReadPrec ResolveCaseResponse
Int -> ReadS ResolveCaseResponse
ReadS [ResolveCaseResponse]
(Int -> ReadS ResolveCaseResponse)
-> ReadS [ResolveCaseResponse]
-> ReadPrec ResolveCaseResponse
-> ReadPrec [ResolveCaseResponse]
-> Read ResolveCaseResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ResolveCaseResponse]
$creadListPrec :: ReadPrec [ResolveCaseResponse]
readPrec :: ReadPrec ResolveCaseResponse
$creadPrec :: ReadPrec ResolveCaseResponse
readList :: ReadS [ResolveCaseResponse]
$creadList :: ReadS [ResolveCaseResponse]
readsPrec :: Int -> ReadS ResolveCaseResponse
$creadsPrec :: Int -> ReadS ResolveCaseResponse
Prelude.Read, Int -> ResolveCaseResponse -> ShowS
[ResolveCaseResponse] -> ShowS
ResolveCaseResponse -> String
(Int -> ResolveCaseResponse -> ShowS)
-> (ResolveCaseResponse -> String)
-> ([ResolveCaseResponse] -> ShowS)
-> Show ResolveCaseResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ResolveCaseResponse] -> ShowS
$cshowList :: [ResolveCaseResponse] -> ShowS
show :: ResolveCaseResponse -> String
$cshow :: ResolveCaseResponse -> String
showsPrec :: Int -> ResolveCaseResponse -> ShowS
$cshowsPrec :: Int -> ResolveCaseResponse -> ShowS
Prelude.Show, (forall x. ResolveCaseResponse -> Rep ResolveCaseResponse x)
-> (forall x. Rep ResolveCaseResponse x -> ResolveCaseResponse)
-> Generic ResolveCaseResponse
forall x. Rep ResolveCaseResponse x -> ResolveCaseResponse
forall x. ResolveCaseResponse -> Rep ResolveCaseResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ResolveCaseResponse x -> ResolveCaseResponse
$cfrom :: forall x. ResolveCaseResponse -> Rep ResolveCaseResponse x
Prelude.Generic)
newResolveCaseResponse ::
Prelude.Int ->
ResolveCaseResponse
newResolveCaseResponse :: Int -> ResolveCaseResponse
newResolveCaseResponse Int
pHttpStatus_ =
ResolveCaseResponse' :: Maybe Text -> Maybe Text -> Int -> ResolveCaseResponse
ResolveCaseResponse'
{ $sel:initialCaseStatus:ResolveCaseResponse' :: Maybe Text
initialCaseStatus =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:finalCaseStatus:ResolveCaseResponse' :: Maybe Text
finalCaseStatus = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ResolveCaseResponse' :: Int
httpStatus = Int
pHttpStatus_
}
resolveCaseResponse_initialCaseStatus :: Lens.Lens' ResolveCaseResponse (Prelude.Maybe Prelude.Text)
resolveCaseResponse_initialCaseStatus :: (Maybe Text -> f (Maybe Text))
-> ResolveCaseResponse -> f ResolveCaseResponse
resolveCaseResponse_initialCaseStatus = (ResolveCaseResponse -> Maybe Text)
-> (ResolveCaseResponse -> Maybe Text -> ResolveCaseResponse)
-> Lens
ResolveCaseResponse ResolveCaseResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResolveCaseResponse' {Maybe Text
initialCaseStatus :: Maybe Text
$sel:initialCaseStatus:ResolveCaseResponse' :: ResolveCaseResponse -> Maybe Text
initialCaseStatus} -> Maybe Text
initialCaseStatus) (\s :: ResolveCaseResponse
s@ResolveCaseResponse' {} Maybe Text
a -> ResolveCaseResponse
s {$sel:initialCaseStatus:ResolveCaseResponse' :: Maybe Text
initialCaseStatus = Maybe Text
a} :: ResolveCaseResponse)
resolveCaseResponse_finalCaseStatus :: Lens.Lens' ResolveCaseResponse (Prelude.Maybe Prelude.Text)
resolveCaseResponse_finalCaseStatus :: (Maybe Text -> f (Maybe Text))
-> ResolveCaseResponse -> f ResolveCaseResponse
resolveCaseResponse_finalCaseStatus = (ResolveCaseResponse -> Maybe Text)
-> (ResolveCaseResponse -> Maybe Text -> ResolveCaseResponse)
-> Lens
ResolveCaseResponse ResolveCaseResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResolveCaseResponse' {Maybe Text
finalCaseStatus :: Maybe Text
$sel:finalCaseStatus:ResolveCaseResponse' :: ResolveCaseResponse -> Maybe Text
finalCaseStatus} -> Maybe Text
finalCaseStatus) (\s :: ResolveCaseResponse
s@ResolveCaseResponse' {} Maybe Text
a -> ResolveCaseResponse
s {$sel:finalCaseStatus:ResolveCaseResponse' :: Maybe Text
finalCaseStatus = Maybe Text
a} :: ResolveCaseResponse)
resolveCaseResponse_httpStatus :: Lens.Lens' ResolveCaseResponse Prelude.Int
resolveCaseResponse_httpStatus :: (Int -> f Int) -> ResolveCaseResponse -> f ResolveCaseResponse
resolveCaseResponse_httpStatus = (ResolveCaseResponse -> Int)
-> (ResolveCaseResponse -> Int -> ResolveCaseResponse)
-> Lens ResolveCaseResponse ResolveCaseResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResolveCaseResponse' {Int
httpStatus :: Int
$sel:httpStatus:ResolveCaseResponse' :: ResolveCaseResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ResolveCaseResponse
s@ResolveCaseResponse' {} Int
a -> ResolveCaseResponse
s {$sel:httpStatus:ResolveCaseResponse' :: Int
httpStatus = Int
a} :: ResolveCaseResponse)
instance Prelude.NFData ResolveCaseResponse