{-# 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.CreateBuild
-- 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 Amazon GameLift build resource for your game server binary
-- files. Game server binaries must be combined into a zip file for use
-- with Amazon GameLift.
--
-- When setting up a new game build for GameLift, we recommend using the
-- AWS CLI command
-- __<https://docs.aws.amazon.com/cli/latest/reference/gamelift/upload-build.html upload-build>__
-- . This helper command combines two tasks: (1) it uploads your build
-- files from a file directory to a GameLift Amazon S3 location, and (2) it
-- creates a new build resource.
--
-- The @CreateBuild@ operation can used in the following scenarios:
--
-- -   To create a new game build with build files that are in an Amazon S3
--     location under an AWS account that you control. To use this option,
--     you must first give Amazon GameLift access to the Amazon S3 bucket.
--     With permissions in place, call @CreateBuild@ and specify a build
--     name, operating system, and the Amazon S3 storage location of your
--     game build.
--
-- -   To directly upload your build files to a GameLift Amazon S3
--     location. To use this option, first call @CreateBuild@ and specify a
--     build name and operating system. This operation creates a new build
--     resource and also returns an Amazon S3 location with temporary
--     access credentials. Use the credentials to manually upload your
--     build files to the specified Amazon S3 location. For more
--     information, see
--     <https://docs.aws.amazon.com/AmazonS3/latest/dev/UploadingObjects.html Uploading Objects>
--     in the /Amazon S3 Developer Guide/. Build files can be uploaded to
--     the GameLift Amazon S3 location once only; that can\'t be updated.
--
-- If successful, this operation creates a new build resource with a unique
-- build ID and places it in @INITIALIZED@ status. A build must be in
-- @READY@ status before you can create fleets with it.
--
-- __Learn more__
--
-- <https://docs.aws.amazon.com/gamelift/latest/developerguide/gamelift-build-intro.html Uploading Your Game>
--
-- <https://docs.aws.amazon.com/gamelift/latest/developerguide/gamelift-build-cli-uploading.html#gamelift-build-cli-uploading-create-build Create a Build with Files in Amazon S3>
--
-- __Related actions__
--
-- CreateBuild | ListBuilds | DescribeBuild | UpdateBuild | DeleteBuild |
-- <https://docs.aws.amazon.com/gamelift/latest/developerguide/reference-awssdk.html#reference-awssdk-resources-fleets All APIs by task>
module Amazonka.GameLift.CreateBuild
  ( -- * Creating a Request
    CreateBuild (..),
    newCreateBuild,

    -- * Request Lenses
    createBuild_storageLocation,
    createBuild_operatingSystem,
    createBuild_name,
    createBuild_version,
    createBuild_tags,

    -- * Destructuring the Response
    CreateBuildResponse (..),
    newCreateBuildResponse,

    -- * Response Lenses
    createBuildResponse_storageLocation,
    createBuildResponse_uploadCredentials,
    createBuildResponse_build,
    createBuildResponse_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

-- | Represents the input for a request operation.
--
-- /See:/ 'newCreateBuild' smart constructor.
data CreateBuild = CreateBuild'
  { -- | Information indicating where your game build files are stored. Use this
    -- parameter only when creating a build with files stored in an Amazon S3
    -- bucket that you own. The storage location must specify an Amazon S3
    -- bucket name and key. The location must also specify a role ARN that you
    -- set up to allow Amazon GameLift to access your Amazon S3 bucket. The S3
    -- bucket and your new build must be in the same Region.
    CreateBuild -> Maybe S3Location
storageLocation :: Prelude.Maybe S3Location,
    -- | The operating system that the game server binaries are built to run on.
    -- This value determines the type of fleet resources that you can use for
    -- this build. If your game build contains multiple executables, they all
    -- must run on the same operating system. If an operating system is not
    -- specified when creating a build, Amazon GameLift uses the default value
    -- (WINDOWS_2012). This value cannot be changed later.
    CreateBuild -> Maybe OperatingSystem
operatingSystem :: Prelude.Maybe OperatingSystem,
    -- | A descriptive label that is associated with a build. Build names do not
    -- need to be unique. You can use UpdateBuild to change this value later.
    CreateBuild -> 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 UpdateBuild to change this
    -- value later.
    CreateBuild -> Maybe Text
version :: Prelude.Maybe Prelude.Text,
    -- | A list of labels to assign to the new build 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.
    CreateBuild -> Maybe [Tag]
tags :: Prelude.Maybe [Tag]
  }
  deriving (CreateBuild -> CreateBuild -> Bool
(CreateBuild -> CreateBuild -> Bool)
-> (CreateBuild -> CreateBuild -> Bool) -> Eq CreateBuild
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateBuild -> CreateBuild -> Bool
$c/= :: CreateBuild -> CreateBuild -> Bool
== :: CreateBuild -> CreateBuild -> Bool
$c== :: CreateBuild -> CreateBuild -> Bool
Prelude.Eq, ReadPrec [CreateBuild]
ReadPrec CreateBuild
Int -> ReadS CreateBuild
ReadS [CreateBuild]
(Int -> ReadS CreateBuild)
-> ReadS [CreateBuild]
-> ReadPrec CreateBuild
-> ReadPrec [CreateBuild]
-> Read CreateBuild
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateBuild]
$creadListPrec :: ReadPrec [CreateBuild]
readPrec :: ReadPrec CreateBuild
$creadPrec :: ReadPrec CreateBuild
readList :: ReadS [CreateBuild]
$creadList :: ReadS [CreateBuild]
readsPrec :: Int -> ReadS CreateBuild
$creadsPrec :: Int -> ReadS CreateBuild
Prelude.Read, Int -> CreateBuild -> ShowS
[CreateBuild] -> ShowS
CreateBuild -> String
(Int -> CreateBuild -> ShowS)
-> (CreateBuild -> String)
-> ([CreateBuild] -> ShowS)
-> Show CreateBuild
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateBuild] -> ShowS
$cshowList :: [CreateBuild] -> ShowS
show :: CreateBuild -> String
$cshow :: CreateBuild -> String
showsPrec :: Int -> CreateBuild -> ShowS
$cshowsPrec :: Int -> CreateBuild -> ShowS
Prelude.Show, (forall x. CreateBuild -> Rep CreateBuild x)
-> (forall x. Rep CreateBuild x -> CreateBuild)
-> Generic CreateBuild
forall x. Rep CreateBuild x -> CreateBuild
forall x. CreateBuild -> Rep CreateBuild x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateBuild x -> CreateBuild
$cfrom :: forall x. CreateBuild -> Rep CreateBuild x
Prelude.Generic)

