{-# 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.UpdateScript
(
UpdateScript (..),
newUpdateScript,
updateScript_storageLocation,
updateScript_zipFile,
updateScript_name,
updateScript_version,
updateScript_scriptId,
UpdateScriptResponse (..),
newUpdateScriptResponse,
updateScriptResponse_script,
updateScriptResponse_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 UpdateScript = UpdateScript'
{
UpdateScript -> Maybe S3Location
storageLocation :: Prelude.Maybe S3Location,
UpdateScript -> Maybe Base64
zipFile :: Prelude.Maybe Core.Base64,
UpdateScript -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
UpdateScript -> Maybe Text
version :: Prelude.Maybe Prelude.Text,
UpdateScript -> Text
scriptId :: Prelude.Text
}
deriving (UpdateScript -> UpdateScript -> Bool
(UpdateScript -> UpdateScript -> Bool)
-> (UpdateScript -> UpdateScript -> Bool) -> Eq UpdateScript
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateScript -> UpdateScript -> Bool
$c/= :: UpdateScript -> UpdateScript -> Bool
== :: UpdateScript -> UpdateScript -> Bool
$c== :: UpdateScript -> UpdateScript -> Bool
Prelude.Eq, ReadPrec [UpdateScript]
ReadPrec UpdateScript
Int -> ReadS UpdateScript
ReadS [UpdateScript]
(Int -> ReadS UpdateScript)
-> ReadS [UpdateScript]
-> ReadPrec UpdateScript
-> ReadPrec [UpdateScript]
-> Read UpdateScript
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateScript]
$creadListPrec :: ReadPrec [UpdateScript]
readPrec :: ReadPrec UpdateScript
$creadPrec :: ReadPrec UpdateScript
readList :: ReadS [UpdateScript]
$creadList :: ReadS [UpdateScript]
readsPrec :: Int -> ReadS UpdateScript
$creadsPrec :: Int -> ReadS UpdateScript
Prelude.Read, Int -> UpdateScript -> ShowS
[UpdateScript] -> ShowS
UpdateScript -> String
(Int -> UpdateScript -> ShowS)
-> (UpdateScript -> String)
-> ([UpdateScript] -> ShowS)
-> Show UpdateScript
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateScript] -> ShowS
$cshowList :: [UpdateScript] -> ShowS
show :: UpdateScript -> String
$cshow :: UpdateScript -> String
showsPrec :: Int -> UpdateScript -> ShowS
$cshowsPrec :: Int -> UpdateScript -> ShowS
Prelude.Show, (forall x. UpdateScript -> Rep UpdateScript x)
-> (forall x. Rep UpdateScript x -> UpdateScript)
-> Generic UpdateScript
forall x. Rep UpdateScript x -> UpdateScript
forall x. UpdateScript -> Rep UpdateScript x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateScript x -> UpdateScript
$cfrom :: forall x. UpdateScript -> Rep UpdateScript x
Prelude.Generic)
newUpdateScript ::
Prelude.Text ->
UpdateScript
newUpdateScript :: Text -> UpdateScript
newUpdateScript Text
pScriptId_ =
UpdateScript' :: Maybe S3Location
-> Maybe Base64 -> Maybe Text -> Maybe Text -> Text -> UpdateScript
UpdateScript'
{ $sel:storageLocation:UpdateScript' :: Maybe S3Location
storageLocation = Maybe S3Location
forall a. Maybe a
Prelude.Nothing,
$sel:zipFile:UpdateScript' :: Maybe Base64
zipFile = Maybe Base64
forall a. Maybe a
Prelude.Nothing,
$sel:name:UpdateScript' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:version:UpdateScript' :: Maybe Text
version = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:scriptId:UpdateScript' :: Text
scriptId = Text
pScriptId_
}
updateScript_storageLocation :: Lens.Lens' UpdateScript (Prelude.Maybe S3Location)
updateScript_storageLocation :: (Maybe S3Location -> f (Maybe S3Location))
-> UpdateScript -> f UpdateScript
updateScript_storageLocation = (UpdateScript -> Maybe S3Location)
-> (UpdateScript -> Maybe S3Location -> UpdateScript)
-> Lens
UpdateScript UpdateScript (Maybe S3Location) (Maybe S3Location)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateScript' {Maybe S3Location
storageLocation :: Maybe S3Location
$sel:storageLocation:UpdateScript' :: UpdateScript -> Maybe S3Location
storageLocation} -> Maybe S3Location
storageLocation) (\s :: UpdateScript
s@UpdateScript' {} Maybe S3Location
a -> UpdateScript
s {$sel:storageLocation:UpdateScript' :: Maybe S3Location
storageLocation = Maybe S3Location
a} :: UpdateScript)
updateScript_zipFile :: Lens.Lens' UpdateScript (Prelude.Maybe Prelude.ByteString)
updateScript_zipFile :: (Maybe ByteString -> f (Maybe ByteString))
-> UpdateScript -> f UpdateScript
updateScript_zipFile = (UpdateScript -> Maybe Base64)
-> (UpdateScript -> Maybe Base64 -> UpdateScript)
-> Lens UpdateScript UpdateScript (Maybe Base64) (Maybe Base64)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateScript' {Maybe Base64
zipFile :: Maybe Base64
$sel:zipFile:UpdateScript' :: UpdateScript -> Maybe Base64
zipFile} -> Maybe Base64
zipFile) (\s :: UpdateScript
s@UpdateScript' {} Maybe Base64
a -> UpdateScript
s {$sel:zipFile:UpdateScript' :: Maybe Base64
zipFile = Maybe Base64
a} :: UpdateScript) ((Maybe Base64 -> f (Maybe Base64))
-> UpdateScript -> f UpdateScript)
-> ((Maybe ByteString -> f (Maybe ByteString))
-> Maybe Base64 -> f (Maybe Base64))
-> (Maybe ByteString -> f (Maybe ByteString))
-> UpdateScript
-> f UpdateScript
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso Base64 Base64 ByteString ByteString
-> Iso
(Maybe Base64) (Maybe Base64) (Maybe ByteString) (Maybe ByteString)
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 Base64 Base64 ByteString ByteString
Iso' Base64 ByteString
Core._Base64
updateScript_name :: Lens.Lens' UpdateScript (Prelude.Maybe Prelude.Text)
updateScript_name :: (Maybe Text -> f (Maybe Text)) -> UpdateScript -> f UpdateScript
updateScript_name = (UpdateScript -> Maybe Text)
-> (UpdateScript -> Maybe Text -> UpdateScript)
-> Lens UpdateScript UpdateScript (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateScript' {Maybe Text
name :: Maybe Text
$sel:name:UpdateScript' :: UpdateScript -> Maybe Text
name} -> Maybe Text
name) (\s :: UpdateScript
s@UpdateScript' {} Maybe Text
a -> UpdateScript
s {$sel:name:UpdateScript' :: Maybe Text
name = Maybe Text
a} :: UpdateScript)
updateScript_version :: Lens.Lens' UpdateScript (Prelude.Maybe Prelude.Text)
updateScript_version :: (Maybe Text -> f (Maybe Text)) -> UpdateScript -> f UpdateScript
updateScript_version = (UpdateScript -> Maybe Text)
-> (UpdateScript -> Maybe Text -> UpdateScript)
-> Lens UpdateScript UpdateScript (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateScript' {Maybe Text
version :: Maybe Text
$sel:version:UpdateScript' :: UpdateScript -> Maybe Text
version} -> Maybe Text
version) (\s :: UpdateScript
s@UpdateScript' {} Maybe Text
a -> UpdateScript
s {$sel:version:UpdateScript' :: Maybe Text
version = Maybe Text
a} :: UpdateScript)
updateScript_scriptId :: Lens.Lens' UpdateScript Prelude.Text
updateScript_scriptId :: (Text -> f Text) -> UpdateScript -> f UpdateScript
updateScript_scriptId = (UpdateScript -> Text)
-> (UpdateScript -> Text -> UpdateScript)
-> Lens UpdateScript UpdateScript Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateScript' {Text
scriptId :: Text
$sel:scriptId:UpdateScript' :: UpdateScript -> Text
scriptId} -> Text
scriptId) (\s :: UpdateScript
s@UpdateScript' {} Text
a -> UpdateScript
s {$sel:scriptId:UpdateScript' :: Text
scriptId = Text
a} :: UpdateScript)
instance Core.AWSRequest UpdateScript where
type AWSResponse UpdateScript = UpdateScriptResponse
request :: UpdateScript -> Request UpdateScript
request = Service -> UpdateScript -> Request UpdateScript
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateScript
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateScript)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse UpdateScript))
-> Logger
-> Service
-> Proxy UpdateScript
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateScript)))
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 Script -> Int -> UpdateScriptResponse
UpdateScriptResponse'
(Maybe Script -> Int -> UpdateScriptResponse)
-> Either String (Maybe Script)
-> Either String (Int -> UpdateScriptResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Script)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Script")
Either String (Int -> UpdateScriptResponse)
-> Either String Int -> Either String UpdateScriptResponse
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 UpdateScript
instance Prelude.NFData UpdateScript
instance Core.ToHeaders UpdateScript where
toHeaders :: UpdateScript -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateScript -> 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.UpdateScript" :: 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 UpdateScript where
toJSON :: UpdateScript -> Value
toJSON UpdateScript' {Maybe Text
Maybe Base64
Maybe S3Location
Text
scriptId :: Text
version :: Maybe Text
name :: Maybe Text
zipFile :: Maybe Base64
storageLocation :: Maybe S3Location
$sel:scriptId:UpdateScript' :: UpdateScript -> Text
$sel:version:UpdateScript' :: UpdateScript -> Maybe Text
$sel:name:UpdateScript' :: UpdateScript -> Maybe Text
$sel:zipFile:UpdateScript' :: UpdateScript -> Maybe Base64
$sel:storageLocation:UpdateScript' :: UpdateScript -> Maybe S3Location
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"StorageLocation" Text -> S3Location -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(S3Location -> Pair) -> Maybe S3Location -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe S3Location
storageLocation,
(Text
"ZipFile" Text -> Base64 -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Base64 -> Pair) -> Maybe Base64 -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Base64
zipFile,
(Text
"Name" 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
name,
(Text
"Version" 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
version,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ScriptId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
scriptId)
]
)
instance Core.ToPath UpdateScript where
toPath :: UpdateScript -> ByteString
toPath = ByteString -> UpdateScript -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery UpdateScript where
toQuery :: UpdateScript -> QueryString
toQuery = QueryString -> UpdateScript -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateScriptResponse = UpdateScriptResponse'
{
UpdateScriptResponse -> Maybe Script
script :: Prelude.Maybe Script,
UpdateScriptResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateScriptResponse -> UpdateScriptResponse -> Bool
(UpdateScriptResponse -> UpdateScriptResponse -> Bool)
-> (UpdateScriptResponse -> UpdateScriptResponse -> Bool)
-> Eq UpdateScriptResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateScriptResponse -> UpdateScriptResponse -> Bool
$c/= :: UpdateScriptResponse -> UpdateScriptResponse -> Bool
== :: UpdateScriptResponse -> UpdateScriptResponse -> Bool
$c== :: UpdateScriptResponse -> UpdateScriptResponse -> Bool
Prelude.Eq, ReadPrec [UpdateScriptResponse]
ReadPrec UpdateScriptResponse
Int -> ReadS UpdateScriptResponse
ReadS [UpdateScriptResponse]
(Int -> ReadS UpdateScriptResponse)
-> ReadS [UpdateScriptResponse]
-> ReadPrec UpdateScriptResponse
-> ReadPrec [UpdateScriptResponse]
-> Read UpdateScriptResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateScriptResponse]
$creadListPrec :: ReadPrec [UpdateScriptResponse]
readPrec :: ReadPrec UpdateScriptResponse
$creadPrec :: ReadPrec UpdateScriptResponse
readList :: ReadS [UpdateScriptResponse]
$creadList :: ReadS [UpdateScriptResponse]
readsPrec :: Int -> ReadS UpdateScriptResponse
$creadsPrec :: Int -> ReadS UpdateScriptResponse
Prelude.Read, Int -> UpdateScriptResponse -> ShowS
[UpdateScriptResponse] -> ShowS
UpdateScriptResponse -> String
(Int -> UpdateScriptResponse -> ShowS)
-> (UpdateScriptResponse -> String)
-> ([UpdateScriptResponse] -> ShowS)
-> Show UpdateScriptResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateScriptResponse] -> ShowS
$cshowList :: [UpdateScriptResponse] -> ShowS
show :: UpdateScriptResponse -> String
$cshow :: UpdateScriptResponse -> String
showsPrec :: Int -> UpdateScriptResponse -> ShowS
$cshowsPrec :: Int -> UpdateScriptResponse -> ShowS
Prelude.Show, (forall x. UpdateScriptResponse -> Rep UpdateScriptResponse x)
-> (forall x. Rep UpdateScriptResponse x -> UpdateScriptResponse)
-> Generic UpdateScriptResponse
forall x. Rep UpdateScriptResponse x -> UpdateScriptResponse
forall x. UpdateScriptResponse -> Rep UpdateScriptResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateScriptResponse x -> UpdateScriptResponse
$cfrom :: forall x. UpdateScriptResponse -> Rep UpdateScriptResponse x
Prelude.Generic)
newUpdateScriptResponse ::
Prelude.Int ->
UpdateScriptResponse
newUpdateScriptResponse :: Int -> UpdateScriptResponse
newUpdateScriptResponse Int
pHttpStatus_ =
UpdateScriptResponse' :: Maybe Script -> Int -> UpdateScriptResponse
UpdateScriptResponse'
{ $sel:script:UpdateScriptResponse' :: Maybe Script
script = Maybe Script
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:UpdateScriptResponse' :: Int
httpStatus = Int
pHttpStatus_
}
updateScriptResponse_script :: Lens.Lens' UpdateScriptResponse (Prelude.Maybe Script)
updateScriptResponse_script :: (Maybe Script -> f (Maybe Script))
-> UpdateScriptResponse -> f UpdateScriptResponse
updateScriptResponse_script = (UpdateScriptResponse -> Maybe Script)
-> (UpdateScriptResponse -> Maybe Script -> UpdateScriptResponse)
-> Lens
UpdateScriptResponse
UpdateScriptResponse
(Maybe Script)
(Maybe Script)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateScriptResponse' {Maybe Script
script :: Maybe Script
$sel:script:UpdateScriptResponse' :: UpdateScriptResponse -> Maybe Script
script} -> Maybe Script
script) (\s :: UpdateScriptResponse
s@UpdateScriptResponse' {} Maybe Script
a -> UpdateScriptResponse
s {$sel:script:UpdateScriptResponse' :: Maybe Script
script = Maybe Script
a} :: UpdateScriptResponse)
updateScriptResponse_httpStatus :: Lens.Lens' UpdateScriptResponse Prelude.Int
updateScriptResponse_httpStatus :: (Int -> f Int) -> UpdateScriptResponse -> f UpdateScriptResponse
updateScriptResponse_httpStatus = (UpdateScriptResponse -> Int)
-> (UpdateScriptResponse -> Int -> UpdateScriptResponse)
-> Lens UpdateScriptResponse UpdateScriptResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateScriptResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateScriptResponse' :: UpdateScriptResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateScriptResponse
s@UpdateScriptResponse' {} Int
a -> UpdateScriptResponse
s {$sel:httpStatus:UpdateScriptResponse' :: Int
httpStatus = Int
a} :: UpdateScriptResponse)
instance Prelude.NFData UpdateScriptResponse