{-# 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.CreateMatchmakingRuleSet
(
CreateMatchmakingRuleSet (..),
newCreateMatchmakingRuleSet,
createMatchmakingRuleSet_tags,
createMatchmakingRuleSet_name,
createMatchmakingRuleSet_ruleSetBody,
CreateMatchmakingRuleSetResponse (..),
newCreateMatchmakingRuleSetResponse,
createMatchmakingRuleSetResponse_httpStatus,
createMatchmakingRuleSetResponse_ruleSet,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.GameLift.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data CreateMatchmakingRuleSet = CreateMatchmakingRuleSet'
{
CreateMatchmakingRuleSet -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
CreateMatchmakingRuleSet -> Text
name :: Prelude.Text,
CreateMatchmakingRuleSet -> Text
ruleSetBody :: Prelude.Text
}
deriving (CreateMatchmakingRuleSet -> CreateMatchmakingRuleSet -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateMatchmakingRuleSet -> CreateMatchmakingRuleSet -> Bool
$c/= :: CreateMatchmakingRuleSet -> CreateMatchmakingRuleSet -> Bool
== :: CreateMatchmakingRuleSet -> CreateMatchmakingRuleSet -> Bool
$c== :: CreateMatchmakingRuleSet -> CreateMatchmakingRuleSet -> Bool
Prelude.Eq, ReadPrec [CreateMatchmakingRuleSet]
ReadPrec CreateMatchmakingRuleSet
Int -> ReadS CreateMatchmakingRuleSet
ReadS [CreateMatchmakingRuleSet]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateMatchmakingRuleSet]
$creadListPrec :: ReadPrec [CreateMatchmakingRuleSet]
readPrec :: ReadPrec CreateMatchmakingRuleSet
$creadPrec :: ReadPrec CreateMatchmakingRuleSet
readList :: ReadS [CreateMatchmakingRuleSet]
$creadList :: ReadS [CreateMatchmakingRuleSet]
readsPrec :: Int -> ReadS CreateMatchmakingRuleSet
$creadsPrec :: Int -> ReadS CreateMatchmakingRuleSet
Prelude.Read, Int -> CreateMatchmakingRuleSet -> ShowS
[CreateMatchmakingRuleSet] -> ShowS
CreateMatchmakingRuleSet -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateMatchmakingRuleSet] -> ShowS
$cshowList :: [CreateMatchmakingRuleSet] -> ShowS
show :: CreateMatchmakingRuleSet -> String
$cshow :: CreateMatchmakingRuleSet -> String
showsPrec :: Int -> CreateMatchmakingRuleSet -> ShowS
$cshowsPrec :: Int -> CreateMatchmakingRuleSet -> ShowS
Prelude.Show, forall x.
Rep CreateMatchmakingRuleSet x -> CreateMatchmakingRuleSet
forall x.
CreateMatchmakingRuleSet -> Rep CreateMatchmakingRuleSet x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateMatchmakingRuleSet x -> CreateMatchmakingRuleSet
$cfrom :: forall x.
CreateMatchmakingRuleSet -> Rep CreateMatchmakingRuleSet x
Prelude.Generic)
newCreateMatchmakingRuleSet ::
Prelude.Text ->
Prelude.Text ->
CreateMatchmakingRuleSet
newCreateMatchmakingRuleSet :: Text -> Text -> CreateMatchmakingRuleSet
newCreateMatchmakingRuleSet Text
pName_ Text
pRuleSetBody_ =
CreateMatchmakingRuleSet'
{ $sel:tags:CreateMatchmakingRuleSet' :: Maybe [Tag]
tags = forall a. Maybe a
Prelude.Nothing,
$sel:name:CreateMatchmakingRuleSet' :: Text
name = Text
pName_,
$sel:ruleSetBody:CreateMatchmakingRuleSet' :: Text
ruleSetBody = Text
pRuleSetBody_
}
createMatchmakingRuleSet_tags :: Lens.Lens' CreateMatchmakingRuleSet (Prelude.Maybe [Tag])
createMatchmakingRuleSet_tags :: Lens' CreateMatchmakingRuleSet (Maybe [Tag])
createMatchmakingRuleSet_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMatchmakingRuleSet' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateMatchmakingRuleSet' :: CreateMatchmakingRuleSet -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateMatchmakingRuleSet
s@CreateMatchmakingRuleSet' {} Maybe [Tag]
a -> CreateMatchmakingRuleSet
s {$sel:tags:CreateMatchmakingRuleSet' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateMatchmakingRuleSet) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
createMatchmakingRuleSet_name :: Lens.Lens' CreateMatchmakingRuleSet Prelude.Text
createMatchmakingRuleSet_name :: Lens' CreateMatchmakingRuleSet Text
createMatchmakingRuleSet_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMatchmakingRuleSet' {Text
name :: Text
$sel:name:CreateMatchmakingRuleSet' :: CreateMatchmakingRuleSet -> Text
name} -> Text
name) (\s :: CreateMatchmakingRuleSet
s@CreateMatchmakingRuleSet' {} Text
a -> CreateMatchmakingRuleSet
s {$sel:name:CreateMatchmakingRuleSet' :: Text
name = Text
a} :: CreateMatchmakingRuleSet)
createMatchmakingRuleSet_ruleSetBody :: Lens.Lens' CreateMatchmakingRuleSet Prelude.Text
createMatchmakingRuleSet_ruleSetBody :: Lens' CreateMatchmakingRuleSet Text
createMatchmakingRuleSet_ruleSetBody = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMatchmakingRuleSet' {Text
ruleSetBody :: Text
$sel:ruleSetBody:CreateMatchmakingRuleSet' :: CreateMatchmakingRuleSet -> Text
ruleSetBody} -> Text
ruleSetBody) (\s :: CreateMatchmakingRuleSet
s@CreateMatchmakingRuleSet' {} Text
a -> CreateMatchmakingRuleSet
s {$sel:ruleSetBody:CreateMatchmakingRuleSet' :: Text
ruleSetBody = Text
a} :: CreateMatchmakingRuleSet)
instance Core.AWSRequest CreateMatchmakingRuleSet where
type
AWSResponse CreateMatchmakingRuleSet =
CreateMatchmakingRuleSetResponse
request :: (Service -> Service)
-> CreateMatchmakingRuleSet -> Request CreateMatchmakingRuleSet
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy CreateMatchmakingRuleSet
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateMatchmakingRuleSet)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Int -> MatchmakingRuleSet -> CreateMatchmakingRuleSetResponse
CreateMatchmakingRuleSetResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String a
Data..:> Key
"RuleSet")
)
instance Prelude.Hashable CreateMatchmakingRuleSet where
hashWithSalt :: Int -> CreateMatchmakingRuleSet -> Int
hashWithSalt Int
_salt CreateMatchmakingRuleSet' {Maybe [Tag]
Text
ruleSetBody :: Text
name :: Text
tags :: Maybe [Tag]
$sel:ruleSetBody:CreateMatchmakingRuleSet' :: CreateMatchmakingRuleSet -> Text
$sel:name:CreateMatchmakingRuleSet' :: CreateMatchmakingRuleSet -> Text
$sel:tags:CreateMatchmakingRuleSet' :: CreateMatchmakingRuleSet -> Maybe [Tag]
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Tag]
tags
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
ruleSetBody
instance Prelude.NFData CreateMatchmakingRuleSet where
rnf :: CreateMatchmakingRuleSet -> ()
rnf CreateMatchmakingRuleSet' {Maybe [Tag]
Text
ruleSetBody :: Text
name :: Text
tags :: Maybe [Tag]
$sel:ruleSetBody:CreateMatchmakingRuleSet' :: CreateMatchmakingRuleSet -> Text
$sel:name:CreateMatchmakingRuleSet' :: CreateMatchmakingRuleSet -> Text
$sel:tags:CreateMatchmakingRuleSet' :: CreateMatchmakingRuleSet -> Maybe [Tag]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [Tag]
tags
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
ruleSetBody
instance Data.ToHeaders CreateMatchmakingRuleSet where
toHeaders :: CreateMatchmakingRuleSet -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"GameLift.CreateMatchmakingRuleSet" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON CreateMatchmakingRuleSet where
toJSON :: CreateMatchmakingRuleSet -> Value
toJSON CreateMatchmakingRuleSet' {Maybe [Tag]
Text
ruleSetBody :: Text
name :: Text
tags :: Maybe [Tag]
$sel:ruleSetBody:CreateMatchmakingRuleSet' :: CreateMatchmakingRuleSet -> Text
$sel:name:CreateMatchmakingRuleSet' :: CreateMatchmakingRuleSet -> Text
$sel:tags:CreateMatchmakingRuleSet' :: CreateMatchmakingRuleSet -> Maybe [Tag]
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"Tags" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags,
forall a. a -> Maybe a
Prelude.Just (Key
"Name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
name),
forall a. a -> Maybe a
Prelude.Just (Key
"RuleSetBody" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
ruleSetBody)
]
)
instance Data.ToPath CreateMatchmakingRuleSet where
toPath :: CreateMatchmakingRuleSet -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery CreateMatchmakingRuleSet where
toQuery :: CreateMatchmakingRuleSet -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data CreateMatchmakingRuleSetResponse = CreateMatchmakingRuleSetResponse'
{
CreateMatchmakingRuleSetResponse -> Int
httpStatus :: Prelude.Int,
CreateMatchmakingRuleSetResponse -> MatchmakingRuleSet
ruleSet :: MatchmakingRuleSet
}
deriving (CreateMatchmakingRuleSetResponse
-> CreateMatchmakingRuleSetResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateMatchmakingRuleSetResponse
-> CreateMatchmakingRuleSetResponse -> Bool
$c/= :: CreateMatchmakingRuleSetResponse
-> CreateMatchmakingRuleSetResponse -> Bool
== :: CreateMatchmakingRuleSetResponse
-> CreateMatchmakingRuleSetResponse -> Bool
$c== :: CreateMatchmakingRuleSetResponse
-> CreateMatchmakingRuleSetResponse -> Bool
Prelude.Eq, ReadPrec [CreateMatchmakingRuleSetResponse]
ReadPrec CreateMatchmakingRuleSetResponse
Int -> ReadS CreateMatchmakingRuleSetResponse
ReadS [CreateMatchmakingRuleSetResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateMatchmakingRuleSetResponse]
$creadListPrec :: ReadPrec [CreateMatchmakingRuleSetResponse]
readPrec :: ReadPrec CreateMatchmakingRuleSetResponse
$creadPrec :: ReadPrec CreateMatchmakingRuleSetResponse
readList :: ReadS [CreateMatchmakingRuleSetResponse]
$creadList :: ReadS [CreateMatchmakingRuleSetResponse]
readsPrec :: Int -> ReadS CreateMatchmakingRuleSetResponse
$creadsPrec :: Int -> ReadS CreateMatchmakingRuleSetResponse
Prelude.Read, Int -> CreateMatchmakingRuleSetResponse -> ShowS
[CreateMatchmakingRuleSetResponse] -> ShowS
CreateMatchmakingRuleSetResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateMatchmakingRuleSetResponse] -> ShowS
$cshowList :: [CreateMatchmakingRuleSetResponse] -> ShowS
show :: CreateMatchmakingRuleSetResponse -> String
$cshow :: CreateMatchmakingRuleSetResponse -> String
showsPrec :: Int -> CreateMatchmakingRuleSetResponse -> ShowS
$cshowsPrec :: Int -> CreateMatchmakingRuleSetResponse -> ShowS
Prelude.Show, forall x.
Rep CreateMatchmakingRuleSetResponse x
-> CreateMatchmakingRuleSetResponse
forall x.
CreateMatchmakingRuleSetResponse
-> Rep CreateMatchmakingRuleSetResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateMatchmakingRuleSetResponse x
-> CreateMatchmakingRuleSetResponse
$cfrom :: forall x.
CreateMatchmakingRuleSetResponse
-> Rep CreateMatchmakingRuleSetResponse x
Prelude.Generic)
newCreateMatchmakingRuleSetResponse ::
Prelude.Int ->
MatchmakingRuleSet ->
CreateMatchmakingRuleSetResponse
newCreateMatchmakingRuleSetResponse :: Int -> MatchmakingRuleSet -> CreateMatchmakingRuleSetResponse
newCreateMatchmakingRuleSetResponse
Int
pHttpStatus_
MatchmakingRuleSet
pRuleSet_ =
CreateMatchmakingRuleSetResponse'
{ $sel:httpStatus:CreateMatchmakingRuleSetResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:ruleSet:CreateMatchmakingRuleSetResponse' :: MatchmakingRuleSet
ruleSet = MatchmakingRuleSet
pRuleSet_
}
createMatchmakingRuleSetResponse_httpStatus :: Lens.Lens' CreateMatchmakingRuleSetResponse Prelude.Int
createMatchmakingRuleSetResponse_httpStatus :: Lens' CreateMatchmakingRuleSetResponse Int
createMatchmakingRuleSetResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMatchmakingRuleSetResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateMatchmakingRuleSetResponse' :: CreateMatchmakingRuleSetResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateMatchmakingRuleSetResponse
s@CreateMatchmakingRuleSetResponse' {} Int
a -> CreateMatchmakingRuleSetResponse
s {$sel:httpStatus:CreateMatchmakingRuleSetResponse' :: Int
httpStatus = Int
a} :: CreateMatchmakingRuleSetResponse)
createMatchmakingRuleSetResponse_ruleSet :: Lens.Lens' CreateMatchmakingRuleSetResponse MatchmakingRuleSet
createMatchmakingRuleSetResponse_ruleSet :: Lens' CreateMatchmakingRuleSetResponse MatchmakingRuleSet
createMatchmakingRuleSetResponse_ruleSet = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMatchmakingRuleSetResponse' {MatchmakingRuleSet
ruleSet :: MatchmakingRuleSet
$sel:ruleSet:CreateMatchmakingRuleSetResponse' :: CreateMatchmakingRuleSetResponse -> MatchmakingRuleSet
ruleSet} -> MatchmakingRuleSet
ruleSet) (\s :: CreateMatchmakingRuleSetResponse
s@CreateMatchmakingRuleSetResponse' {} MatchmakingRuleSet
a -> CreateMatchmakingRuleSetResponse
s {$sel:ruleSet:CreateMatchmakingRuleSetResponse' :: MatchmakingRuleSet
ruleSet = MatchmakingRuleSet
a} :: CreateMatchmakingRuleSetResponse)
instance
Prelude.NFData
CreateMatchmakingRuleSetResponse
where
rnf :: CreateMatchmakingRuleSetResponse -> ()
rnf CreateMatchmakingRuleSetResponse' {Int
MatchmakingRuleSet
ruleSet :: MatchmakingRuleSet
httpStatus :: Int
$sel:ruleSet:CreateMatchmakingRuleSetResponse' :: CreateMatchmakingRuleSetResponse -> MatchmakingRuleSet
$sel:httpStatus:CreateMatchmakingRuleSetResponse' :: CreateMatchmakingRuleSetResponse -> Int
..} =
forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf MatchmakingRuleSet
ruleSet