{-# 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.CreateAlias
(
CreateAlias (..),
newCreateAlias,
createAlias_description,
createAlias_tags,
createAlias_name,
createAlias_routingStrategy,
CreateAliasResponse (..),
newCreateAliasResponse,
createAliasResponse_alias,
createAliasResponse_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 CreateAlias = CreateAlias'
{
CreateAlias -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
CreateAlias -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
CreateAlias -> Text
name :: Prelude.Text,
CreateAlias -> RoutingStrategy
routingStrategy :: RoutingStrategy
}
deriving (CreateAlias -> CreateAlias -> Bool
(CreateAlias -> CreateAlias -> Bool)
-> (CreateAlias -> CreateAlias -> Bool) -> Eq CreateAlias
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateAlias -> CreateAlias -> Bool
$c/= :: CreateAlias -> CreateAlias -> Bool
== :: CreateAlias -> CreateAlias -> Bool
$c== :: CreateAlias -> CreateAlias -> Bool
Prelude.Eq, ReadPrec [CreateAlias]
ReadPrec CreateAlias
Int -> ReadS CreateAlias
ReadS [CreateAlias]
(Int -> ReadS CreateAlias)
-> ReadS [CreateAlias]
-> ReadPrec CreateAlias
-> ReadPrec [CreateAlias]
-> Read CreateAlias
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateAlias]
$creadListPrec :: ReadPrec [CreateAlias]
readPrec :: ReadPrec CreateAlias
$creadPrec :: ReadPrec CreateAlias
readList :: ReadS [CreateAlias]
$creadList :: ReadS [CreateAlias]
readsPrec :: Int -> ReadS CreateAlias
$creadsPrec :: Int -> ReadS CreateAlias
Prelude.Read, Int -> CreateAlias -> ShowS
[CreateAlias] -> ShowS
CreateAlias -> String
(Int -> CreateAlias -> ShowS)
-> (CreateAlias -> String)
-> ([CreateAlias] -> ShowS)
-> Show CreateAlias
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateAlias] -> ShowS
$cshowList :: [CreateAlias] -> ShowS
show :: CreateAlias -> String
$cshow :: CreateAlias -> String
showsPrec :: Int -> CreateAlias -> ShowS
$cshowsPrec :: Int -> CreateAlias -> ShowS
Prelude.Show, (forall x. CreateAlias -> Rep CreateAlias x)
-> (forall x. Rep CreateAlias x -> CreateAlias)
-> Generic CreateAlias
forall x. Rep CreateAlias x -> CreateAlias
forall x. CreateAlias -> Rep CreateAlias x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateAlias x -> CreateAlias
$cfrom :: forall x. CreateAlias -> Rep CreateAlias x
Prelude.Generic)
newCreateAlias ::
Prelude.Text ->
RoutingStrategy ->
CreateAlias
newCreateAlias :: Text -> RoutingStrategy -> CreateAlias
newCreateAlias Text
pName_ RoutingStrategy
pRoutingStrategy_ =
CreateAlias' :: Maybe Text -> Maybe [Tag] -> Text -> RoutingStrategy -> CreateAlias
CreateAlias'
{ $sel:description:CreateAlias' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:tags:CreateAlias' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
$sel:name:CreateAlias' :: Text
name = Text
pName_,
$sel:routingStrategy:CreateAlias' :: RoutingStrategy
routingStrategy = RoutingStrategy
pRoutingStrategy_
}
createAlias_description :: Lens.Lens' CreateAlias (Prelude.Maybe Prelude.Text)
createAlias_description :: (Maybe Text -> f (Maybe Text)) -> CreateAlias -> f CreateAlias
createAlias_description = (CreateAlias -> Maybe Text)
-> (CreateAlias -> Maybe Text -> CreateAlias)
-> Lens CreateAlias CreateAlias (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAlias' {Maybe Text
description :: Maybe Text
$sel:description:CreateAlias' :: CreateAlias -> Maybe Text
description} -> Maybe Text
description) (\s :: CreateAlias
s@CreateAlias' {} Maybe Text
a -> CreateAlias
s {$sel:description:CreateAlias' :: Maybe Text
description = Maybe Text
a} :: CreateAlias)
createAlias_tags :: Lens.Lens' CreateAlias (Prelude.Maybe [Tag])
createAlias_tags :: (Maybe [Tag] -> f (Maybe [Tag])) -> CreateAlias -> f CreateAlias
createAlias_tags = (CreateAlias -> Maybe [Tag])
-> (CreateAlias -> Maybe [Tag] -> CreateAlias)
-> Lens CreateAlias CreateAlias (Maybe [Tag]) (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAlias' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateAlias' :: CreateAlias -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateAlias
s@CreateAlias' {} Maybe [Tag]
a -> CreateAlias
s {$sel:tags:CreateAlias' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateAlias) ((Maybe [Tag] -> f (Maybe [Tag])) -> CreateAlias -> f CreateAlias)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
-> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateAlias
-> f CreateAlias
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Tag] [Tag] [Tag] [Tag]
-> Iso (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag])
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 AnIso [Tag] [Tag] [Tag] [Tag]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
createAlias_name :: Lens.Lens' CreateAlias Prelude.Text
createAlias_name :: (Text -> f Text) -> CreateAlias -> f CreateAlias
createAlias_name = (CreateAlias -> Text)
-> (CreateAlias -> Text -> CreateAlias)
-> Lens CreateAlias CreateAlias Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAlias' {Text
name :: Text
$sel:name:CreateAlias' :: CreateAlias -> Text
name} -> Text
name) (\s :: CreateAlias
s@CreateAlias' {} Text
a -> CreateAlias
s {$sel:name:CreateAlias' :: Text
name = Text
a} :: CreateAlias)
createAlias_routingStrategy :: Lens.Lens' CreateAlias RoutingStrategy
createAlias_routingStrategy :: (RoutingStrategy -> f RoutingStrategy)
-> CreateAlias -> f CreateAlias
createAlias_routingStrategy = (CreateAlias -> RoutingStrategy)
-> (CreateAlias -> RoutingStrategy -> CreateAlias)
-> Lens CreateAlias CreateAlias RoutingStrategy RoutingStrategy
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAlias' {RoutingStrategy
routingStrategy :: RoutingStrategy
$sel:routingStrategy:CreateAlias' :: CreateAlias -> RoutingStrategy
routingStrategy} -> RoutingStrategy
routingStrategy) (\s :: CreateAlias
s@CreateAlias' {} RoutingStrategy
a -> CreateAlias
s {$sel:routingStrategy:CreateAlias' :: RoutingStrategy
routingStrategy = RoutingStrategy
a} :: CreateAlias)
instance Core.AWSRequest CreateAlias where
type AWSResponse CreateAlias = CreateAliasResponse
request :: CreateAlias -> Request CreateAlias
request = Service -> CreateAlias -> Request CreateAlias
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateAlias
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateAlias)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateAlias))
-> Logger
-> Service
-> Proxy CreateAlias
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateAlias)))
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 Alias -> Int -> CreateAliasResponse
CreateAliasResponse'
(Maybe Alias -> Int -> CreateAliasResponse)
-> Either String (Maybe Alias)
-> Either String (Int -> CreateAliasResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Alias)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Alias")
Either String (Int -> CreateAliasResponse)
-> Either String Int -> Either String CreateAliasResponse
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 CreateAlias
instance Prelude.NFData CreateAlias
instance Core.ToHeaders CreateAlias where
toHeaders :: CreateAlias -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreateAlias -> 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.CreateAlias" :: 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 CreateAlias where
toJSON :: CreateAlias -> Value
toJSON CreateAlias' {Maybe [Tag]
Maybe Text
Text
RoutingStrategy
routingStrategy :: RoutingStrategy
name :: Text
tags :: Maybe [Tag]
description :: Maybe Text
$sel:routingStrategy:CreateAlias' :: CreateAlias -> RoutingStrategy
$sel:name:CreateAlias' :: CreateAlias -> Text
$sel:tags:CreateAlias' :: CreateAlias -> Maybe [Tag]
$sel:description:CreateAlias' :: CreateAlias -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"Description" 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
description,
(Text
"Tags" Text -> [Tag] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Tag] -> Pair) -> Maybe [Tag] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"RoutingStrategy" Text -> RoutingStrategy -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= RoutingStrategy
routingStrategy)
]
)
instance Core.ToPath CreateAlias where
toPath :: CreateAlias -> ByteString
toPath = ByteString -> CreateAlias -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CreateAlias where
toQuery :: CreateAlias -> QueryString
toQuery = QueryString -> CreateAlias -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateAliasResponse = CreateAliasResponse'
{
CreateAliasResponse -> Maybe Alias
alias :: Prelude.Maybe Alias,
CreateAliasResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateAliasResponse -> CreateAliasResponse -> Bool
(CreateAliasResponse -> CreateAliasResponse -> Bool)
-> (CreateAliasResponse -> CreateAliasResponse -> Bool)
-> Eq CreateAliasResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateAliasResponse -> CreateAliasResponse -> Bool
$c/= :: CreateAliasResponse -> CreateAliasResponse -> Bool
== :: CreateAliasResponse -> CreateAliasResponse -> Bool
$c== :: CreateAliasResponse -> CreateAliasResponse -> Bool
Prelude.Eq, ReadPrec [CreateAliasResponse]
ReadPrec CreateAliasResponse
Int -> ReadS CreateAliasResponse
ReadS [CreateAliasResponse]
(Int -> ReadS CreateAliasResponse)
-> ReadS [CreateAliasResponse]
-> ReadPrec CreateAliasResponse
-> ReadPrec [CreateAliasResponse]
-> Read CreateAliasResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateAliasResponse]
$creadListPrec :: ReadPrec [CreateAliasResponse]
readPrec :: ReadPrec CreateAliasResponse
$creadPrec :: ReadPrec CreateAliasResponse
readList :: ReadS [CreateAliasResponse]
$creadList :: ReadS [CreateAliasResponse]
readsPrec :: Int -> ReadS CreateAliasResponse
$creadsPrec :: Int -> ReadS CreateAliasResponse
Prelude.Read, Int -> CreateAliasResponse -> ShowS
[CreateAliasResponse] -> ShowS
CreateAliasResponse -> String
(Int -> CreateAliasResponse -> ShowS)
-> (CreateAliasResponse -> String)
-> ([CreateAliasResponse] -> ShowS)
-> Show CreateAliasResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateAliasResponse] -> ShowS
$cshowList :: [CreateAliasResponse] -> ShowS
show :: CreateAliasResponse -> String
$cshow :: CreateAliasResponse -> String
showsPrec :: Int -> CreateAliasResponse -> ShowS
$cshowsPrec :: Int -> CreateAliasResponse -> ShowS
Prelude.Show, (forall x. CreateAliasResponse -> Rep CreateAliasResponse x)
-> (forall x. Rep CreateAliasResponse x -> CreateAliasResponse)
-> Generic CreateAliasResponse
forall x. Rep CreateAliasResponse x -> CreateAliasResponse
forall x. CreateAliasResponse -> Rep CreateAliasResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateAliasResponse x -> CreateAliasResponse
$cfrom :: forall x. CreateAliasResponse -> Rep CreateAliasResponse x
Prelude.Generic)
newCreateAliasResponse ::
Prelude.Int ->
CreateAliasResponse
newCreateAliasResponse :: Int -> CreateAliasResponse
newCreateAliasResponse Int
pHttpStatus_ =
CreateAliasResponse' :: Maybe Alias -> Int -> CreateAliasResponse
CreateAliasResponse'
{ $sel:alias:CreateAliasResponse' :: Maybe Alias
alias = Maybe Alias
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateAliasResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createAliasResponse_alias :: Lens.Lens' CreateAliasResponse (Prelude.Maybe Alias)
createAliasResponse_alias :: (Maybe Alias -> f (Maybe Alias))
-> CreateAliasResponse -> f CreateAliasResponse
createAliasResponse_alias = (CreateAliasResponse -> Maybe Alias)
-> (CreateAliasResponse -> Maybe Alias -> CreateAliasResponse)
-> Lens
CreateAliasResponse CreateAliasResponse (Maybe Alias) (Maybe Alias)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAliasResponse' {Maybe Alias
alias :: Maybe Alias
$sel:alias:CreateAliasResponse' :: CreateAliasResponse -> Maybe Alias
alias} -> Maybe Alias
alias) (\s :: CreateAliasResponse
s@CreateAliasResponse' {} Maybe Alias
a -> CreateAliasResponse
s {$sel:alias:CreateAliasResponse' :: Maybe Alias
alias = Maybe Alias
a} :: CreateAliasResponse)
createAliasResponse_httpStatus :: Lens.Lens' CreateAliasResponse Prelude.Int
createAliasResponse_httpStatus :: (Int -> f Int) -> CreateAliasResponse -> f CreateAliasResponse
createAliasResponse_httpStatus = (CreateAliasResponse -> Int)
-> (CreateAliasResponse -> Int -> CreateAliasResponse)
-> Lens CreateAliasResponse CreateAliasResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAliasResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateAliasResponse' :: CreateAliasResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateAliasResponse
s@CreateAliasResponse' {} Int
a -> CreateAliasResponse
s {$sel:httpStatus:CreateAliasResponse' :: Int
httpStatus = Int
a} :: CreateAliasResponse)
instance Prelude.NFData CreateAliasResponse