-- |
-- Create a value of 'CreateBuild' 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', 'createBuild_storageLocation' - Information indicating where your game build files are stored. Use this
-- parameter only when creating a build with files stored in an Amazon S3
-- bucket that you own. The storage location must specify an Amazon S3
-- bucket name and key. The location must also specify a role ARN that you
-- set up to allow Amazon GameLift to access your Amazon S3 bucket. The S3
-- bucket and your new build must be in the same Region.
--
-- 'operatingSystem', 'createBuild_operatingSystem' - The operating system that the game server binaries are built to run on.
-- This value determines the type of fleet resources that you can use for
-- this build. If your game build contains multiple executables, they all
-- must run on the same operating system. If an operating system is not
-- specified when creating a build, Amazon GameLift uses the default value
-- (WINDOWS_2012). This value cannot be changed later.
--
-- 'name', 'createBuild_name' - A descriptive label that is associated with a build. Build names do not
-- need to be unique. You can use UpdateBuild to change this value later.
--
-- 'version', 'createBuild_version' - Version information that is associated with a build or script. Version
-- strings do not need to be unique. You can use UpdateBuild to change this
-- value later.
--
-- 'tags', 'createBuild_tags' - A list of labels to assign to the new build 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.
newCreateBuild ::
  CreateBuild
newCreateBuild :: CreateBuild
newCreateBuild =
  CreateBuild' :: Maybe S3Location
-> Maybe OperatingSystem
-> Maybe Text
-> Maybe Text
-> Maybe [Tag]
-> CreateBuild
CreateBuild'
    { $sel:storageLocation:CreateBuild' :: Maybe S3Location
storageLocation = Maybe S3Location
forall a. Maybe a
Prelude.Nothing,
      $sel:operatingSystem:CreateBuild' :: Maybe OperatingSystem
operatingSystem = Maybe OperatingSystem
forall a. Maybe a
Prelude.Nothing,
      $sel:name:CreateBuild' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:version:CreateBuild' :: Maybe Text
version = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:tags:CreateBuild' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing
    }

