{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.GameLift.CreateScript
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Creates a new script record for your Realtime Servers script. Realtime
-- scripts are JavaScript that provide configuration settings and optional
-- custom game logic for your game. The script is deployed when you create
-- a Realtime Servers fleet to host your game sessions. Script logic is
-- executed during an active game session.
--
-- To create a new script record, specify a script name and provide the
-- script file(s). The script files and all dependencies must be zipped
-- into a single file. You can pull the zip file from either of these
-- locations:
--
-- -   A locally available directory. Use the /ZipFile/ parameter for this
--     option.
--
-- -   An Amazon Simple Storage Service (Amazon S3) bucket under your AWS
--     account. Use the /StorageLocation/ parameter for this option.
--     You\'ll need to have an Identity Access Management (IAM) role that
--     allows the Amazon GameLift service to access your S3 bucket.
--
-- If the call is successful, a new script record is created with a unique
-- script ID. If the script file is provided as a local file, the file is
-- uploaded to an Amazon GameLift-owned S3 bucket and the script record\'s
-- storage location reflects this location. If the script file is provided
-- as an S3 bucket, Amazon GameLift accesses the file at this storage
-- location as needed for deployment.
--
-- __Learn more__
--
-- <https://docs.aws.amazon.com/gamelift/latest/developerguide/realtime-intro.html Amazon GameLift Realtime Servers>
--
-- <https://docs.aws.amazon.com/gamelift/latest/developerguide/setting-up-role.html Set Up a Role for Amazon GameLift Access>
--
-- __Related actions__
--
-- CreateScript | ListScripts | DescribeScript | UpdateScript |
-- DeleteScript |
-- <https://docs.aws.amazon.com/gamelift/latest/developerguide/reference-awssdk.html#reference-awssdk-resources-fleets All APIs by task>
module Amazonka.GameLift.CreateScript
  ( -- * Creating a Request
    CreateScript (..),
    newCreateScript,

    -- * Request Lenses
    createScript_storageLocation,
    createScript_zipFile,
    createScript_name,
    createScript_version,
    createScript_tags,

    -- * Destructuring the Response
    CreateScriptResponse (..),
    newCreateScriptResponse,

    -- * Response Lenses
    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

-- | /See:/ 'newCreateScript' smart constructor.
data CreateScript = CreateScript'
  { -- | The location of the Amazon S3 bucket where a zipped file containing your
    -- Realtime scripts is stored. The storage location must specify the Amazon
    -- S3 bucket name, the zip file name (the \"key\"), and a role ARN that
    -- allows Amazon GameLift to access the Amazon S3 storage location. The S3
    -- bucket must be in the same Region where you want to create a new script.
    -- By default, Amazon GameLift uploads the latest version of the zip file;
    -- if you have S3 object versioning turned on, you can use the
    -- @ObjectVersion@ parameter to specify an earlier version.
    CreateScript -> Maybe S3Location
storageLocation :: Prelude.Maybe S3Location,
    -- | A data object containing your Realtime scripts and dependencies as a zip
    -- file. The zip file can have one or multiple files. Maximum size of a zip
    -- file is 5 MB.
    --
    -- When using the AWS CLI tool to create a script, this parameter is set to
    -- the zip file name. It must be prepended with the string \"fileb:\/\/\"
    -- to indicate that the file data is a binary object. For example:
    -- @--zip-file fileb:\/\/myRealtimeScript.zip@.
    CreateScript -> Maybe Base64
zipFile :: Prelude.Maybe Core.Base64,
    -- | A descriptive label that is associated with a script. Script names do
    -- not need to be unique. You can use UpdateScript to change this value
    -- later.
    CreateScript -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | Version information that is associated with a build or script. Version
    -- strings do not need to be unique. You can use UpdateScript to change
    -- this value later.
    CreateScript -> Maybe Text
version :: Prelude.Maybe Prelude.Text,
    -- | A list of labels to assign to the new script resource. Tags are
    -- developer-defined key-value pairs. Tagging AWS resources are useful for
    -- resource management, access management and cost allocation. For more
    -- information, see
    -- <https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html Tagging AWS Resources>
    -- in the /AWS General Reference/. Once the resource is created, you can
    -- use TagResource, UntagResource, and ListTagsForResource to add, remove,
    -- and view tags. The maximum tag limit may be lower than stated. See the
    -- AWS General Reference for actual tagging limits.
    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)

-- |
-- Create a value of 'CreateScript' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'storageLocation', 'createScript_storageLocation' - The location of the Amazon S3 bucket where a zipped file containing your
-- Realtime scripts is stored. The storage location must specify the Amazon
-- S3 bucket name, the zip file name (the \"key\"), and a role ARN that
-- allows Amazon GameLift to access the Amazon S3 storage location. The S3
-- bucket must be in the same Region where you want to create a new script.
-- By default, Amazon GameLift uploads the latest version of the zip file;
-- if you have S3 object versioning turned on, you can use the
-- @ObjectVersion@ parameter to specify an earlier version.
--
-- 'zipFile', 'createScript_zipFile' - A data object containing your Realtime scripts and dependencies as a zip
-- file. The zip file can have one or multiple files. Maximum size of a zip
-- file is 5 MB.
--
-- When using the AWS CLI tool to create a script, this parameter is set to
-- the zip file name. It must be prepended with the string \"fileb:\/\/\"
-- to indicate that the file data is a binary object. For example:
-- @--zip-file fileb:\/\/myRealtimeScript.zip@.--
-- -- /Note:/ This 'Lens' automatically encodes and decodes Base64 data.
-- -- The underlying isomorphism will encode to Base64 representation during
-- -- serialisation, and decode from Base64 representation during deserialisation.
-- -- This 'Lens' accepts and returns only raw unencoded data.
--
-- 'name', 'createScript_name' - A descriptive label that is associated with a script. Script names do
-- not need to be unique. You can use UpdateScript to change this value
-- later.
--
-- 'version', 'createScript_version' - Version information that is associated with a build or script. Version
-- strings do not need to be unique. You can use UpdateScript to change
-- this value later.
--
-- 'tags', 'createScript_tags' - A list of labels to assign to the new script resource. Tags are
-- developer-defined key-value pairs. Tagging AWS resources are useful for
-- resource management, access management and cost allocation. For more
-- information, see
-- <https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html Tagging AWS Resources>
-- in the /AWS General Reference/. Once the resource is created, you can
-- use TagResource, UntagResource, and ListTagsForResource to add, remove,
-- and view tags. The maximum tag limit may be lower than stated. See the
-- AWS General Reference for actual tagging limits.
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
    }

-- | The location of the Amazon S3 bucket where a zipped file containing your
-- Realtime scripts is stored. The storage location must specify the Amazon
-- S3 bucket name, the zip file name (the \"key\"), and a role ARN that
-- allows Amazon GameLift to access the Amazon S3 storage location. The S3
-- bucket must be in the same Region where you want to create a new script.
-- By default, Amazon GameLift uploads the latest version of the zip file;
-- if you have S3 object versioning turned on, you can use the
-- @ObjectVersion@ parameter to specify an earlier version.
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)

-- | A data object containing your Realtime scripts and dependencies as a zip
-- file. The zip file can have one or multiple files. Maximum size of a zip
-- file is 5 MB.
--
-- When using the AWS CLI tool to create a script, this parameter is set to
-- the zip file name. It must be prepended with the string \"fileb:\/\/\"
-- to indicate that the file data is a binary object. For example:
-- @--zip-file fileb:\/\/myRealtimeScript.zip@.--
-- -- /Note:/ This 'Lens' automatically encodes and decodes Base64 data.
-- -- The underlying isomorphism will encode to Base64 representation during
-- -- serialisation, and decode from Base64 representation during deserialisation.
-- -- This 'Lens' accepts and returns only raw unencoded data.
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

-- | A descriptive label that is associated with a script. Script names do
-- not need to be unique. You can use UpdateScript to change this value
-- later.
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)

-- | Version information that is associated with a build or script. Version
-- strings do not need to be unique. You can use UpdateScript to change
-- this value later.
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)

-- | A list of labels to assign to the new script resource. Tags are
-- developer-defined key-value pairs. Tagging AWS resources are useful for
-- resource management, access management and cost allocation. For more
-- information, see
-- <https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html Tagging AWS Resources>
-- in the /AWS General Reference/. Once the resource is created, you can
-- use TagResource, UntagResource, and ListTagsForResource to add, remove,
-- and view tags. The maximum tag limit may be lower than stated. See the
-- AWS General Reference for actual tagging limits.
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

-- | /See:/ 'newCreateScriptResponse' smart constructor.
data CreateScriptResponse = CreateScriptResponse'
  { -- | The newly created script record with a unique script ID and ARN. The new
    -- script\'s storage location reflects an Amazon S3 location: (1) If the
    -- script was uploaded from an S3 bucket under your account, the storage
    -- location reflects the information that was provided in the
    -- /CreateScript/ request; (2) If the script file was uploaded from a local
    -- zip file, the storage location reflects an S3 location controls by the
    -- Amazon GameLift service.
    CreateScriptResponse -> Maybe Script
script :: Prelude.Maybe Script,
    -- | The response's http status code.
    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)

-- |
-- Create a value of 'CreateScriptResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'script', 'createScriptResponse_script' - The newly created script record with a unique script ID and ARN. The new
-- script\'s storage location reflects an Amazon S3 location: (1) If the
-- script was uploaded from an S3 bucket under your account, the storage
-- location reflects the information that was provided in the
-- /CreateScript/ request; (2) If the script file was uploaded from a local
-- zip file, the storage location reflects an S3 location controls by the
-- Amazon GameLift service.
--
-- 'httpStatus', 'createScriptResponse_httpStatus' - The response's http status code.
newCreateScriptResponse ::
  -- | 'httpStatus'
  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_
    }

-- | The newly created script record with a unique script ID and ARN. The new
-- script\'s storage location reflects an Amazon S3 location: (1) If the
-- script was uploaded from an S3 bucket under your account, the storage
-- location reflects the information that was provided in the
-- /CreateScript/ request; (2) If the script file was uploaded from a local
-- zip file, the storage location reflects an S3 location controls by the
-- Amazon GameLift service.
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)

-- | The response's http status code.
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