{-# 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.GameLift.SuspendGameServerGroup
(
SuspendGameServerGroup (..),
newSuspendGameServerGroup,
suspendGameServerGroup_gameServerGroupName,
suspendGameServerGroup_suspendActions,
SuspendGameServerGroupResponse (..),
newSuspendGameServerGroupResponse,
suspendGameServerGroupResponse_gameServerGroup,
suspendGameServerGroupResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.GameLift.Types
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 SuspendGameServerGroup = SuspendGameServerGroup'
{
SuspendGameServerGroup -> Text
gameServerGroupName :: Prelude.Text,
SuspendGameServerGroup -> NonEmpty GameServerGroupAction
suspendActions :: Prelude.NonEmpty GameServerGroupAction
}
deriving (SuspendGameServerGroup -> SuspendGameServerGroup -> Bool
(SuspendGameServerGroup -> SuspendGameServerGroup -> Bool)
-> (SuspendGameServerGroup -> SuspendGameServerGroup -> Bool)
-> Eq SuspendGameServerGroup
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SuspendGameServerGroup -> SuspendGameServerGroup -> Bool
$c/= :: SuspendGameServerGroup -> SuspendGameServerGroup -> Bool
== :: SuspendGameServerGroup -> SuspendGameServerGroup -> Bool
$c== :: SuspendGameServerGroup -> SuspendGameServerGroup -> Bool
Prelude.Eq, ReadPrec [SuspendGameServerGroup]
ReadPrec SuspendGameServerGroup
Int -> ReadS SuspendGameServerGroup
ReadS [SuspendGameServerGroup]
(Int -> ReadS SuspendGameServerGroup)
-> ReadS [SuspendGameServerGroup]
-> ReadPrec SuspendGameServerGroup
-> ReadPrec [SuspendGameServerGroup]
-> Read SuspendGameServerGroup
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SuspendGameServerGroup]
$creadListPrec :: ReadPrec [SuspendGameServerGroup]
readPrec :: ReadPrec SuspendGameServerGroup
$creadPrec :: ReadPrec SuspendGameServerGroup
readList :: ReadS [SuspendGameServerGroup]
$creadList :: ReadS [SuspendGameServerGroup]
readsPrec :: Int -> ReadS SuspendGameServerGroup
$creadsPrec :: Int -> ReadS SuspendGameServerGroup
Prelude.Read, Int -> SuspendGameServerGroup -> ShowS
[SuspendGameServerGroup] -> ShowS
SuspendGameServerGroup -> String
(Int -> SuspendGameServerGroup -> ShowS)
-> (SuspendGameServerGroup -> String)
-> ([SuspendGameServerGroup] -> ShowS)
-> Show SuspendGameServerGroup
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SuspendGameServerGroup] -> ShowS
$cshowList :: [SuspendGameServerGroup] -> ShowS
show :: SuspendGameServerGroup -> String
$cshow :: SuspendGameServerGroup -> String
showsPrec :: Int -> SuspendGameServerGroup -> ShowS
$cshowsPrec :: Int -> SuspendGameServerGroup -> ShowS
Prelude.Show, (forall x. SuspendGameServerGroup -> Rep SuspendGameServerGroup x)
-> (forall x.
Rep SuspendGameServerGroup x -> SuspendGameServerGroup)
-> Generic SuspendGameServerGroup
forall x. Rep SuspendGameServerGroup x -> SuspendGameServerGroup
forall x. SuspendGameServerGroup -> Rep SuspendGameServerGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SuspendGameServerGroup x -> SuspendGameServerGroup
$cfrom :: forall x. SuspendGameServerGroup -> Rep SuspendGameServerGroup x
Prelude.Generic)
newSuspendGameServerGroup ::
Prelude.Text ->
Prelude.NonEmpty GameServerGroupAction ->
SuspendGameServerGroup
newSuspendGameServerGroup :: Text -> NonEmpty GameServerGroupAction -> SuspendGameServerGroup
newSuspendGameServerGroup
Text
pGameServerGroupName_
NonEmpty GameServerGroupAction
pSuspendActions_ =
SuspendGameServerGroup' :: Text -> NonEmpty GameServerGroupAction -> SuspendGameServerGroup
SuspendGameServerGroup'
{ $sel:gameServerGroupName:SuspendGameServerGroup' :: Text
gameServerGroupName =
Text
pGameServerGroupName_,
$sel:suspendActions:SuspendGameServerGroup' :: NonEmpty GameServerGroupAction
suspendActions =
Tagged
(NonEmpty GameServerGroupAction)
(Identity (NonEmpty GameServerGroupAction))
-> Tagged
(NonEmpty GameServerGroupAction)
(Identity (NonEmpty GameServerGroupAction))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged
(NonEmpty GameServerGroupAction)
(Identity (NonEmpty GameServerGroupAction))
-> Tagged
(NonEmpty GameServerGroupAction)
(Identity (NonEmpty GameServerGroupAction)))
-> NonEmpty GameServerGroupAction -> NonEmpty GameServerGroupAction
forall t b. AReview t b -> b -> t
Lens.# NonEmpty GameServerGroupAction
pSuspendActions_
}
suspendGameServerGroup_gameServerGroupName :: Lens.Lens' SuspendGameServerGroup Prelude.Text
suspendGameServerGroup_gameServerGroupName :: (Text -> f Text)
-> SuspendGameServerGroup -> f SuspendGameServerGroup
suspendGameServerGroup_gameServerGroupName = (SuspendGameServerGroup -> Text)
-> (SuspendGameServerGroup -> Text -> SuspendGameServerGroup)
-> Lens SuspendGameServerGroup SuspendGameServerGroup Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SuspendGameServerGroup' {Text
gameServerGroupName :: Text
$sel:gameServerGroupName:SuspendGameServerGroup' :: SuspendGameServerGroup -> Text
gameServerGroupName} -> Text
gameServerGroupName) (\s :: SuspendGameServerGroup
s@SuspendGameServerGroup' {} Text
a -> SuspendGameServerGroup
s {$sel:gameServerGroupName:SuspendGameServerGroup' :: Text
gameServerGroupName = Text
a} :: SuspendGameServerGroup)
suspendGameServerGroup_suspendActions :: Lens.Lens' SuspendGameServerGroup (Prelude.NonEmpty GameServerGroupAction)
suspendGameServerGroup_suspendActions :: (NonEmpty GameServerGroupAction
-> f (NonEmpty GameServerGroupAction))
-> SuspendGameServerGroup -> f SuspendGameServerGroup
suspendGameServerGroup_suspendActions = (SuspendGameServerGroup -> NonEmpty GameServerGroupAction)
-> (SuspendGameServerGroup
-> NonEmpty GameServerGroupAction -> SuspendGameServerGroup)
-> Lens
SuspendGameServerGroup
SuspendGameServerGroup
(NonEmpty GameServerGroupAction)
(NonEmpty GameServerGroupAction)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SuspendGameServerGroup' {NonEmpty GameServerGroupAction
suspendActions :: NonEmpty GameServerGroupAction
$sel:suspendActions:SuspendGameServerGroup' :: SuspendGameServerGroup -> NonEmpty GameServerGroupAction
suspendActions} -> NonEmpty GameServerGroupAction
suspendActions) (\s :: SuspendGameServerGroup
s@SuspendGameServerGroup' {} NonEmpty GameServerGroupAction
a -> SuspendGameServerGroup
s {$sel:suspendActions:SuspendGameServerGroup' :: NonEmpty GameServerGroupAction
suspendActions = NonEmpty GameServerGroupAction
a} :: SuspendGameServerGroup) ((NonEmpty GameServerGroupAction
-> f (NonEmpty GameServerGroupAction))
-> SuspendGameServerGroup -> f SuspendGameServerGroup)
-> ((NonEmpty GameServerGroupAction
-> f (NonEmpty GameServerGroupAction))
-> NonEmpty GameServerGroupAction
-> f (NonEmpty GameServerGroupAction))
-> (NonEmpty GameServerGroupAction
-> f (NonEmpty GameServerGroupAction))
-> SuspendGameServerGroup
-> f SuspendGameServerGroup
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty GameServerGroupAction
-> f (NonEmpty GameServerGroupAction))
-> NonEmpty GameServerGroupAction
-> f (NonEmpty GameServerGroupAction)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest SuspendGameServerGroup where
type
AWSResponse SuspendGameServerGroup =
SuspendGameServerGroupResponse
request :: SuspendGameServerGroup -> Request SuspendGameServerGroup
request = Service -> SuspendGameServerGroup -> Request SuspendGameServerGroup
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy SuspendGameServerGroup
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse SuspendGameServerGroup)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse SuspendGameServerGroup))
-> Logger
-> Service
-> Proxy SuspendGameServerGroup
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse SuspendGameServerGroup)))
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 GameServerGroup -> Int -> SuspendGameServerGroupResponse
SuspendGameServerGroupResponse'
(Maybe GameServerGroup -> Int -> SuspendGameServerGroupResponse)
-> Either String (Maybe GameServerGroup)
-> Either String (Int -> SuspendGameServerGroupResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe GameServerGroup)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"GameServerGroup")
Either String (Int -> SuspendGameServerGroupResponse)
-> Either String Int
-> Either String SuspendGameServerGroupResponse
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 SuspendGameServerGroup
instance Prelude.NFData SuspendGameServerGroup
instance Core.ToHeaders SuspendGameServerGroup where
toHeaders :: SuspendGameServerGroup -> ResponseHeaders
toHeaders =
ResponseHeaders -> SuspendGameServerGroup -> 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
"GameLift.SuspendGameServerGroup" ::
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 SuspendGameServerGroup where
toJSON :: SuspendGameServerGroup -> Value
toJSON SuspendGameServerGroup' {NonEmpty GameServerGroupAction
Text
suspendActions :: NonEmpty GameServerGroupAction
gameServerGroupName :: Text
$sel:suspendActions:SuspendGameServerGroup' :: SuspendGameServerGroup -> NonEmpty GameServerGroupAction
$sel:gameServerGroupName:SuspendGameServerGroup' :: SuspendGameServerGroup -> 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
"GameServerGroupName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
gameServerGroupName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"SuspendActions" Text -> NonEmpty GameServerGroupAction -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty GameServerGroupAction
suspendActions)
]
)
instance Core.ToPath SuspendGameServerGroup where
toPath :: SuspendGameServerGroup -> ByteString
toPath = ByteString -> SuspendGameServerGroup -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery SuspendGameServerGroup where
toQuery :: SuspendGameServerGroup -> QueryString
toQuery = QueryString -> SuspendGameServerGroup -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data SuspendGameServerGroupResponse = SuspendGameServerGroupResponse'
{
SuspendGameServerGroupResponse -> Maybe GameServerGroup
gameServerGroup :: Prelude.Maybe GameServerGroup,
SuspendGameServerGroupResponse -> Int
httpStatus :: Prelude.Int
}
deriving (SuspendGameServerGroupResponse
-> SuspendGameServerGroupResponse -> Bool
(SuspendGameServerGroupResponse
-> SuspendGameServerGroupResponse -> Bool)
-> (SuspendGameServerGroupResponse
-> SuspendGameServerGroupResponse -> Bool)
-> Eq SuspendGameServerGroupResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SuspendGameServerGroupResponse
-> SuspendGameServerGroupResponse -> Bool
$c/= :: SuspendGameServerGroupResponse
-> SuspendGameServerGroupResponse -> Bool
== :: SuspendGameServerGroupResponse
-> SuspendGameServerGroupResponse -> Bool
$c== :: SuspendGameServerGroupResponse
-> SuspendGameServerGroupResponse -> Bool
Prelude.Eq, ReadPrec [SuspendGameServerGroupResponse]
ReadPrec SuspendGameServerGroupResponse
Int -> ReadS SuspendGameServerGroupResponse
ReadS [SuspendGameServerGroupResponse]
(Int -> ReadS SuspendGameServerGroupResponse)
-> ReadS [SuspendGameServerGroupResponse]
-> ReadPrec SuspendGameServerGroupResponse
-> ReadPrec [SuspendGameServerGroupResponse]
-> Read SuspendGameServerGroupResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SuspendGameServerGroupResponse]
$creadListPrec :: ReadPrec [SuspendGameServerGroupResponse]
readPrec :: ReadPrec SuspendGameServerGroupResponse
$creadPrec :: ReadPrec SuspendGameServerGroupResponse
readList :: ReadS [SuspendGameServerGroupResponse]
$creadList :: ReadS [SuspendGameServerGroupResponse]
readsPrec :: Int -> ReadS SuspendGameServerGroupResponse
$creadsPrec :: Int -> ReadS SuspendGameServerGroupResponse
Prelude.Read, Int -> SuspendGameServerGroupResponse -> ShowS
[SuspendGameServerGroupResponse] -> ShowS
SuspendGameServerGroupResponse -> String
(Int -> SuspendGameServerGroupResponse -> ShowS)
-> (SuspendGameServerGroupResponse -> String)
-> ([SuspendGameServerGroupResponse] -> ShowS)
-> Show SuspendGameServerGroupResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SuspendGameServerGroupResponse] -> ShowS
$cshowList :: [SuspendGameServerGroupResponse] -> ShowS
show :: SuspendGameServerGroupResponse -> String
$cshow :: SuspendGameServerGroupResponse -> String
showsPrec :: Int -> SuspendGameServerGroupResponse -> ShowS
$cshowsPrec :: Int -> SuspendGameServerGroupResponse -> ShowS
Prelude.Show, (forall x.
SuspendGameServerGroupResponse
-> Rep SuspendGameServerGroupResponse x)
-> (forall x.
Rep SuspendGameServerGroupResponse x
-> SuspendGameServerGroupResponse)
-> Generic SuspendGameServerGroupResponse
forall x.
Rep SuspendGameServerGroupResponse x
-> SuspendGameServerGroupResponse
forall x.
SuspendGameServerGroupResponse
-> Rep SuspendGameServerGroupResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep SuspendGameServerGroupResponse x
-> SuspendGameServerGroupResponse
$cfrom :: forall x.
SuspendGameServerGroupResponse
-> Rep SuspendGameServerGroupResponse x
Prelude.Generic)
newSuspendGameServerGroupResponse ::
Prelude.Int ->
SuspendGameServerGroupResponse
newSuspendGameServerGroupResponse :: Int -> SuspendGameServerGroupResponse
newSuspendGameServerGroupResponse Int
pHttpStatus_ =
SuspendGameServerGroupResponse' :: Maybe GameServerGroup -> Int -> SuspendGameServerGroupResponse
SuspendGameServerGroupResponse'
{ $sel:gameServerGroup:SuspendGameServerGroupResponse' :: Maybe GameServerGroup
gameServerGroup =
Maybe GameServerGroup
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:SuspendGameServerGroupResponse' :: Int
httpStatus = Int
pHttpStatus_
}
suspendGameServerGroupResponse_gameServerGroup :: Lens.Lens' SuspendGameServerGroupResponse (Prelude.Maybe GameServerGroup)
suspendGameServerGroupResponse_gameServerGroup :: (Maybe GameServerGroup -> f (Maybe GameServerGroup))
-> SuspendGameServerGroupResponse
-> f SuspendGameServerGroupResponse
suspendGameServerGroupResponse_gameServerGroup = (SuspendGameServerGroupResponse -> Maybe GameServerGroup)
-> (SuspendGameServerGroupResponse
-> Maybe GameServerGroup -> SuspendGameServerGroupResponse)
-> Lens
SuspendGameServerGroupResponse
SuspendGameServerGroupResponse
(Maybe GameServerGroup)
(Maybe GameServerGroup)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SuspendGameServerGroupResponse' {Maybe GameServerGroup
gameServerGroup :: Maybe GameServerGroup
$sel:gameServerGroup:SuspendGameServerGroupResponse' :: SuspendGameServerGroupResponse -> Maybe GameServerGroup
gameServerGroup} -> Maybe GameServerGroup
gameServerGroup) (\s :: SuspendGameServerGroupResponse
s@SuspendGameServerGroupResponse' {} Maybe GameServerGroup
a -> SuspendGameServerGroupResponse
s {$sel:gameServerGroup:SuspendGameServerGroupResponse' :: Maybe GameServerGroup
gameServerGroup = Maybe GameServerGroup
a} :: SuspendGameServerGroupResponse)
suspendGameServerGroupResponse_httpStatus :: Lens.Lens' SuspendGameServerGroupResponse Prelude.Int
suspendGameServerGroupResponse_httpStatus :: (Int -> f Int)
-> SuspendGameServerGroupResponse
-> f SuspendGameServerGroupResponse
suspendGameServerGroupResponse_httpStatus = (SuspendGameServerGroupResponse -> Int)
-> (SuspendGameServerGroupResponse
-> Int -> SuspendGameServerGroupResponse)
-> Lens
SuspendGameServerGroupResponse
SuspendGameServerGroupResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SuspendGameServerGroupResponse' {Int
httpStatus :: Int
$sel:httpStatus:SuspendGameServerGroupResponse' :: SuspendGameServerGroupResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: SuspendGameServerGroupResponse
s@SuspendGameServerGroupResponse' {} Int
a -> SuspendGameServerGroupResponse
s {$sel:httpStatus:SuspendGameServerGroupResponse' :: Int
httpStatus = Int
a} :: SuspendGameServerGroupResponse)
instance
Prelude.NFData
SuspendGameServerGroupResponse