-- | Information indicating where your game build files are stored. Use this
-- parameter only when creating a build with files stored in an Amazon S3
-- bucket that you own. The storage location must specify an Amazon S3
-- bucket name and key. The location must also specify a role ARN that you
-- set up to allow Amazon GameLift to access your Amazon S3 bucket. The S3
-- bucket and your new build must be in the same Region.
createBuild_storageLocation :: Lens.Lens' CreateBuild (Prelude.Maybe S3Location)
createBuild_storageLocation :: (Maybe S3Location -> f (Maybe S3Location))
-> CreateBuild -> f CreateBuild
createBuild_storageLocation = (CreateBuild -> Maybe S3Location)
-> (CreateBuild -> Maybe S3Location -> CreateBuild)
-> Lens
     CreateBuild CreateBuild (Maybe S3Location) (Maybe S3Location)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBuild' {Maybe S3Location
storageLocation :: Maybe S3Location
$sel:storageLocation:CreateBuild' :: CreateBuild -> Maybe S3Location
storageLocation} -> Maybe S3Location
storageLocation) (\s :: CreateBuild
s@CreateBuild' {} Maybe S3Location
a -> CreateBuild
s {$sel:storageLocation:CreateBuild' :: Maybe S3Location
storageLocation = Maybe S3Location
a} :: CreateBuild)

-- | The operating system that the game server binaries are built to run on.
-- This value determines the type of fleet resources that you can use for
-- this build. If your game build contains multiple executables, they all
-- must run on the same operating system. If an operating system is not
-- specified when creating a build, Amazon GameLift uses the default value
-- (WINDOWS_2012). This value cannot be changed later.
createBuild_operatingSystem :: Lens.Lens' CreateBuild (Prelude.Maybe OperatingSystem)
createBuild_operatingSystem :: (Maybe OperatingSystem -> f (Maybe OperatingSystem))
-> CreateBuild -> f CreateBuild
createBuild_operatingSystem = (CreateBuild -> Maybe OperatingSystem)
-> (CreateBuild -> Maybe OperatingSystem -> CreateBuild)
-> Lens
     CreateBuild
     CreateBuild
     (Maybe OperatingSystem)
     (Maybe OperatingSystem)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBuild' {Maybe OperatingSystem
operatingSystem :: Maybe OperatingSystem
$sel:operatingSystem:CreateBuild' :: CreateBuild -> Maybe OperatingSystem
operatingSystem} -> Maybe OperatingSystem
operatingSystem) (\s :: CreateBuild
s@CreateBuild' {} Maybe OperatingSystem
a -> CreateBuild
s {$sel:operatingSystem:CreateBuild' :: Maybe OperatingSystem
operatingSystem = Maybe OperatingSystem
a} :: CreateBuild)

-- | A descriptive label that is associated with a build. Build names do not
-- need to be unique. You can use UpdateBuild to change this value later.
createBuild_name :: Lens.Lens' CreateBuild (Prelude.Maybe Prelude.Text)
createBuild_name :: (Maybe Text -> f (Maybe Text)) -> CreateBuild -> f CreateBuild
createBuild_name = (CreateBuild -> Maybe Text)
-> (CreateBuild -> Maybe Text -> CreateBuild)
-> Lens CreateBuild CreateBuild (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBuild' {Maybe Text
name :: Maybe Text
$sel:name:CreateBuild' :: CreateBuild -> Maybe Text
name} -> Maybe Text
name) (\s :: CreateBuild
s@CreateBuild' {} Maybe Text
a -> CreateBuild
s {$sel:name:CreateBuild' :: Maybe Text
name = Maybe Text
a} :: CreateBuild)

-- | Version information that is associated with a build or script. Version
-- strings do not need to be unique. You can use UpdateBuild to change this
-- value later.
createBuild_version :: Lens.Lens' CreateBuild (Prelude.Maybe Prelude.Text)
createBuild_version :: (Maybe Text -> f (Maybe Text)) -> CreateBuild -> f CreateBuild
createBuild_version = (CreateBuild -> Maybe Text)
-> (CreateBuild -> Maybe Text -> CreateBuild)
-> Lens CreateBuild CreateBuild (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBuild' {Maybe Text
version :: Maybe Text
$sel:version:CreateBuild' :: CreateBuild -> Maybe Text
version} -> Maybe Text
version) (\s :: CreateBuild
s@CreateBuild' {} Maybe Text
a -> CreateBuild
s {$sel:version:CreateBuild' :: Maybe Text
version = Maybe Text
a} :: CreateBuild)

