{-# 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.CreateScript
(
CreateScript (..),
newCreateScript,
createScript_storageLocation,
createScript_zipFile,
createScript_name,
createScript_version,
createScript_tags,
CreateScriptResponse (..),
newCreateScriptResponse,
createScriptResponse_script,
createScriptResponse_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 CreateScript = CreateScript'
{
CreateScript -> Maybe S3Location
storageLocation :: Prelude.Maybe S3Location,
CreateScript -> Maybe Base64
zipFile :: Prelude.Maybe Core.Base64,
CreateScript -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
CreateScript -> Maybe Text
version :: Prelude.Maybe Prelude.Text,
CreateScript -> Maybe [Tag]
tags :: Prelude.Maybe [Tag]
}
deriving (CreateScript -> CreateScript -> Bool
(CreateScript -> CreateScript -> Bool)
-> (CreateScript -> CreateScript -> Bool) -> Eq CreateScript
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateScript -> CreateScript -> Bool
$c/= :: CreateScript -> CreateScript -> Bool
== :: CreateScript -> CreateScript -> Bool
$c== :: CreateScript -> CreateScript -> Bool
Prelude.Eq, ReadPrec [CreateScript]
ReadPrec CreateScript
Int -> ReadS CreateScript
ReadS [CreateScript]
(Int -> ReadS CreateScript)
-> ReadS [CreateScript]
-> ReadPrec CreateScript
-> ReadPrec [CreateScript]
-> Read CreateScript
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateScript]
$creadListPrec :: ReadPrec [CreateScript]
readPrec :: ReadPrec CreateScript
$creadPrec :: ReadPrec CreateScript
readList :: ReadS [CreateScript]
$creadList :: ReadS [CreateScript]
readsPrec :: Int -> ReadS CreateScript
$creadsPrec :: Int -> ReadS CreateScript
Prelude.Read, Int -> CreateScript -> ShowS
[CreateScript] -> ShowS
CreateScript -> String
(Int -> CreateScript -> ShowS)
-> (CreateScript -> String)
-> ([CreateScript] -> ShowS)
-> Show CreateScript
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateScript] -> ShowS
$cshowList :: [CreateScript] -> ShowS
show :: CreateScript -> String
$cshow :: CreateScript -> String
showsPrec :: Int -> CreateScript -> ShowS
$cshowsPrec :: Int -> CreateScript -> ShowS
Prelude.Show, (forall x. CreateScript -> Rep CreateScript x)
-> (forall x. Rep CreateScript x -> CreateScript)
-> Generic CreateScript
forall x. Rep CreateScript x -> CreateScript
forall x. CreateScript -> Rep CreateScript x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateScript x -> CreateScript
$cfrom :: forall x. CreateScript -> Rep CreateScript x
Prelude.Generic)
newCreateScript ::
CreateScript
newCreateScript :: CreateScript
newCreateScript =
CreateScript' :: Maybe S3Location
-> Maybe Base64
-> Maybe Text
-> Maybe Text
-> Maybe [Tag]
-> CreateScript
CreateScript'
{ $sel:storageLocation:CreateScript' :: Maybe S3Location
storageLocation = Maybe S3Location
forall a. Maybe a
Prelude.Nothing,
$sel:zipFile:CreateScript' :: Maybe Base64
zipFile = Maybe Base64
forall a. Maybe a
Prelude.Nothing,
$sel:name:CreateScript' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:version:CreateScript' :: Maybe Text
version = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:tags:CreateScript' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing
}
createScript_storageLocation :: Lens.Lens' CreateScript (Prelude.Maybe S3Location)
createScript_storageLocation :: (Maybe S3Location -> f (Maybe S3Location))
-> CreateScript -> f CreateScript
createScript_storageLocation = (CreateScript -> Maybe S3Location)
-> (CreateScript -> Maybe S3Location -> CreateScript)
-> Lens
CreateScript CreateScript (Maybe S3Location) (Maybe S3Location)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateScript' {Maybe S3Location
storageLocation :: Maybe S3Location
$sel:storageLocation:CreateScript' :: CreateScript -> Maybe S3Location
storageLocation} -> Maybe S3Location
storageLocation) (\s :: CreateScript
s@CreateScript' {} Maybe S3Location
a -> CreateScript
s {$sel:storageLocation:CreateScript' :: Maybe S3Location
storageLocation = Maybe S3Location
a} :: CreateScript)
createScript_zipFile :: Lens.Lens' CreateScript (Prelude.Maybe Prelude.ByteString)
createScript_zipFile :: (Maybe ByteString -> f (Maybe ByteString))
-> CreateScript -> f CreateScript
createScript_zipFile = (CreateScript -> Maybe Base64)
-> (CreateScript -> Maybe Base64 -> CreateScript)
-> Lens CreateScript CreateScript (Maybe Base64) (Maybe Base64)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateScript' {Maybe Base64
zipFile :: Maybe Base64
$sel:zipFile:CreateScript' :: CreateScript -> Maybe Base64
zipFile} -> Maybe Base64
zipFile) (\s :: CreateScript
s@CreateScript' {} Maybe Base64
a -> CreateScript
s {$sel:zipFile:CreateScript' :: Maybe Base64
zipFile = Maybe Base64
a} :: CreateScript) ((Maybe Base64 -> f (Maybe Base64))
-> CreateScript -> f CreateScript)
-> ((Maybe ByteString -> f (Maybe ByteString))
-> Maybe Base64 -> f (Maybe Base64))
-> (Maybe ByteString -> f (Maybe ByteString))
-> CreateScript
-> f CreateScript
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
createScript_name :: Lens.Lens' CreateScript (Prelude.Maybe Prelude.Text)
createScript_name :: (Maybe Text -> f (Maybe Text)) -> CreateScript -> f CreateScript
createScript_name = (CreateScript -> Maybe Text)
-> (CreateScript -> Maybe Text -> CreateScript)
-> Lens CreateScript CreateScript (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateScript' {Maybe Text
name :: Maybe Text
$sel:name:CreateScript' :: CreateScript -> Maybe Text
name} -> Maybe Text
name) (\s :: CreateScript
s@CreateScript' {} Maybe Text
a -> CreateScript
s {$sel:name:CreateScript' :: Maybe Text
name = Maybe Text
a} :: CreateScript)
createScript_version :: Lens.Lens' CreateScript (Prelude.Maybe Prelude.Text)
createScript_version :: (Maybe Text -> f (Maybe Text)) -> CreateScript -> f CreateScript
createScript_version = (CreateScript -> Maybe Text)
-> (CreateScript -> Maybe Text -> CreateScript)
-> Lens CreateScript CreateScript (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateScript' {Maybe Text
version :: Maybe Text
$sel:version:CreateScript' :: CreateScript -> Maybe Text
version} -> Maybe Text
version) (\s :: CreateScript
s@CreateScript' {} Maybe Text
a -> CreateScript
s {$sel:version:CreateScript' :: Maybe Text
version = Maybe Text
a} :: CreateScript)
createScript_tags :: Lens.Lens' CreateScript (Prelude.Maybe [Tag])
createScript_tags :: (Maybe [Tag] -> f (Maybe [Tag])) -> CreateScript -> f CreateScript
createScript_tags = (CreateScript -> Maybe [Tag])
-> (CreateScript -> Maybe [Tag] -> CreateScript)
-> Lens CreateScript CreateScript (Maybe [Tag]) (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateScript' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateScript' :: CreateScript -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateScript
s@CreateScript' {} Maybe [Tag]
a -> CreateScript
s {$sel:tags:CreateScript' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateScript) ((Maybe [Tag] -> f (Maybe [Tag]))
-> CreateScript -> f CreateScript)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
-> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateScript
-> f CreateScript
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Tag] [Tag] [Tag] [Tag]
-> Iso (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag])
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 [Tag] [Tag] [Tag] [Tag]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest CreateScript where
type AWSResponse CreateScript = CreateScriptResponse
request :: CreateScript -> Request CreateScript
request = Service -> CreateScript -> Request CreateScript
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateScript
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateScript)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateScript))
-> Logger
-> Service
-> Proxy CreateScript
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateScript)))
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 -> CreateScriptResponse
CreateScriptResponse'
(Maybe Script -> Int -> CreateScriptResponse)
-> Either String (Maybe Script)
-> Either String (Int -> CreateScriptResponse)
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 -> CreateScriptResponse)
-> Either String Int -> Either String CreateScriptResponse
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 CreateScript
instance Prelude.NFData CreateScript
instance Core.ToHeaders CreateScript where
toHeaders :: CreateScript -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreateScript -> 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.CreateScript" :: 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 CreateScript where
toJSON :: CreateScript -> Value
toJSON CreateScript' {Maybe [Tag]
Maybe Text
Maybe Base64
Maybe S3Location
tags :: Maybe [Tag]
version :: Maybe Text
name :: Maybe Text
zipFile :: Maybe Base64
storageLocation :: Maybe S3Location
$sel:tags:CreateScript' :: CreateScript -> Maybe [Tag]
$sel:version:CreateScript' :: CreateScript -> Maybe Text
$sel:name:CreateScript' :: CreateScript -> Maybe Text
$sel:zipFile:CreateScript' :: CreateScript -> Maybe Base64
$sel:storageLocation:CreateScript' :: CreateScript -> 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,
(Text
"Tags" Text -> [Tag] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Tag] -> Pair) -> Maybe [Tag] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags
]
)
instance Core.ToPath CreateScript where
toPath :: CreateScript -> ByteString
toPath = ByteString -> CreateScript -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CreateScript where
toQuery :: CreateScript -> QueryString
toQuery = QueryString -> CreateScript -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateScriptResponse = CreateScriptResponse'
{
CreateScriptResponse -> Maybe Script
script :: Prelude.Maybe Script,
CreateScriptResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateScriptResponse -> CreateScriptResponse -> Bool
(CreateScriptResponse -> CreateScriptResponse -> Bool)
-> (CreateScriptResponse -> CreateScriptResponse -> Bool)
-> Eq CreateScriptResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateScriptResponse -> CreateScriptResponse -> Bool
$c/= :: CreateScriptResponse -> CreateScriptResponse -> Bool
== :: CreateScriptResponse -> CreateScriptResponse -> Bool
$c== :: CreateScriptResponse -> CreateScriptResponse -> Bool
Prelude.Eq, ReadPrec [CreateScriptResponse]
ReadPrec CreateScriptResponse
Int -> ReadS CreateScriptResponse
ReadS [CreateScriptResponse]
(Int -> ReadS CreateScriptResponse)
-> ReadS [CreateScriptResponse]
-> ReadPrec CreateScriptResponse
-> ReadPrec [CreateScriptResponse]
-> Read CreateScriptResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateScriptResponse]
$creadListPrec :: ReadPrec [CreateScriptResponse]
readPrec :: ReadPrec CreateScriptResponse
$creadPrec :: ReadPrec CreateScriptResponse
readList :: ReadS [CreateScriptResponse]
$creadList :: ReadS [CreateScriptResponse]
readsPrec :: Int -> ReadS CreateScriptResponse
$creadsPrec :: Int -> ReadS CreateScriptResponse
Prelude.Read, Int -> CreateScriptResponse -> ShowS
[CreateScriptResponse] -> ShowS
CreateScriptResponse -> String
(Int -> CreateScriptResponse -> ShowS)
-> (CreateScriptResponse -> String)
-> ([CreateScriptResponse] -> ShowS)
-> Show CreateScriptResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateScriptResponse] -> ShowS
$cshowList :: [CreateScriptResponse] -> ShowS
show :: CreateScriptResponse -> String
$cshow :: CreateScriptResponse -> String
showsPrec :: Int -> CreateScriptResponse -> ShowS
$cshowsPrec :: Int -> CreateScriptResponse -> ShowS
Prelude.Show, (forall x. CreateScriptResponse -> Rep CreateScriptResponse x)
-> (forall x. Rep CreateScriptResponse x -> CreateScriptResponse)
-> Generic CreateScriptResponse
forall x. Rep CreateScriptResponse x -> CreateScriptResponse
forall x. CreateScriptResponse -> Rep CreateScriptResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateScriptResponse x -> CreateScriptResponse
$cfrom :: forall x. CreateScriptResponse -> Rep CreateScriptResponse x
Prelude.Generic)
newCreateScriptResponse ::
Prelude.Int ->
CreateScriptResponse
newCreateScriptResponse :: Int -> CreateScriptResponse
newCreateScriptResponse Int
pHttpStatus_ =
CreateScriptResponse' :: Maybe Script -> Int -> CreateScriptResponse
CreateScriptResponse'
{ $sel:script:CreateScriptResponse' :: Maybe Script
script = Maybe Script
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateScriptResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createScriptResponse_script :: Lens.Lens' CreateScriptResponse (Prelude.Maybe Script)
createScriptResponse_script :: (Maybe Script -> f (Maybe Script))
-> CreateScriptResponse -> f CreateScriptResponse
createScriptResponse_script = (CreateScriptResponse -> Maybe Script)
-> (CreateScriptResponse -> Maybe Script -> CreateScriptResponse)
-> Lens
CreateScriptResponse
CreateScriptResponse
(Maybe Script)
(Maybe Script)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateScriptResponse' {Maybe Script
script :: Maybe Script
$sel:script:CreateScriptResponse' :: CreateScriptResponse -> Maybe Script
script} -> Maybe Script
script) (\s :: CreateScriptResponse
s@CreateScriptResponse' {} Maybe Script
a -> CreateScriptResponse
s {$sel:script:CreateScriptResponse' :: Maybe Script
script = Maybe Script
a} :: CreateScriptResponse)
createScriptResponse_httpStatus :: Lens.Lens' CreateScriptResponse Prelude.Int
createScriptResponse_httpStatus :: (Int -> f Int) -> CreateScriptResponse -> f CreateScriptResponse
createScriptResponse_httpStatus = (CreateScriptResponse -> Int)
-> (CreateScriptResponse -> Int -> CreateScriptResponse)
-> Lens CreateScriptResponse CreateScriptResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateScriptResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateScriptResponse' :: CreateScriptResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateScriptResponse
s@CreateScriptResponse' {} Int
a -> CreateScriptResponse
s {$sel:httpStatus:CreateScriptResponse' :: Int
httpStatus = Int
a} :: CreateScriptResponse)
instance Prelude.NFData CreateScriptResponse