{-# 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.RequestUploadCredentials
(
RequestUploadCredentials (..),
newRequestUploadCredentials,
requestUploadCredentials_buildId,
RequestUploadCredentialsResponse (..),
newRequestUploadCredentialsResponse,
requestUploadCredentialsResponse_storageLocation,
requestUploadCredentialsResponse_uploadCredentials,
requestUploadCredentialsResponse_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 RequestUploadCredentials = RequestUploadCredentials'
{
RequestUploadCredentials -> Text
buildId :: Prelude.Text
}
deriving (RequestUploadCredentials -> RequestUploadCredentials -> Bool
(RequestUploadCredentials -> RequestUploadCredentials -> Bool)
-> (RequestUploadCredentials -> RequestUploadCredentials -> Bool)
-> Eq RequestUploadCredentials
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RequestUploadCredentials -> RequestUploadCredentials -> Bool
$c/= :: RequestUploadCredentials -> RequestUploadCredentials -> Bool
== :: RequestUploadCredentials -> RequestUploadCredentials -> Bool
$c== :: RequestUploadCredentials -> RequestUploadCredentials -> Bool
Prelude.Eq, ReadPrec [RequestUploadCredentials]
ReadPrec RequestUploadCredentials
Int -> ReadS RequestUploadCredentials
ReadS [RequestUploadCredentials]
(Int -> ReadS RequestUploadCredentials)
-> ReadS [RequestUploadCredentials]
-> ReadPrec RequestUploadCredentials
-> ReadPrec [RequestUploadCredentials]
-> Read RequestUploadCredentials
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RequestUploadCredentials]
$creadListPrec :: ReadPrec [RequestUploadCredentials]
readPrec :: ReadPrec RequestUploadCredentials
$creadPrec :: ReadPrec RequestUploadCredentials
readList :: ReadS [RequestUploadCredentials]
$creadList :: ReadS [RequestUploadCredentials]
readsPrec :: Int -> ReadS RequestUploadCredentials
$creadsPrec :: Int -> ReadS RequestUploadCredentials
Prelude.Read, Int -> RequestUploadCredentials -> ShowS
[RequestUploadCredentials] -> ShowS
RequestUploadCredentials -> String
(Int -> RequestUploadCredentials -> ShowS)
-> (RequestUploadCredentials -> String)
-> ([RequestUploadCredentials] -> ShowS)
-> Show RequestUploadCredentials
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RequestUploadCredentials] -> ShowS
$cshowList :: [RequestUploadCredentials] -> ShowS
show :: RequestUploadCredentials -> String
$cshow :: RequestUploadCredentials -> String
showsPrec :: Int -> RequestUploadCredentials -> ShowS
$cshowsPrec :: Int -> RequestUploadCredentials -> ShowS
Prelude.Show, (forall x.
RequestUploadCredentials -> Rep RequestUploadCredentials x)
-> (forall x.
Rep RequestUploadCredentials x -> RequestUploadCredentials)
-> Generic RequestUploadCredentials
forall x.
Rep RequestUploadCredentials x -> RequestUploadCredentials
forall x.
RequestUploadCredentials -> Rep RequestUploadCredentials x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep RequestUploadCredentials x -> RequestUploadCredentials
$cfrom :: forall x.
RequestUploadCredentials -> Rep RequestUploadCredentials x
Prelude.Generic)
newRequestUploadCredentials ::
Prelude.Text ->
RequestUploadCredentials
newRequestUploadCredentials :: Text -> RequestUploadCredentials
newRequestUploadCredentials Text
pBuildId_ =
RequestUploadCredentials' :: Text -> RequestUploadCredentials
RequestUploadCredentials' {$sel:buildId:RequestUploadCredentials' :: Text
buildId = Text
pBuildId_}
requestUploadCredentials_buildId :: Lens.Lens' RequestUploadCredentials Prelude.Text
requestUploadCredentials_buildId :: (Text -> f Text)
-> RequestUploadCredentials -> f RequestUploadCredentials
requestUploadCredentials_buildId = (RequestUploadCredentials -> Text)
-> (RequestUploadCredentials -> Text -> RequestUploadCredentials)
-> Lens RequestUploadCredentials RequestUploadCredentials Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RequestUploadCredentials' {Text
buildId :: Text
$sel:buildId:RequestUploadCredentials' :: RequestUploadCredentials -> Text
buildId} -> Text
buildId) (\s :: RequestUploadCredentials
s@RequestUploadCredentials' {} Text
a -> RequestUploadCredentials
s {$sel:buildId:RequestUploadCredentials' :: Text
buildId = Text
a} :: RequestUploadCredentials)
instance Core.AWSRequest RequestUploadCredentials where
type
AWSResponse RequestUploadCredentials =
RequestUploadCredentialsResponse
request :: RequestUploadCredentials -> Request RequestUploadCredentials
request = Service
-> RequestUploadCredentials -> Request RequestUploadCredentials
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy RequestUploadCredentials
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse RequestUploadCredentials)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse RequestUploadCredentials))
-> Logger
-> Service
-> Proxy RequestUploadCredentials
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse RequestUploadCredentials)))
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 S3Location
-> Maybe (Sensitive AwsCredentials)
-> Int
-> RequestUploadCredentialsResponse
RequestUploadCredentialsResponse'
(Maybe S3Location
-> Maybe (Sensitive AwsCredentials)
-> Int
-> RequestUploadCredentialsResponse)
-> Either String (Maybe S3Location)
-> Either
String
(Maybe (Sensitive AwsCredentials)
-> Int -> RequestUploadCredentialsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe S3Location)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"StorageLocation")
Either
String
(Maybe (Sensitive AwsCredentials)
-> Int -> RequestUploadCredentialsResponse)
-> Either String (Maybe (Sensitive AwsCredentials))
-> Either String (Int -> RequestUploadCredentialsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe (Sensitive AwsCredentials))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"UploadCredentials")
Either String (Int -> RequestUploadCredentialsResponse)
-> Either String Int
-> Either String RequestUploadCredentialsResponse
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 RequestUploadCredentials
instance Prelude.NFData RequestUploadCredentials
instance Core.ToHeaders RequestUploadCredentials where
toHeaders :: RequestUploadCredentials -> ResponseHeaders
toHeaders =
ResponseHeaders -> RequestUploadCredentials -> 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.RequestUploadCredentials" ::
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 RequestUploadCredentials where
toJSON :: RequestUploadCredentials -> Value
toJSON RequestUploadCredentials' {Text
buildId :: Text
$sel:buildId:RequestUploadCredentials' :: RequestUploadCredentials -> 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
"BuildId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
buildId)]
)
instance Core.ToPath RequestUploadCredentials where
toPath :: RequestUploadCredentials -> ByteString
toPath = ByteString -> RequestUploadCredentials -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery RequestUploadCredentials where
toQuery :: RequestUploadCredentials -> QueryString
toQuery = QueryString -> RequestUploadCredentials -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data RequestUploadCredentialsResponse = RequestUploadCredentialsResponse'
{
RequestUploadCredentialsResponse -> Maybe S3Location
storageLocation :: Prelude.Maybe S3Location,
RequestUploadCredentialsResponse
-> Maybe (Sensitive AwsCredentials)
uploadCredentials :: Prelude.Maybe (Core.Sensitive AwsCredentials),
RequestUploadCredentialsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (RequestUploadCredentialsResponse
-> RequestUploadCredentialsResponse -> Bool
(RequestUploadCredentialsResponse
-> RequestUploadCredentialsResponse -> Bool)
-> (RequestUploadCredentialsResponse
-> RequestUploadCredentialsResponse -> Bool)
-> Eq RequestUploadCredentialsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RequestUploadCredentialsResponse
-> RequestUploadCredentialsResponse -> Bool
$c/= :: RequestUploadCredentialsResponse
-> RequestUploadCredentialsResponse -> Bool
== :: RequestUploadCredentialsResponse
-> RequestUploadCredentialsResponse -> Bool
$c== :: RequestUploadCredentialsResponse
-> RequestUploadCredentialsResponse -> Bool
Prelude.Eq, Int -> RequestUploadCredentialsResponse -> ShowS
[RequestUploadCredentialsResponse] -> ShowS
RequestUploadCredentialsResponse -> String
(Int -> RequestUploadCredentialsResponse -> ShowS)
-> (RequestUploadCredentialsResponse -> String)
-> ([RequestUploadCredentialsResponse] -> ShowS)
-> Show RequestUploadCredentialsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RequestUploadCredentialsResponse] -> ShowS
$cshowList :: [RequestUploadCredentialsResponse] -> ShowS
show :: RequestUploadCredentialsResponse -> String
$cshow :: RequestUploadCredentialsResponse -> String
showsPrec :: Int -> RequestUploadCredentialsResponse -> ShowS
$cshowsPrec :: Int -> RequestUploadCredentialsResponse -> ShowS
Prelude.Show, (forall x.
RequestUploadCredentialsResponse
-> Rep RequestUploadCredentialsResponse x)
-> (forall x.
Rep RequestUploadCredentialsResponse x
-> RequestUploadCredentialsResponse)
-> Generic RequestUploadCredentialsResponse
forall x.
Rep RequestUploadCredentialsResponse x
-> RequestUploadCredentialsResponse
forall x.
RequestUploadCredentialsResponse
-> Rep RequestUploadCredentialsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep RequestUploadCredentialsResponse x
-> RequestUploadCredentialsResponse
$cfrom :: forall x.
RequestUploadCredentialsResponse
-> Rep RequestUploadCredentialsResponse x
Prelude.Generic)
newRequestUploadCredentialsResponse ::
Prelude.Int ->
RequestUploadCredentialsResponse
newRequestUploadCredentialsResponse :: Int -> RequestUploadCredentialsResponse
newRequestUploadCredentialsResponse Int
pHttpStatus_ =
RequestUploadCredentialsResponse' :: Maybe S3Location
-> Maybe (Sensitive AwsCredentials)
-> Int
-> RequestUploadCredentialsResponse
RequestUploadCredentialsResponse'
{ $sel:storageLocation:RequestUploadCredentialsResponse' :: Maybe S3Location
storageLocation =
Maybe S3Location
forall a. Maybe a
Prelude.Nothing,
$sel:uploadCredentials:RequestUploadCredentialsResponse' :: Maybe (Sensitive AwsCredentials)
uploadCredentials = Maybe (Sensitive AwsCredentials)
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:RequestUploadCredentialsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
requestUploadCredentialsResponse_storageLocation :: Lens.Lens' RequestUploadCredentialsResponse (Prelude.Maybe S3Location)
requestUploadCredentialsResponse_storageLocation :: (Maybe S3Location -> f (Maybe S3Location))
-> RequestUploadCredentialsResponse
-> f RequestUploadCredentialsResponse
requestUploadCredentialsResponse_storageLocation = (RequestUploadCredentialsResponse -> Maybe S3Location)
-> (RequestUploadCredentialsResponse
-> Maybe S3Location -> RequestUploadCredentialsResponse)
-> Lens
RequestUploadCredentialsResponse
RequestUploadCredentialsResponse
(Maybe S3Location)
(Maybe S3Location)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RequestUploadCredentialsResponse' {Maybe S3Location
storageLocation :: Maybe S3Location
$sel:storageLocation:RequestUploadCredentialsResponse' :: RequestUploadCredentialsResponse -> Maybe S3Location
storageLocation} -> Maybe S3Location
storageLocation) (\s :: RequestUploadCredentialsResponse
s@RequestUploadCredentialsResponse' {} Maybe S3Location
a -> RequestUploadCredentialsResponse
s {$sel:storageLocation:RequestUploadCredentialsResponse' :: Maybe S3Location
storageLocation = Maybe S3Location
a} :: RequestUploadCredentialsResponse)
requestUploadCredentialsResponse_uploadCredentials :: Lens.Lens' RequestUploadCredentialsResponse (Prelude.Maybe AwsCredentials)
requestUploadCredentialsResponse_uploadCredentials :: (Maybe AwsCredentials -> f (Maybe AwsCredentials))
-> RequestUploadCredentialsResponse
-> f RequestUploadCredentialsResponse
requestUploadCredentialsResponse_uploadCredentials = (RequestUploadCredentialsResponse
-> Maybe (Sensitive AwsCredentials))
-> (RequestUploadCredentialsResponse
-> Maybe (Sensitive AwsCredentials)
-> RequestUploadCredentialsResponse)
-> Lens
RequestUploadCredentialsResponse
RequestUploadCredentialsResponse
(Maybe (Sensitive AwsCredentials))
(Maybe (Sensitive AwsCredentials))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RequestUploadCredentialsResponse' {Maybe (Sensitive AwsCredentials)
uploadCredentials :: Maybe (Sensitive AwsCredentials)
$sel:uploadCredentials:RequestUploadCredentialsResponse' :: RequestUploadCredentialsResponse
-> Maybe (Sensitive AwsCredentials)
uploadCredentials} -> Maybe (Sensitive AwsCredentials)
uploadCredentials) (\s :: RequestUploadCredentialsResponse
s@RequestUploadCredentialsResponse' {} Maybe (Sensitive AwsCredentials)
a -> RequestUploadCredentialsResponse
s {$sel:uploadCredentials:RequestUploadCredentialsResponse' :: Maybe (Sensitive AwsCredentials)
uploadCredentials = Maybe (Sensitive AwsCredentials)
a} :: RequestUploadCredentialsResponse) ((Maybe (Sensitive AwsCredentials)
-> f (Maybe (Sensitive AwsCredentials)))
-> RequestUploadCredentialsResponse
-> f RequestUploadCredentialsResponse)
-> ((Maybe AwsCredentials -> f (Maybe AwsCredentials))
-> Maybe (Sensitive AwsCredentials)
-> f (Maybe (Sensitive AwsCredentials)))
-> (Maybe AwsCredentials -> f (Maybe AwsCredentials))
-> RequestUploadCredentialsResponse
-> f RequestUploadCredentialsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(Sensitive AwsCredentials)
(Sensitive AwsCredentials)
AwsCredentials
AwsCredentials
-> Iso
(Maybe (Sensitive AwsCredentials))
(Maybe (Sensitive AwsCredentials))
(Maybe AwsCredentials)
(Maybe AwsCredentials)
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
(Sensitive AwsCredentials)
(Sensitive AwsCredentials)
AwsCredentials
AwsCredentials
forall a. Iso' (Sensitive a) a
Core._Sensitive
requestUploadCredentialsResponse_httpStatus :: Lens.Lens' RequestUploadCredentialsResponse Prelude.Int
requestUploadCredentialsResponse_httpStatus :: (Int -> f Int)
-> RequestUploadCredentialsResponse
-> f RequestUploadCredentialsResponse
requestUploadCredentialsResponse_httpStatus = (RequestUploadCredentialsResponse -> Int)
-> (RequestUploadCredentialsResponse
-> Int -> RequestUploadCredentialsResponse)
-> Lens
RequestUploadCredentialsResponse
RequestUploadCredentialsResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RequestUploadCredentialsResponse' {Int
httpStatus :: Int
$sel:httpStatus:RequestUploadCredentialsResponse' :: RequestUploadCredentialsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: RequestUploadCredentialsResponse
s@RequestUploadCredentialsResponse' {} Int
a -> RequestUploadCredentialsResponse
s {$sel:httpStatus:RequestUploadCredentialsResponse' :: Int
httpStatus = Int
a} :: RequestUploadCredentialsResponse)
instance
Prelude.NFData
RequestUploadCredentialsResponse