-- | A list of labels to assign to the new build 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.
createBuild_tags :: Lens.Lens' CreateBuild (Prelude.Maybe [Tag])
createBuild_tags :: (Maybe [Tag] -> f (Maybe [Tag])) -> CreateBuild -> f CreateBuild
createBuild_tags = (CreateBuild -> Maybe [Tag])
-> (CreateBuild -> Maybe [Tag] -> CreateBuild)
-> Lens CreateBuild CreateBuild (Maybe [Tag]) (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBuild' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateBuild' :: CreateBuild -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateBuild
s@CreateBuild' {} Maybe [Tag]
a -> CreateBuild
s {$sel:tags:CreateBuild' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateBuild) ((Maybe [Tag] -> f (Maybe [Tag])) -> CreateBuild -> f CreateBuild)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
    -> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateBuild
-> f CreateBuild
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 CreateBuild where
  type AWSResponse CreateBuild = CreateBuildResponse
  request :: CreateBuild -> Request CreateBuild
request = Service -> CreateBuild -> Request CreateBuild
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateBuild
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateBuild)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateBuild))
-> Logger
-> Service
-> Proxy CreateBuild
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateBuild)))
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)
-> Maybe Build
-> Int
-> CreateBuildResponse
CreateBuildResponse'
            (Maybe S3Location
 -> Maybe (Sensitive AwsCredentials)
 -> Maybe Build
 -> Int
 -> CreateBuildResponse)
-> Either String (Maybe S3Location)
-> Either
     String
     (Maybe (Sensitive AwsCredentials)
      -> Maybe Build -> Int -> CreateBuildResponse)
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)
   -> Maybe Build -> Int -> CreateBuildResponse)
-> Either String (Maybe (Sensitive AwsCredentials))
-> Either String (Maybe Build -> Int -> CreateBuildResponse)
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 (Maybe Build -> Int -> CreateBuildResponse)
-> Either String (Maybe Build)
-> Either String (Int -> CreateBuildResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Build)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Build")
            Either String (Int -> CreateBuildResponse)
-> Either String Int -> Either String CreateBuildResponse
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 CreateBuild

instance Prelude.NFData CreateBuild

instance Core.ToHeaders CreateBuild where
  toHeaders :: CreateBuild -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateBuild -> 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.CreateBuild" :: 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 CreateBuild where
  toJSON :: CreateBuild -> Value
