{-# 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.GetInstanceAccess
(
GetInstanceAccess (..),
newGetInstanceAccess,
getInstanceAccess_fleetId,
getInstanceAccess_instanceId,
GetInstanceAccessResponse (..),
newGetInstanceAccessResponse,
getInstanceAccessResponse_instanceAccess,
getInstanceAccessResponse_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 GetInstanceAccess = GetInstanceAccess'
{
GetInstanceAccess -> Text
fleetId :: Prelude.Text,
GetInstanceAccess -> Text
instanceId :: Prelude.Text
}
deriving (GetInstanceAccess -> GetInstanceAccess -> Bool
(GetInstanceAccess -> GetInstanceAccess -> Bool)
-> (GetInstanceAccess -> GetInstanceAccess -> Bool)
-> Eq GetInstanceAccess
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetInstanceAccess -> GetInstanceAccess -> Bool
$c/= :: GetInstanceAccess -> GetInstanceAccess -> Bool
== :: GetInstanceAccess -> GetInstanceAccess -> Bool
$c== :: GetInstanceAccess -> GetInstanceAccess -> Bool
Prelude.Eq, ReadPrec [GetInstanceAccess]
ReadPrec GetInstanceAccess
Int -> ReadS GetInstanceAccess
ReadS [GetInstanceAccess]
(Int -> ReadS GetInstanceAccess)
-> ReadS [GetInstanceAccess]
-> ReadPrec GetInstanceAccess
-> ReadPrec [GetInstanceAccess]
-> Read GetInstanceAccess
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetInstanceAccess]
$creadListPrec :: ReadPrec [GetInstanceAccess]
readPrec :: ReadPrec GetInstanceAccess
$creadPrec :: ReadPrec GetInstanceAccess
readList :: ReadS [GetInstanceAccess]
$creadList :: ReadS [GetInstanceAccess]
readsPrec :: Int -> ReadS GetInstanceAccess
$creadsPrec :: Int -> ReadS GetInstanceAccess
Prelude.Read, Int -> GetInstanceAccess -> ShowS
[GetInstanceAccess] -> ShowS
GetInstanceAccess -> String
(Int -> GetInstanceAccess -> ShowS)
-> (GetInstanceAccess -> String)
-> ([GetInstanceAccess] -> ShowS)
-> Show GetInstanceAccess
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetInstanceAccess] -> ShowS
$cshowList :: [GetInstanceAccess] -> ShowS
show :: GetInstanceAccess -> String
$cshow :: GetInstanceAccess -> String
showsPrec :: Int -> GetInstanceAccess -> ShowS
$cshowsPrec :: Int -> GetInstanceAccess -> ShowS
Prelude.Show, (forall x. GetInstanceAccess -> Rep GetInstanceAccess x)
-> (forall x. Rep GetInstanceAccess x -> GetInstanceAccess)
-> Generic GetInstanceAccess
forall x. Rep GetInstanceAccess x -> GetInstanceAccess
forall x. GetInstanceAccess -> Rep GetInstanceAccess x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetInstanceAccess x -> GetInstanceAccess
$cfrom :: forall x. GetInstanceAccess -> Rep GetInstanceAccess x
Prelude.Generic)
newGetInstanceAccess ::
Prelude.Text ->
Prelude.Text ->
GetInstanceAccess
newGetInstanceAccess :: Text -> Text -> GetInstanceAccess
newGetInstanceAccess Text
pFleetId_ Text
pInstanceId_ =
GetInstanceAccess' :: Text -> Text -> GetInstanceAccess
GetInstanceAccess'
{ $sel:fleetId:GetInstanceAccess' :: Text
fleetId = Text
pFleetId_,
$sel:instanceId:GetInstanceAccess' :: Text
instanceId = Text
pInstanceId_
}
getInstanceAccess_fleetId :: Lens.Lens' GetInstanceAccess Prelude.Text
getInstanceAccess_fleetId :: (Text -> f Text) -> GetInstanceAccess -> f GetInstanceAccess
getInstanceAccess_fleetId = (GetInstanceAccess -> Text)
-> (GetInstanceAccess -> Text -> GetInstanceAccess)
-> Lens GetInstanceAccess GetInstanceAccess Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInstanceAccess' {Text
fleetId :: Text
$sel:fleetId:GetInstanceAccess' :: GetInstanceAccess -> Text
fleetId} -> Text
fleetId) (\s :: GetInstanceAccess
s@GetInstanceAccess' {} Text
a -> GetInstanceAccess
s {$sel:fleetId:GetInstanceAccess' :: Text
fleetId = Text
a} :: GetInstanceAccess)
getInstanceAccess_instanceId :: Lens.Lens' GetInstanceAccess Prelude.Text
getInstanceAccess_instanceId :: (Text -> f Text) -> GetInstanceAccess -> f GetInstanceAccess
getInstanceAccess_instanceId = (GetInstanceAccess -> Text)
-> (GetInstanceAccess -> Text -> GetInstanceAccess)
-> Lens GetInstanceAccess GetInstanceAccess Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInstanceAccess' {Text
instanceId :: Text
$sel:instanceId:GetInstanceAccess' :: GetInstanceAccess -> Text
instanceId} -> Text
instanceId) (\s :: GetInstanceAccess
s@GetInstanceAccess' {} Text
a -> GetInstanceAccess
s {$sel:instanceId:GetInstanceAccess' :: Text
instanceId = Text
a} :: GetInstanceAccess)
instance Core.AWSRequest GetInstanceAccess where
type
AWSResponse GetInstanceAccess =
GetInstanceAccessResponse
request :: GetInstanceAccess -> Request GetInstanceAccess
request = Service -> GetInstanceAccess -> Request GetInstanceAccess
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetInstanceAccess
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetInstanceAccess)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetInstanceAccess))
-> Logger
-> Service
-> Proxy GetInstanceAccess
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetInstanceAccess)))
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 InstanceAccess -> Int -> GetInstanceAccessResponse
GetInstanceAccessResponse'
(Maybe InstanceAccess -> Int -> GetInstanceAccessResponse)
-> Either String (Maybe InstanceAccess)
-> Either String (Int -> GetInstanceAccessResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe InstanceAccess)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"InstanceAccess")
Either String (Int -> GetInstanceAccessResponse)
-> Either String Int -> Either String GetInstanceAccessResponse
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 GetInstanceAccess
instance Prelude.NFData GetInstanceAccess
instance Core.ToHeaders GetInstanceAccess where
toHeaders :: GetInstanceAccess -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetInstanceAccess -> 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.GetInstanceAccess" :: 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 GetInstanceAccess where
toJSON :: GetInstanceAccess -> Value
toJSON GetInstanceAccess' {Text
instanceId :: Text
fleetId :: Text
$sel:instanceId:GetInstanceAccess' :: GetInstanceAccess -> Text
$sel:fleetId:GetInstanceAccess' :: GetInstanceAccess -> 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
"FleetId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
fleetId),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"InstanceId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
instanceId)
]
)
instance Core.ToPath GetInstanceAccess where
toPath :: GetInstanceAccess -> ByteString
toPath = ByteString -> GetInstanceAccess -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetInstanceAccess where
toQuery :: GetInstanceAccess -> QueryString
toQuery = QueryString -> GetInstanceAccess -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetInstanceAccessResponse = GetInstanceAccessResponse'
{
GetInstanceAccessResponse -> Maybe InstanceAccess
instanceAccess :: Prelude.Maybe InstanceAccess,
GetInstanceAccessResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetInstanceAccessResponse -> GetInstanceAccessResponse -> Bool
(GetInstanceAccessResponse -> GetInstanceAccessResponse -> Bool)
-> (GetInstanceAccessResponse -> GetInstanceAccessResponse -> Bool)
-> Eq GetInstanceAccessResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetInstanceAccessResponse -> GetInstanceAccessResponse -> Bool
$c/= :: GetInstanceAccessResponse -> GetInstanceAccessResponse -> Bool
== :: GetInstanceAccessResponse -> GetInstanceAccessResponse -> Bool
$c== :: GetInstanceAccessResponse -> GetInstanceAccessResponse -> Bool
Prelude.Eq, Int -> GetInstanceAccessResponse -> ShowS
[GetInstanceAccessResponse] -> ShowS
GetInstanceAccessResponse -> String
(Int -> GetInstanceAccessResponse -> ShowS)
-> (GetInstanceAccessResponse -> String)
-> ([GetInstanceAccessResponse] -> ShowS)
-> Show GetInstanceAccessResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetInstanceAccessResponse] -> ShowS
$cshowList :: [GetInstanceAccessResponse] -> ShowS
show :: GetInstanceAccessResponse -> String
$cshow :: GetInstanceAccessResponse -> String
showsPrec :: Int -> GetInstanceAccessResponse -> ShowS
$cshowsPrec :: Int -> GetInstanceAccessResponse -> ShowS
Prelude.Show, (forall x.
GetInstanceAccessResponse -> Rep GetInstanceAccessResponse x)
-> (forall x.
Rep GetInstanceAccessResponse x -> GetInstanceAccessResponse)
-> Generic GetInstanceAccessResponse
forall x.
Rep GetInstanceAccessResponse x -> GetInstanceAccessResponse
forall x.
GetInstanceAccessResponse -> Rep GetInstanceAccessResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetInstanceAccessResponse x -> GetInstanceAccessResponse
$cfrom :: forall x.
GetInstanceAccessResponse -> Rep GetInstanceAccessResponse x
Prelude.Generic)
newGetInstanceAccessResponse ::
Prelude.Int ->
GetInstanceAccessResponse
newGetInstanceAccessResponse :: Int -> GetInstanceAccessResponse
newGetInstanceAccessResponse Int
pHttpStatus_ =
GetInstanceAccessResponse' :: Maybe InstanceAccess -> Int -> GetInstanceAccessResponse
GetInstanceAccessResponse'
{ $sel:instanceAccess:GetInstanceAccessResponse' :: Maybe InstanceAccess
instanceAccess =
Maybe InstanceAccess
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetInstanceAccessResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getInstanceAccessResponse_instanceAccess :: Lens.Lens' GetInstanceAccessResponse (Prelude.Maybe InstanceAccess)
getInstanceAccessResponse_instanceAccess :: (Maybe InstanceAccess -> f (Maybe InstanceAccess))
-> GetInstanceAccessResponse -> f GetInstanceAccessResponse
getInstanceAccessResponse_instanceAccess = (GetInstanceAccessResponse -> Maybe InstanceAccess)
-> (GetInstanceAccessResponse
-> Maybe InstanceAccess -> GetInstanceAccessResponse)
-> Lens
GetInstanceAccessResponse
GetInstanceAccessResponse
(Maybe InstanceAccess)
(Maybe InstanceAccess)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInstanceAccessResponse' {Maybe InstanceAccess
instanceAccess :: Maybe InstanceAccess
$sel:instanceAccess:GetInstanceAccessResponse' :: GetInstanceAccessResponse -> Maybe InstanceAccess
instanceAccess} -> Maybe InstanceAccess
instanceAccess) (\s :: GetInstanceAccessResponse
s@GetInstanceAccessResponse' {} Maybe InstanceAccess
a -> GetInstanceAccessResponse
s {$sel:instanceAccess:GetInstanceAccessResponse' :: Maybe InstanceAccess
instanceAccess = Maybe InstanceAccess
a} :: GetInstanceAccessResponse)
getInstanceAccessResponse_httpStatus :: Lens.Lens' GetInstanceAccessResponse Prelude.Int
getInstanceAccessResponse_httpStatus :: (Int -> f Int)
-> GetInstanceAccessResponse -> f GetInstanceAccessResponse
getInstanceAccessResponse_httpStatus = (GetInstanceAccessResponse -> Int)
-> (GetInstanceAccessResponse -> Int -> GetInstanceAccessResponse)
-> Lens GetInstanceAccessResponse GetInstanceAccessResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInstanceAccessResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetInstanceAccessResponse' :: GetInstanceAccessResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetInstanceAccessResponse
s@GetInstanceAccessResponse' {} Int
a -> GetInstanceAccessResponse
s {$sel:httpStatus:GetInstanceAccessResponse' :: Int
httpStatus = Int
a} :: GetInstanceAccessResponse)
instance Prelude.NFData GetInstanceAccessResponse