{-# 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.AppRunner.PauseService
(
PauseService (..),
newPauseService,
pauseService_serviceArn,
PauseServiceResponse (..),
newPauseServiceResponse,
pauseServiceResponse_operationId,
pauseServiceResponse_httpStatus,
pauseServiceResponse_service,
)
where
import Amazonka.AppRunner.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 PauseService = PauseService'
{
PauseService -> Text
serviceArn :: Prelude.Text
}
deriving (PauseService -> PauseService -> Bool
(PauseService -> PauseService -> Bool)
-> (PauseService -> PauseService -> Bool) -> Eq PauseService
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PauseService -> PauseService -> Bool
$c/= :: PauseService -> PauseService -> Bool
== :: PauseService -> PauseService -> Bool
$c== :: PauseService -> PauseService -> Bool
Prelude.Eq, ReadPrec [PauseService]
ReadPrec PauseService
Int -> ReadS PauseService
ReadS [PauseService]
(Int -> ReadS PauseService)
-> ReadS [PauseService]
-> ReadPrec PauseService
-> ReadPrec [PauseService]
-> Read PauseService
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PauseService]
$creadListPrec :: ReadPrec [PauseService]
readPrec :: ReadPrec PauseService
$creadPrec :: ReadPrec PauseService
readList :: ReadS [PauseService]
$creadList :: ReadS [PauseService]
readsPrec :: Int -> ReadS PauseService
$creadsPrec :: Int -> ReadS PauseService
Prelude.Read, Int -> PauseService -> ShowS
[PauseService] -> ShowS
PauseService -> String
(Int -> PauseService -> ShowS)
-> (PauseService -> String)
-> ([PauseService] -> ShowS)
-> Show PauseService
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PauseService] -> ShowS
$cshowList :: [PauseService] -> ShowS
show :: PauseService -> String
$cshow :: PauseService -> String
showsPrec :: Int -> PauseService -> ShowS
$cshowsPrec :: Int -> PauseService -> ShowS
Prelude.Show, (forall x. PauseService -> Rep PauseService x)
-> (forall x. Rep PauseService x -> PauseService)
-> Generic PauseService
forall x. Rep PauseService x -> PauseService
forall x. PauseService -> Rep PauseService x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PauseService x -> PauseService
$cfrom :: forall x. PauseService -> Rep PauseService x
Prelude.Generic)
newPauseService ::
Prelude.Text ->
PauseService
newPauseService :: Text -> PauseService
newPauseService Text
pServiceArn_ =
PauseService' :: Text -> PauseService
PauseService' {$sel:serviceArn:PauseService' :: Text
serviceArn = Text
pServiceArn_}
pauseService_serviceArn :: Lens.Lens' PauseService Prelude.Text
pauseService_serviceArn :: (Text -> f Text) -> PauseService -> f PauseService
pauseService_serviceArn = (PauseService -> Text)
-> (PauseService -> Text -> PauseService)
-> Lens PauseService PauseService Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PauseService' {Text
serviceArn :: Text
$sel:serviceArn:PauseService' :: PauseService -> Text
serviceArn} -> Text
serviceArn) (\s :: PauseService
s@PauseService' {} Text
a -> PauseService
s {$sel:serviceArn:PauseService' :: Text
serviceArn = Text
a} :: PauseService)
instance Core.AWSRequest PauseService where
type AWSResponse PauseService = PauseServiceResponse
request :: PauseService -> Request PauseService
request = Service -> PauseService -> Request PauseService
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy PauseService
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse PauseService)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse PauseService))
-> Logger
-> Service
-> Proxy PauseService
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse PauseService)))
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 -> Int -> Service -> PauseServiceResponse
PauseServiceResponse'
(Maybe Text -> Int -> Service -> PauseServiceResponse)
-> Either String (Maybe Text)
-> Either String (Int -> Service -> PauseServiceResponse)
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
"OperationId")
Either String (Int -> Service -> PauseServiceResponse)
-> Either String Int
-> Either String (Service -> PauseServiceResponse)
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))
Either String (Service -> PauseServiceResponse)
-> Either String Service -> Either String PauseServiceResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String Service
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"Service")
)
instance Prelude.Hashable PauseService
instance Prelude.NFData PauseService
instance Core.ToHeaders PauseService where
toHeaders :: PauseService -> ResponseHeaders
toHeaders =
ResponseHeaders -> PauseService -> 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
"AppRunner.PauseService" :: 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 PauseService where
toJSON :: PauseService -> Value
toJSON PauseService' {Text
serviceArn :: Text
$sel:serviceArn:PauseService' :: PauseService -> 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
"ServiceArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
serviceArn)]
)
instance Core.ToPath PauseService where
toPath :: PauseService -> ByteString
toPath = ByteString -> PauseService -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery PauseService where
toQuery :: PauseService -> QueryString
toQuery = QueryString -> PauseService -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data PauseServiceResponse = PauseServiceResponse'
{
PauseServiceResponse -> Maybe Text
operationId :: Prelude.Maybe Prelude.Text,
PauseServiceResponse -> Int
httpStatus :: Prelude.Int,
PauseServiceResponse -> Service
service :: Service
}
deriving (PauseServiceResponse -> PauseServiceResponse -> Bool
(PauseServiceResponse -> PauseServiceResponse -> Bool)
-> (PauseServiceResponse -> PauseServiceResponse -> Bool)
-> Eq PauseServiceResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PauseServiceResponse -> PauseServiceResponse -> Bool
$c/= :: PauseServiceResponse -> PauseServiceResponse -> Bool
== :: PauseServiceResponse -> PauseServiceResponse -> Bool
$c== :: PauseServiceResponse -> PauseServiceResponse -> Bool
Prelude.Eq, Int -> PauseServiceResponse -> ShowS
[PauseServiceResponse] -> ShowS
PauseServiceResponse -> String
(Int -> PauseServiceResponse -> ShowS)
-> (PauseServiceResponse -> String)
-> ([PauseServiceResponse] -> ShowS)
-> Show PauseServiceResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PauseServiceResponse] -> ShowS
$cshowList :: [PauseServiceResponse] -> ShowS
show :: PauseServiceResponse -> String
$cshow :: PauseServiceResponse -> String
showsPrec :: Int -> PauseServiceResponse -> ShowS
$cshowsPrec :: Int -> PauseServiceResponse -> ShowS
Prelude.Show, (forall x. PauseServiceResponse -> Rep PauseServiceResponse x)
-> (forall x. Rep PauseServiceResponse x -> PauseServiceResponse)
-> Generic PauseServiceResponse
forall x. Rep PauseServiceResponse x -> PauseServiceResponse
forall x. PauseServiceResponse -> Rep PauseServiceResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PauseServiceResponse x -> PauseServiceResponse
$cfrom :: forall x. PauseServiceResponse -> Rep PauseServiceResponse x
Prelude.Generic)
newPauseServiceResponse ::
Prelude.Int ->
Service ->
PauseServiceResponse
newPauseServiceResponse :: Int -> Service -> PauseServiceResponse
newPauseServiceResponse Int
pHttpStatus_ Service
pService_ =
PauseServiceResponse' :: Maybe Text -> Int -> Service -> PauseServiceResponse
PauseServiceResponse'
{ $sel:operationId:PauseServiceResponse' :: Maybe Text
operationId =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:PauseServiceResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:service:PauseServiceResponse' :: Service
service = Service
pService_
}
pauseServiceResponse_operationId :: Lens.Lens' PauseServiceResponse (Prelude.Maybe Prelude.Text)
pauseServiceResponse_operationId :: (Maybe Text -> f (Maybe Text))
-> PauseServiceResponse -> f PauseServiceResponse
pauseServiceResponse_operationId = (PauseServiceResponse -> Maybe Text)
-> (PauseServiceResponse -> Maybe Text -> PauseServiceResponse)
-> Lens
PauseServiceResponse PauseServiceResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PauseServiceResponse' {Maybe Text
operationId :: Maybe Text
$sel:operationId:PauseServiceResponse' :: PauseServiceResponse -> Maybe Text
operationId} -> Maybe Text
operationId) (\s :: PauseServiceResponse
s@PauseServiceResponse' {} Maybe Text
a -> PauseServiceResponse
s {$sel:operationId:PauseServiceResponse' :: Maybe Text
operationId = Maybe Text
a} :: PauseServiceResponse)
pauseServiceResponse_httpStatus :: Lens.Lens' PauseServiceResponse Prelude.Int
pauseServiceResponse_httpStatus :: (Int -> f Int) -> PauseServiceResponse -> f PauseServiceResponse
pauseServiceResponse_httpStatus = (PauseServiceResponse -> Int)
-> (PauseServiceResponse -> Int -> PauseServiceResponse)
-> Lens PauseServiceResponse PauseServiceResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PauseServiceResponse' {Int
httpStatus :: Int
$sel:httpStatus:PauseServiceResponse' :: PauseServiceResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: PauseServiceResponse
s@PauseServiceResponse' {} Int
a -> PauseServiceResponse
s {$sel:httpStatus:PauseServiceResponse' :: Int
httpStatus = Int
a} :: PauseServiceResponse)
pauseServiceResponse_service :: Lens.Lens' PauseServiceResponse Service
pauseServiceResponse_service :: (Service -> f Service)
-> PauseServiceResponse -> f PauseServiceResponse
pauseServiceResponse_service = (PauseServiceResponse -> Service)
-> (PauseServiceResponse -> Service -> PauseServiceResponse)
-> Lens PauseServiceResponse PauseServiceResponse Service Service
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PauseServiceResponse' {Service
service :: Service
$sel:service:PauseServiceResponse' :: PauseServiceResponse -> Service
service} -> Service
service) (\s :: PauseServiceResponse
s@PauseServiceResponse' {} Service
a -> PauseServiceResponse
s {$sel:service:PauseServiceResponse' :: Service
service = Service
a} :: PauseServiceResponse)
instance Prelude.NFData PauseServiceResponse