toJSON CreateBuild' {Maybe [Tag]
Maybe Text
Maybe OperatingSystem
Maybe S3Location
tags :: Maybe [Tag]
version :: Maybe Text
name :: Maybe Text
operatingSystem :: Maybe OperatingSystem
storageLocation :: Maybe S3Location
$sel:tags:CreateBuild' :: CreateBuild -> Maybe [Tag]
$sel:version:CreateBuild' :: CreateBuild -> Maybe Text
$sel:name:CreateBuild' :: CreateBuild -> Maybe Text
$sel:operatingSystem:CreateBuild' :: CreateBuild -> Maybe OperatingSystem
$sel:storageLocation:CreateBuild' :: CreateBuild -> 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
"OperatingSystem" Text -> OperatingSystem -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (OperatingSystem -> Pair) -> Maybe OperatingSystem -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe OperatingSystem
operatingSystem,
            (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 CreateBuild where
  toPath :: CreateBuild -> ByteString
toPath = ByteString -> CreateBuild -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery CreateBuild where
  toQuery :: CreateBuild -> QueryString
toQuery = QueryString -> CreateBuild -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | Represents the returned data in response to a request operation.
--
-- /See:/ 'newCreateBuildResponse' smart constructor.
data CreateBuildResponse = CreateBuildResponse'
  { -- | Amazon S3 location for your game build file, including bucket name and
    -- key.
    CreateBuildResponse -> Maybe S3Location
storageLocation :: Prelude.Maybe S3Location,
    -- | This element is returned only when the operation is called without a
    -- storage location. It contains credentials to use when you are uploading
    -- a build file to an Amazon S3 bucket that is owned by Amazon GameLift.
    -- Credentials have a limited life span. To refresh these credentials, call
    -- RequestUploadCredentials.
    CreateBuildResponse -> Maybe (Sensitive AwsCredentials)
uploadCredentials :: Prelude.Maybe (Core.Sensitive AwsCredentials),
    -- | The newly created build resource, including a unique build IDs and
    -- status.
    CreateBuildResponse -> Maybe Build
build :: Prelude.Maybe Build,
    -- | The response's http status code.
    CreateBuildResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateBuildResponse -> CreateBuildResponse -> Bool
(CreateBuildResponse -> CreateBuildResponse -> Bool)
-> (CreateBuildResponse -> CreateBuildResponse -> Bool)
-> Eq CreateBuildResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateBuildResponse -> CreateBuildResponse -> Bool
$c/= :: CreateBuildResponse -> CreateBuildResponse -> Bool
== :: CreateBuildResponse -> CreateBuildResponse -> Bool
$c== :: CreateBuildResponse -> CreateBuildResponse -> Bool
Prelude.Eq, Int -> CreateBuildResponse -> ShowS
[CreateBuildResponse] -> ShowS
CreateBuildResponse -> String
(Int -> CreateBuildResponse -> ShowS)
-> (CreateBuildResponse -> String)
-> ([CreateBuildResponse] -> ShowS)
-> Show CreateBuildResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateBuildResponse] -> ShowS
$cshowList :: [CreateBuildResponse] -> ShowS
show :: CreateBuildResponse -> String
$cshow :: CreateBuildResponse -> String
showsPrec :: Int -> CreateBuildResponse -> ShowS
$cshowsPrec :: Int -> CreateBuildResponse -> ShowS
Prelude.Show, (forall x. CreateBuildResponse -> Rep CreateBuildResponse x)
-> (forall x. Rep CreateBuildResponse x -> CreateBuildResponse)
-> Generic CreateBuildResponse
forall x. Rep CreateBuildResponse x -> CreateBuildResponse
forall x. CreateBuildResponse -> Rep CreateBuildResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateBuildResponse x -> CreateBuildResponse
$cfrom :: forall x. CreateBuildResponse -> Rep CreateBuildResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateBuildResponse' 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', 'createBuildResponse_storageLocation' - Amazon S3 location for your game build file, including bucket name and
-- key.
--
-- 'uploadCredentials', 'createBuildResponse_uploadCredentials' - This element is returned only when the operation is called without a
-- storage location. It contains credentials to use when you are uploading
-- a build file to an Amazon S3 bucket that is owned by Amazon GameLift.
-- Credentials have a limited life span. To refresh these credentials, call
-- RequestUploadCredentials.
--
-- 'build', 'createBuildResponse_build' - The newly created build resource, including a unique build IDs and
-- status.
--
-- 'httpStatus', 'createBuildResponse_httpStatus' - The response's http status code.
newCreateBuildResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateBuildResponse
newCreateBuildResponse :: Int -> CreateBuildResponse
newCreateBuildResponse Int
pHttpStatus_ =
  CreateBuildResponse' :: Maybe S3Location
-> Maybe (Sensitive AwsCredentials)
-> Maybe Build
-> Int
-> CreateBuildResponse
CreateBuildResponse'
    { $sel:storageLocation:CreateBuildResponse' :: Maybe S3Location
storageLocation =
        Maybe S3Location
forall a. Maybe a
Prelude.Nothing,
      $sel:uploadCredentials:CreateBuildResponse' :: Maybe (Sensitive AwsCredentials)
uploadCredentials = Maybe (Sensitive AwsCredentials)
forall a. Maybe a
Prelude.Nothing,
      $sel:build:CreateBuildResponse' :: Maybe Build
build = Maybe Build
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateBuildResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Amazon S3 location for your game build file, including bucket name and
-- key.
createBuildResponse_storageLocation :: Lens.Lens' CreateBuildResponse (Prelude.Maybe S3Location)
createBuildResponse_storageLocation :: (Maybe S3Location -> f (Maybe S3Location))
-> CreateBuildResponse -> f CreateBuildResponse
createBuildResponse_storageLocation = (CreateBuildResponse -> Maybe S3Location)
-> (CreateBuildResponse -> Maybe S3Location -> CreateBuildResponse)
-> Lens
     CreateBuildResponse
     CreateBuildResponse
     (Maybe S3Location)
     (Maybe S3Location)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBuildResponse' {Maybe S3Location
storageLocation :: Maybe S3Location
$sel:storageLocation:CreateBuildResponse' :: CreateBuildResponse -> Maybe S3Location
storageLocation} -> Maybe S3Location
storageLocation) (\s :: CreateBuildResponse
s@CreateBuildResponse' {} Maybe S3Location
a -> CreateBuildResponse
s {$sel:storageLocation:CreateBuildResponse' :: Maybe S3Location
storageLocation = Maybe S3Location
a} :: CreateBuildResponse)

