{-# 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.DescribeAlias
(
DescribeAlias (..),
newDescribeAlias,
describeAlias_aliasId,
DescribeAliasResponse (..),
newDescribeAliasResponse,
describeAliasResponse_alias,
describeAliasResponse_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 DescribeAlias = DescribeAlias'
{
DescribeAlias -> Text
aliasId :: Prelude.Text
}
deriving (DescribeAlias -> DescribeAlias -> Bool
(DescribeAlias -> DescribeAlias -> Bool)
-> (DescribeAlias -> DescribeAlias -> Bool) -> Eq DescribeAlias
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeAlias -> DescribeAlias -> Bool
$c/= :: DescribeAlias -> DescribeAlias -> Bool
== :: DescribeAlias -> DescribeAlias -> Bool
$c== :: DescribeAlias -> DescribeAlias -> Bool
Prelude.Eq, ReadPrec [DescribeAlias]
ReadPrec DescribeAlias
Int -> ReadS DescribeAlias
ReadS [DescribeAlias]
(Int -> ReadS DescribeAlias)
-> ReadS [DescribeAlias]
-> ReadPrec DescribeAlias
-> ReadPrec [DescribeAlias]
-> Read DescribeAlias
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeAlias]
$creadListPrec :: ReadPrec [DescribeAlias]
readPrec :: ReadPrec DescribeAlias
$creadPrec :: ReadPrec DescribeAlias
readList :: ReadS [DescribeAlias]
$creadList :: ReadS [DescribeAlias]
readsPrec :: Int -> ReadS DescribeAlias
$creadsPrec :: Int -> ReadS DescribeAlias
Prelude.Read, Int -> DescribeAlias -> ShowS
[DescribeAlias] -> ShowS
DescribeAlias -> String
(Int -> DescribeAlias -> ShowS)
-> (DescribeAlias -> String)
-> ([DescribeAlias] -> ShowS)
-> Show DescribeAlias
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeAlias] -> ShowS
$cshowList :: [DescribeAlias] -> ShowS
show :: DescribeAlias -> String
$cshow :: DescribeAlias -> String
showsPrec :: Int -> DescribeAlias -> ShowS
$cshowsPrec :: Int -> DescribeAlias -> ShowS
Prelude.Show, (forall x. DescribeAlias -> Rep DescribeAlias x)
-> (forall x. Rep DescribeAlias x -> DescribeAlias)
-> Generic DescribeAlias
forall x. Rep DescribeAlias x -> DescribeAlias
forall x. DescribeAlias -> Rep DescribeAlias x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeAlias x -> DescribeAlias
$cfrom :: forall x. DescribeAlias -> Rep DescribeAlias x
Prelude.Generic)
newDescribeAlias ::
Prelude.Text ->
DescribeAlias
newDescribeAlias :: Text -> DescribeAlias
newDescribeAlias Text
pAliasId_ =
DescribeAlias' :: Text -> DescribeAlias
DescribeAlias' {$sel:aliasId:DescribeAlias' :: Text
aliasId = Text
pAliasId_}
describeAlias_aliasId :: Lens.Lens' DescribeAlias Prelude.Text
describeAlias_aliasId :: (Text -> f Text) -> DescribeAlias -> f DescribeAlias
describeAlias_aliasId = (DescribeAlias -> Text)
-> (DescribeAlias -> Text -> DescribeAlias)
-> Lens DescribeAlias DescribeAlias Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAlias' {Text
aliasId :: Text
$sel:aliasId:DescribeAlias' :: DescribeAlias -> Text
aliasId} -> Text
aliasId) (\s :: DescribeAlias
s@DescribeAlias' {} Text
a -> DescribeAlias
s {$sel:aliasId:DescribeAlias' :: Text
aliasId = Text
a} :: DescribeAlias)
instance Core.AWSRequest DescribeAlias where
type
AWSResponse DescribeAlias =
DescribeAliasResponse
request :: DescribeAlias -> Request DescribeAlias
request = Service -> DescribeAlias -> Request DescribeAlias
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DescribeAlias
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeAlias)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DescribeAlias))
-> Logger
-> Service
-> Proxy DescribeAlias
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeAlias)))
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 -> DescribeAliasResponse
DescribeAliasResponse'
(Maybe Alias -> Int -> DescribeAliasResponse)
-> Either String (Maybe Alias)
-> Either String (Int -> DescribeAliasResponse)
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 -> DescribeAliasResponse)
-> Either String Int -> Either String DescribeAliasResponse
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 DescribeAlias
instance Prelude.NFData DescribeAlias
instance Core.ToHeaders DescribeAlias where
toHeaders :: DescribeAlias -> ResponseHeaders
toHeaders =
ResponseHeaders -> DescribeAlias -> 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.DescribeAlias" :: 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 DescribeAlias where
toJSON :: DescribeAlias -> Value
toJSON DescribeAlias' {Text
aliasId :: Text
$sel:aliasId:DescribeAlias' :: DescribeAlias -> 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 DescribeAlias where
toPath :: DescribeAlias -> ByteString
toPath = ByteString -> DescribeAlias -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DescribeAlias where
toQuery :: DescribeAlias -> QueryString
toQuery = QueryString -> DescribeAlias -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DescribeAliasResponse = DescribeAliasResponse'
{
DescribeAliasResponse -> Maybe Alias
alias :: Prelude.Maybe Alias,
DescribeAliasResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DescribeAliasResponse -> DescribeAliasResponse -> Bool
(DescribeAliasResponse -> DescribeAliasResponse -> Bool)
-> (DescribeAliasResponse -> DescribeAliasResponse -> Bool)
-> Eq DescribeAliasResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeAliasResponse -> DescribeAliasResponse -> Bool
$c/= :: DescribeAliasResponse -> DescribeAliasResponse -> Bool
== :: DescribeAliasResponse -> DescribeAliasResponse -> Bool
$c== :: DescribeAliasResponse -> DescribeAliasResponse -> Bool
Prelude.Eq, ReadPrec [DescribeAliasResponse]
ReadPrec DescribeAliasResponse
Int -> ReadS DescribeAliasResponse
ReadS [DescribeAliasResponse]
(Int -> ReadS DescribeAliasResponse)
-> ReadS [DescribeAliasResponse]
-> ReadPrec DescribeAliasResponse
-> ReadPrec [DescribeAliasResponse]
-> Read DescribeAliasResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeAliasResponse]
$creadListPrec :: ReadPrec [DescribeAliasResponse]
readPrec :: ReadPrec DescribeAliasResponse
$creadPrec :: ReadPrec DescribeAliasResponse
readList :: ReadS [DescribeAliasResponse]
$creadList :: ReadS [DescribeAliasResponse]
readsPrec :: Int -> ReadS DescribeAliasResponse
$creadsPrec :: Int -> ReadS DescribeAliasResponse
Prelude.Read, Int -> DescribeAliasResponse -> ShowS
[DescribeAliasResponse] -> ShowS
DescribeAliasResponse -> String
(Int -> DescribeAliasResponse -> ShowS)
-> (DescribeAliasResponse -> String)
-> ([DescribeAliasResponse] -> ShowS)
-> Show DescribeAliasResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeAliasResponse] -> ShowS
$cshowList :: [DescribeAliasResponse] -> ShowS
show :: DescribeAliasResponse -> String
$cshow :: DescribeAliasResponse -> String
showsPrec :: Int -> DescribeAliasResponse -> ShowS
$cshowsPrec :: Int -> DescribeAliasResponse -> ShowS
Prelude.Show, (forall x. DescribeAliasResponse -> Rep DescribeAliasResponse x)
-> (forall x. Rep DescribeAliasResponse x -> DescribeAliasResponse)
-> Generic DescribeAliasResponse
forall x. Rep DescribeAliasResponse x -> DescribeAliasResponse
forall x. DescribeAliasResponse -> Rep DescribeAliasResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeAliasResponse x -> DescribeAliasResponse
$cfrom :: forall x. DescribeAliasResponse -> Rep DescribeAliasResponse x
Prelude.Generic)
newDescribeAliasResponse ::
Prelude.Int ->
DescribeAliasResponse
newDescribeAliasResponse :: Int -> DescribeAliasResponse
newDescribeAliasResponse Int
pHttpStatus_ =
DescribeAliasResponse' :: Maybe Alias -> Int -> DescribeAliasResponse
DescribeAliasResponse'
{ $sel:alias:DescribeAliasResponse' :: Maybe Alias
alias = Maybe Alias
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DescribeAliasResponse' :: Int
httpStatus = Int
pHttpStatus_
}
describeAliasResponse_alias :: Lens.Lens' DescribeAliasResponse (Prelude.Maybe Alias)
describeAliasResponse_alias :: (Maybe Alias -> f (Maybe Alias))
-> DescribeAliasResponse -> f DescribeAliasResponse
describeAliasResponse_alias = (DescribeAliasResponse -> Maybe Alias)
-> (DescribeAliasResponse -> Maybe Alias -> DescribeAliasResponse)
-> Lens
DescribeAliasResponse
DescribeAliasResponse
(Maybe Alias)
(Maybe Alias)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAliasResponse' {Maybe Alias
alias :: Maybe Alias
$sel:alias:DescribeAliasResponse' :: DescribeAliasResponse -> Maybe Alias
alias} -> Maybe Alias
alias) (\s :: DescribeAliasResponse
s@DescribeAliasResponse' {} Maybe Alias
a -> DescribeAliasResponse
s {$sel:alias:DescribeAliasResponse' :: Maybe Alias
alias = Maybe Alias
a} :: DescribeAliasResponse)
describeAliasResponse_httpStatus :: Lens.Lens' DescribeAliasResponse Prelude.Int
describeAliasResponse_httpStatus :: (Int -> f Int) -> DescribeAliasResponse -> f DescribeAliasResponse
describeAliasResponse_httpStatus = (DescribeAliasResponse -> Int)
-> (DescribeAliasResponse -> Int -> DescribeAliasResponse)
-> Lens DescribeAliasResponse DescribeAliasResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAliasResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeAliasResponse' :: DescribeAliasResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeAliasResponse
s@DescribeAliasResponse' {} Int
a -> DescribeAliasResponse
s {$sel:httpStatus:DescribeAliasResponse' :: Int
httpStatus = Int
a} :: DescribeAliasResponse)
instance Prelude.NFData DescribeAliasResponse