{-# 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.ResolveAlias
(
ResolveAlias (..),
newResolveAlias,
resolveAlias_aliasId,
ResolveAliasResponse (..),
newResolveAliasResponse,
resolveAliasResponse_fleetArn,
resolveAliasResponse_fleetId,
resolveAliasResponse_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 ResolveAlias = ResolveAlias'
{
ResolveAlias -> Text
aliasId :: Prelude.Text
}
deriving (ResolveAlias -> ResolveAlias -> Bool
(ResolveAlias -> ResolveAlias -> Bool)
-> (ResolveAlias -> ResolveAlias -> Bool) -> Eq ResolveAlias
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ResolveAlias -> ResolveAlias -> Bool
$c/= :: ResolveAlias -> ResolveAlias -> Bool
== :: ResolveAlias -> ResolveAlias -> Bool
$c== :: ResolveAlias -> ResolveAlias -> Bool
Prelude.Eq, ReadPrec [ResolveAlias]
ReadPrec ResolveAlias
Int -> ReadS ResolveAlias
ReadS [ResolveAlias]
(Int -> ReadS ResolveAlias)
-> ReadS [ResolveAlias]
-> ReadPrec ResolveAlias
-> ReadPrec [ResolveAlias]
-> Read ResolveAlias
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ResolveAlias]
$creadListPrec :: ReadPrec [ResolveAlias]
readPrec :: ReadPrec ResolveAlias
$creadPrec :: ReadPrec ResolveAlias
readList :: ReadS [ResolveAlias]
$creadList :: ReadS [ResolveAlias]
readsPrec :: Int -> ReadS ResolveAlias
$creadsPrec :: Int -> ReadS ResolveAlias
Prelude.Read, Int -> ResolveAlias -> ShowS
[ResolveAlias] -> ShowS
ResolveAlias -> String
(Int -> ResolveAlias -> ShowS)
-> (ResolveAlias -> String)
-> ([ResolveAlias] -> ShowS)
-> Show ResolveAlias
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ResolveAlias] -> ShowS
$cshowList :: [ResolveAlias] -> ShowS
show :: ResolveAlias -> String
$cshow :: ResolveAlias -> String
showsPrec :: Int -> ResolveAlias -> ShowS
$cshowsPrec :: Int -> ResolveAlias -> ShowS
Prelude.Show, (forall x. ResolveAlias -> Rep ResolveAlias x)
-> (forall x. Rep ResolveAlias x -> ResolveAlias)
-> Generic ResolveAlias
forall x. Rep ResolveAlias x -> ResolveAlias
forall x. ResolveAlias -> Rep ResolveAlias x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ResolveAlias x -> ResolveAlias
$cfrom :: forall x. ResolveAlias -> Rep ResolveAlias x
Prelude.Generic)
newResolveAlias ::
Prelude.Text ->
ResolveAlias
newResolveAlias :: Text -> ResolveAlias
newResolveAlias Text
pAliasId_ =
ResolveAlias' :: Text -> ResolveAlias
ResolveAlias' {$sel:aliasId:ResolveAlias' :: Text
aliasId = Text
pAliasId_}
resolveAlias_aliasId :: Lens.Lens' ResolveAlias Prelude.Text
resolveAlias_aliasId :: (Text -> f Text) -> ResolveAlias -> f ResolveAlias
resolveAlias_aliasId = (ResolveAlias -> Text)
-> (ResolveAlias -> Text -> ResolveAlias)
-> Lens ResolveAlias ResolveAlias Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResolveAlias' {Text
aliasId :: Text
$sel:aliasId:ResolveAlias' :: ResolveAlias -> Text
aliasId} -> Text
aliasId) (\s :: ResolveAlias
s@ResolveAlias' {} Text
a -> ResolveAlias
s {$sel:aliasId:ResolveAlias' :: Text
aliasId = Text
a} :: ResolveAlias)
instance Core.AWSRequest ResolveAlias where
type AWSResponse ResolveAlias = ResolveAliasResponse
request :: ResolveAlias -> Request ResolveAlias
request = Service -> ResolveAlias -> Request ResolveAlias
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy ResolveAlias
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ResolveAlias)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ResolveAlias))
-> Logger
-> Service
-> Proxy ResolveAlias
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ResolveAlias)))
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 -> ResolveAliasResponse
ResolveAliasResponse'
(Maybe Text -> Maybe Text -> Int -> ResolveAliasResponse)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Int -> ResolveAliasResponse)
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
"FleetArn")
Either String (Maybe Text -> Int -> ResolveAliasResponse)
-> Either String (Maybe Text)
-> Either String (Int -> ResolveAliasResponse)
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
"FleetId")
Either String (Int -> ResolveAliasResponse)
-> Either String Int -> Either String ResolveAliasResponse
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 ResolveAlias
instance Prelude.NFData ResolveAlias
instance Core.ToHeaders ResolveAlias where
toHeaders :: ResolveAlias -> ResponseHeaders
toHeaders =
ResponseHeaders -> ResolveAlias -> 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.ResolveAlias" :: 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 ResolveAlias where
toJSON :: ResolveAlias -> Value
toJSON ResolveAlias' {Text
aliasId :: Text
$sel:aliasId:ResolveAlias' :: ResolveAlias -> 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
"AliasId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
aliasId)]
)
instance Core.ToPath ResolveAlias where
toPath :: ResolveAlias -> ByteString
toPath = ByteString -> ResolveAlias -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery ResolveAlias where
toQuery :: ResolveAlias -> QueryString
toQuery = QueryString -> ResolveAlias -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data ResolveAliasResponse = ResolveAliasResponse'
{
ResolveAliasResponse -> Maybe Text
fleetArn :: Prelude.Maybe Prelude.Text,
ResolveAliasResponse -> Maybe Text
fleetId :: Prelude.Maybe Prelude.Text,
ResolveAliasResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ResolveAliasResponse -> ResolveAliasResponse -> Bool
(ResolveAliasResponse -> ResolveAliasResponse -> Bool)
-> (ResolveAliasResponse -> ResolveAliasResponse -> Bool)
-> Eq ResolveAliasResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ResolveAliasResponse -> ResolveAliasResponse -> Bool
$c/= :: ResolveAliasResponse -> ResolveAliasResponse -> Bool
== :: ResolveAliasResponse -> ResolveAliasResponse -> Bool
$c== :: ResolveAliasResponse -> ResolveAliasResponse -> Bool
Prelude.Eq, ReadPrec [ResolveAliasResponse]
ReadPrec ResolveAliasResponse
Int -> ReadS ResolveAliasResponse
ReadS [ResolveAliasResponse]
(Int -> ReadS ResolveAliasResponse)
-> ReadS [ResolveAliasResponse]
-> ReadPrec ResolveAliasResponse
-> ReadPrec [ResolveAliasResponse]
-> Read ResolveAliasResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ResolveAliasResponse]
$creadListPrec :: ReadPrec [ResolveAliasResponse]
readPrec :: ReadPrec ResolveAliasResponse
$creadPrec :: ReadPrec ResolveAliasResponse
readList :: ReadS [ResolveAliasResponse]
$creadList :: ReadS [ResolveAliasResponse]
readsPrec :: Int -> ReadS ResolveAliasResponse
$creadsPrec :: Int -> ReadS ResolveAliasResponse
Prelude.Read, Int -> ResolveAliasResponse -> ShowS
[ResolveAliasResponse] -> ShowS
ResolveAliasResponse -> String
(Int -> ResolveAliasResponse -> ShowS)
-> (ResolveAliasResponse -> String)
-> ([ResolveAliasResponse] -> ShowS)
-> Show ResolveAliasResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ResolveAliasResponse] -> ShowS
$cshowList :: [ResolveAliasResponse] -> ShowS
show :: ResolveAliasResponse -> String
$cshow :: ResolveAliasResponse -> String
showsPrec :: Int -> ResolveAliasResponse -> ShowS
$cshowsPrec :: Int -> ResolveAliasResponse -> ShowS
Prelude.Show, (forall x. ResolveAliasResponse -> Rep ResolveAliasResponse x)
-> (forall x. Rep ResolveAliasResponse x -> ResolveAliasResponse)
-> Generic ResolveAliasResponse
forall x. Rep ResolveAliasResponse x -> ResolveAliasResponse
forall x. ResolveAliasResponse -> Rep ResolveAliasResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ResolveAliasResponse x -> ResolveAliasResponse
$cfrom :: forall x. ResolveAliasResponse -> Rep ResolveAliasResponse x
Prelude.Generic)
newResolveAliasResponse ::
Prelude.Int ->
ResolveAliasResponse
newResolveAliasResponse :: Int -> ResolveAliasResponse
newResolveAliasResponse Int
pHttpStatus_ =
ResolveAliasResponse' :: Maybe Text -> Maybe Text -> Int -> ResolveAliasResponse
ResolveAliasResponse'
{ $sel:fleetArn:ResolveAliasResponse' :: Maybe Text
fleetArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:fleetId:ResolveAliasResponse' :: Maybe Text
fleetId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ResolveAliasResponse' :: Int
httpStatus = Int
pHttpStatus_
}
resolveAliasResponse_fleetArn :: Lens.Lens' ResolveAliasResponse (Prelude.Maybe Prelude.Text)
resolveAliasResponse_fleetArn :: (Maybe Text -> f (Maybe Text))
-> ResolveAliasResponse -> f ResolveAliasResponse
resolveAliasResponse_fleetArn = (ResolveAliasResponse -> Maybe Text)
-> (ResolveAliasResponse -> Maybe Text -> ResolveAliasResponse)
-> Lens
ResolveAliasResponse ResolveAliasResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResolveAliasResponse' {Maybe Text
fleetArn :: Maybe Text
$sel:fleetArn:ResolveAliasResponse' :: ResolveAliasResponse -> Maybe Text
fleetArn} -> Maybe Text
fleetArn) (\s :: ResolveAliasResponse
s@ResolveAliasResponse' {} Maybe Text
a -> ResolveAliasResponse
s {$sel:fleetArn:ResolveAliasResponse' :: Maybe Text
fleetArn = Maybe Text
a} :: ResolveAliasResponse)
resolveAliasResponse_fleetId :: Lens.Lens' ResolveAliasResponse (Prelude.Maybe Prelude.Text)
resolveAliasResponse_fleetId :: (Maybe Text -> f (Maybe Text))
-> ResolveAliasResponse -> f ResolveAliasResponse
resolveAliasResponse_fleetId = (ResolveAliasResponse -> Maybe Text)
-> (ResolveAliasResponse -> Maybe Text -> ResolveAliasResponse)
-> Lens
ResolveAliasResponse ResolveAliasResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResolveAliasResponse' {Maybe Text
fleetId :: Maybe Text
$sel:fleetId:ResolveAliasResponse' :: ResolveAliasResponse -> Maybe Text
fleetId} -> Maybe Text
fleetId) (\s :: ResolveAliasResponse
s@ResolveAliasResponse' {} Maybe Text
a -> ResolveAliasResponse
s {$sel:fleetId:ResolveAliasResponse' :: Maybe Text
fleetId = Maybe Text
a} :: ResolveAliasResponse)
resolveAliasResponse_httpStatus :: Lens.Lens' ResolveAliasResponse Prelude.Int
resolveAliasResponse_httpStatus :: (Int -> f Int) -> ResolveAliasResponse -> f ResolveAliasResponse
resolveAliasResponse_httpStatus = (ResolveAliasResponse -> Int)
-> (ResolveAliasResponse -> Int -> ResolveAliasResponse)
-> Lens ResolveAliasResponse ResolveAliasResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResolveAliasResponse' {Int
httpStatus :: Int
$sel:httpStatus:ResolveAliasResponse' :: ResolveAliasResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ResolveAliasResponse
s@ResolveAliasResponse' {} Int
a -> ResolveAliasResponse
s {$sel:httpStatus:ResolveAliasResponse' :: Int
httpStatus = Int
a} :: ResolveAliasResponse)
instance Prelude.NFData ResolveAliasResponse