-- | This element is returned only when the operation is called without a
-- storage location. It contains credentials to use when you are uploading
-- a build file to an Amazon S3 bucket that is owned by Amazon GameLift.
-- Credentials have a limited life span. To refresh these credentials, call
-- RequestUploadCredentials.
createBuildResponse_uploadCredentials :: Lens.Lens' CreateBuildResponse (Prelude.Maybe AwsCredentials)
createBuildResponse_uploadCredentials :: (Maybe AwsCredentials -> f (Maybe AwsCredentials))
-> CreateBuildResponse -> f CreateBuildResponse
createBuildResponse_uploadCredentials = (CreateBuildResponse -> Maybe (Sensitive AwsCredentials))
-> (CreateBuildResponse
    -> Maybe (Sensitive AwsCredentials) -> CreateBuildResponse)
-> Lens
     CreateBuildResponse
     CreateBuildResponse
     (Maybe (Sensitive AwsCredentials))
     (Maybe (Sensitive AwsCredentials))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBuildResponse' {Maybe (Sensitive AwsCredentials)
uploadCredentials :: Maybe (Sensitive AwsCredentials)
$sel:uploadCredentials:CreateBuildResponse' :: CreateBuildResponse -> Maybe (Sensitive AwsCredentials)
uploadCredentials} -> Maybe (Sensitive AwsCredentials)
uploadCredentials) (\s :: CreateBuildResponse
s@CreateBuildResponse' {} Maybe (Sensitive AwsCredentials)
a -> CreateBuildResponse
s {$sel:uploadCredentials:CreateBuildResponse' :: Maybe (Sensitive AwsCredentials)
uploadCredentials = Maybe (Sensitive AwsCredentials)
a} :: CreateBuildResponse) ((Maybe (Sensitive AwsCredentials)
  -> f (Maybe (Sensitive AwsCredentials)))
 -> CreateBuildResponse -> f CreateBuildResponse)
-> ((Maybe AwsCredentials -> f (Maybe AwsCredentials))
    -> Maybe (Sensitive AwsCredentials)
    -> f (Maybe (Sensitive AwsCredentials)))
-> (Maybe AwsCredentials -> f (Maybe AwsCredentials))
-> CreateBuildResponse
-> f CreateBuildResponse
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

-- | The newly created build resource, including a unique build IDs and
-- status.
createBuildResponse_build :: Lens.Lens' CreateBuildResponse (Prelude.Maybe Build)
createBuildResponse_build :: (Maybe Build -> f (Maybe Build))
-> CreateBuildResponse -> f CreateBuildResponse
createBuildResponse_build = (CreateBuildResponse -> Maybe Build)
-> (CreateBuildResponse -> Maybe Build -> CreateBuildResponse)
-> Lens
     CreateBuildResponse CreateBuildResponse (Maybe Build) (Maybe Build)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBuildResponse' {Maybe Build
build :: Maybe Build
$sel:build:CreateBuildResponse' :: CreateBuildResponse -> Maybe Build
build} -> Maybe Build
build) (\s :: CreateBuildResponse
s@CreateBuildResponse' {} Maybe Build
a -> CreateBuildResponse
s {$sel:build:CreateBuildResponse' :: Maybe Build
build = Maybe Build
a} :: CreateBuildResponse)

-- | The response's http status code.
createBuildResponse_httpStatus :: Lens.Lens' CreateBuildResponse Prelude.Int
createBuildResponse_httpStatus :: (Int -> f Int) -> CreateBuildResponse -> f CreateBuildResponse
createBuildResponse_httpStatus = (CreateBuildResponse -> Int)
-> (CreateBuildResponse -> Int -> CreateBuildResponse)
-> Lens CreateBuildResponse CreateBuildResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBuildResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateBuildResponse' :: CreateBuildResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateBuildResponse
s@CreateBuildResponse' {} Int
a -> CreateBuildResponse
s {$sel:httpStatus:CreateBuildResponse' :: Int
httpStatus = Int
a} :: CreateBuildResponse)

instance Prelude.NFData CreateBuildResponse