{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# 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.Types.Build
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.GameLift.Types.Build where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.GameLift.Types.BuildStatus
import Amazonka.GameLift.Types.OperatingSystem
import qualified Amazonka.Prelude as Prelude

-- | Properties describing a custom game build.
--
-- <https://docs.aws.amazon.com/gamelift/latest/developerguide/reference-awssdk.html#reference-awssdk-resources-fleets All APIs by task>
--
-- /See:/ 'newBuild' smart constructor.
data Build = Build'
  { -- | The Amazon Resource Name
    -- (<https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-arn-format.html ARN>)
    -- assigned to a GameLift build resource and uniquely identifies it. ARNs
    -- are unique across all Regions. Format is
    -- @arn:aws:gamelift:\<region>::build\/build-a1234567-b8c9-0d1e-2fa3-b45c6d7e8912@.
    -- In a GameLift build ARN, the resource ID matches the /BuildId/ value.
    Build -> Maybe Text
buildArn :: Prelude.Maybe Prelude.Text,
    -- | A unique identifier for the build.
    Build -> Maybe Text
buildId :: Prelude.Maybe Prelude.Text,
    -- | A time stamp indicating when this data object was created. Format is a
    -- number expressed in Unix time as milliseconds (for example
    -- @\"1469498468.057\"@).
    Build -> Maybe POSIX
creationTime :: Prelude.Maybe Data.POSIX,
    -- | A descriptive label associated with a build. Build names do not need to
    -- be unique. It can be set using
    -- <https://docs.aws.amazon.com/gamelift/latest/apireference/API_CreateBuild.html CreateBuild>
    -- or
    -- <https://docs.aws.amazon.com/gamelift/latest/apireference/UpdateBuild UpdateBuild>.
    Build -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | 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.
    Build -> Maybe OperatingSystem
operatingSystem :: Prelude.Maybe OperatingSystem,
    -- | The GameLift Server SDK version used to develop your game server.
    Build -> Maybe Text
serverSdkVersion :: Prelude.Maybe Prelude.Text,
    -- | File size of the uploaded game build, expressed in bytes. When the build
    -- status is @INITIALIZED@ or when using a custom Amazon S3 storage
    -- location, this value is 0.
    Build -> Maybe Natural
sizeOnDisk :: Prelude.Maybe Prelude.Natural,
    -- | Current status of the build.
    --
    -- Possible build statuses include the following:
    --
    -- -   __INITIALIZED__ -- A new build has been defined, but no files have
    --     been uploaded. You cannot create fleets for builds that are in this
    --     status. When a build is successfully created, the build status is
    --     set to this value.
    --
    -- -   __READY__ -- The game build has been successfully uploaded. You can
    --     now create new fleets for this build.
    --
    -- -   __FAILED__ -- The game build upload failed. You cannot create new
    --     fleets for this build.
    Build -> Maybe BuildStatus
status :: Prelude.Maybe BuildStatus,
    -- | Version information associated with a build or script. Version strings
    -- do not need to be unique.
    Build -> Maybe Text
version :: Prelude.Maybe Prelude.Text
  }
  deriving (Build -> Build -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Build -> Build -> Bool
$c/= :: Build -> Build -> Bool
== :: Build -> Build -> Bool
$c== :: Build -> Build -> Bool
Prelude.Eq, ReadPrec [Build]
ReadPrec Build
Int -> ReadS Build
ReadS [Build]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Build]
$creadListPrec :: ReadPrec [Build]
readPrec :: ReadPrec Build
$creadPrec :: ReadPrec Build
readList :: ReadS [Build]
$creadList :: ReadS [Build]
readsPrec :: Int -> ReadS Build
$creadsPrec :: Int -> ReadS Build
Prelude.Read, Int -> Build -> ShowS
[Build] -> ShowS
Build -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Build] -> ShowS
$cshowList :: [Build] -> ShowS
show :: Build -> String
$cshow :: Build -> String
showsPrec :: Int -> Build -> ShowS
$cshowsPrec :: Int -> Build -> ShowS
Prelude.Show, forall x. Rep Build x -> Build
forall x. Build -> Rep Build x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Build x -> Build
$cfrom :: forall x. Build -> Rep Build x
Prelude.Generic)

-- |
-- Create a value of 'Build' 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:
--
-- 'buildArn', 'build_buildArn' - The Amazon Resource Name
-- (<https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-arn-format.html ARN>)
-- assigned to a GameLift build resource and uniquely identifies it. ARNs
-- are unique across all Regions. Format is
-- @arn:aws:gamelift:\<region>::build\/build-a1234567-b8c9-0d1e-2fa3-b45c6d7e8912@.
-- In a GameLift build ARN, the resource ID matches the /BuildId/ value.
--
-- 'buildId', 'build_buildId' - A unique identifier for the build.
--
-- 'creationTime', 'build_creationTime' - A time stamp indicating when this data object was created. Format is a
-- number expressed in Unix time as milliseconds (for example
-- @\"1469498468.057\"@).
--
-- 'name', 'build_name' - A descriptive label associated with a build. Build names do not need to
-- be unique. It can be set using
-- <https://docs.aws.amazon.com/gamelift/latest/apireference/API_CreateBuild.html CreateBuild>
-- or
-- <https://docs.aws.amazon.com/gamelift/latest/apireference/UpdateBuild UpdateBuild>.
--
-- 'operatingSystem', 'build_operatingSystem' - 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.
--
-- 'serverSdkVersion', 'build_serverSdkVersion' - The GameLift Server SDK version used to develop your game server.
--
-- 'sizeOnDisk', 'build_sizeOnDisk' - File size of the uploaded game build, expressed in bytes. When the build
-- status is @INITIALIZED@ or when using a custom Amazon S3 storage
-- location, this value is 0.
--
-- 'status', 'build_status' - Current status of the build.
--
-- Possible build statuses include the following:
--
-- -   __INITIALIZED__ -- A new build has been defined, but no files have
--     been uploaded. You cannot create fleets for builds that are in this
--     status. When a build is successfully created, the build status is
--     set to this value.
--
-- -   __READY__ -- The game build has been successfully uploaded. You can
--     now create new fleets for this build.
--
-- -   __FAILED__ -- The game build upload failed. You cannot create new
--     fleets for this build.
--
-- 'version', 'build_version' - Version information associated with a build or script. Version strings
-- do not need to be unique.
newBuild ::
  Build
newBuild :: Build
newBuild =
  Build'
    { $sel:buildArn:Build' :: Maybe Text
buildArn = forall a. Maybe a
Prelude.Nothing,
      $sel:buildId:Build' :: Maybe Text
buildId = forall a. Maybe a
Prelude.Nothing,
      $sel:creationTime:Build' :: Maybe POSIX
creationTime = forall a. Maybe a
Prelude.Nothing,
      $sel:name:Build' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:operatingSystem:Build' :: Maybe OperatingSystem
operatingSystem = forall a. Maybe a
Prelude.Nothing,
      $sel:serverSdkVersion:Build' :: Maybe Text
serverSdkVersion = forall a. Maybe a
Prelude.Nothing,
      $sel:sizeOnDisk:Build' :: Maybe Natural
sizeOnDisk = forall a. Maybe a
Prelude.Nothing,
      $sel:status:Build' :: Maybe BuildStatus
status = forall a. Maybe a
Prelude.Nothing,
      $sel:version:Build' :: Maybe Text
version = forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon Resource Name
-- (<https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-arn-format.html ARN>)
-- assigned to a GameLift build resource and uniquely identifies it. ARNs
-- are unique across all Regions. Format is
-- @arn:aws:gamelift:\<region>::build\/build-a1234567-b8c9-0d1e-2fa3-b45c6d7e8912@.
-- In a GameLift build ARN, the resource ID matches the /BuildId/ value.
build_buildArn :: Lens.Lens' Build (Prelude.Maybe Prelude.Text)
build_buildArn :: Lens' Build (Maybe Text)
build_buildArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Build' {Maybe Text
buildArn :: Maybe Text
$sel:buildArn:Build' :: Build -> Maybe Text
buildArn} -> Maybe Text
buildArn) (\s :: Build
s@Build' {} Maybe Text
a -> Build
s {$sel:buildArn:Build' :: Maybe Text
buildArn = Maybe Text
a} :: Build)

-- | A unique identifier for the build.
build_buildId :: Lens.Lens' Build (Prelude.Maybe Prelude.Text)
build_buildId :: Lens' Build (Maybe Text)
build_buildId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Build' {Maybe Text
buildId :: Maybe Text
$sel:buildId:Build' :: Build -> Maybe Text
buildId} -> Maybe Text
buildId) (\s :: Build
s@Build' {} Maybe Text
a -> Build
s {$sel:buildId:Build' :: Maybe Text
buildId = Maybe Text
a} :: Build)

-- | A time stamp indicating when this data object was created. Format is a
-- number expressed in Unix time as milliseconds (for example
-- @\"1469498468.057\"@).
build_creationTime :: Lens.Lens' Build (Prelude.Maybe Prelude.UTCTime)
build_creationTime :: Lens' Build (Maybe UTCTime)
build_creationTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Build' {Maybe POSIX
creationTime :: Maybe POSIX
$sel:creationTime:Build' :: Build -> Maybe POSIX
creationTime} -> Maybe POSIX
creationTime) (\s :: Build
s@Build' {} Maybe POSIX
a -> Build
s {$sel:creationTime:Build' :: Maybe POSIX
creationTime = Maybe POSIX
a} :: Build) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | A descriptive label associated with a build. Build names do not need to
-- be unique. It can be set using
-- <https://docs.aws.amazon.com/gamelift/latest/apireference/API_CreateBuild.html CreateBuild>
-- or
-- <https://docs.aws.amazon.com/gamelift/latest/apireference/UpdateBuild UpdateBuild>.
build_name :: Lens.Lens' Build (Prelude.Maybe Prelude.Text)
build_name :: Lens' Build (Maybe Text)
build_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Build' {Maybe Text
name :: Maybe Text
$sel:name:Build' :: Build -> Maybe Text
name} -> Maybe Text
name) (\s :: Build
s@Build' {} Maybe Text
a -> Build
s {$sel:name:Build' :: Maybe Text
name = Maybe Text
a} :: Build)

-- | 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.
build_operatingSystem :: Lens.Lens' Build (Prelude.Maybe OperatingSystem)
build_operatingSystem :: Lens' Build (Maybe OperatingSystem)
build_operatingSystem = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Build' {Maybe OperatingSystem
operatingSystem :: Maybe OperatingSystem
$sel:operatingSystem:Build' :: Build -> Maybe OperatingSystem
operatingSystem} -> Maybe OperatingSystem
operatingSystem) (\s :: Build
s@Build' {} Maybe OperatingSystem
a -> Build
s {$sel:operatingSystem:Build' :: Maybe OperatingSystem
operatingSystem = Maybe OperatingSystem
a} :: Build)

-- | The GameLift Server SDK version used to develop your game server.
build_serverSdkVersion :: Lens.Lens' Build (Prelude.Maybe Prelude.Text)
build_serverSdkVersion :: Lens' Build (Maybe Text)
build_serverSdkVersion = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Build' {Maybe Text
serverSdkVersion :: Maybe Text
$sel:serverSdkVersion:Build' :: Build -> Maybe Text
serverSdkVersion} -> Maybe Text
serverSdkVersion) (\s :: Build
s@Build' {} Maybe Text
a -> Build
s {$sel:serverSdkVersion:Build' :: Maybe Text
serverSdkVersion = Maybe Text
a} :: Build)

-- | File size of the uploaded game build, expressed in bytes. When the build
-- status is @INITIALIZED@ or when using a custom Amazon S3 storage
-- location, this value is 0.
build_sizeOnDisk :: Lens.Lens' Build (Prelude.Maybe Prelude.Natural)
build_sizeOnDisk :: Lens' Build (Maybe Natural)
build_sizeOnDisk = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Build' {Maybe Natural
sizeOnDisk :: Maybe Natural
$sel:sizeOnDisk:Build' :: Build -> Maybe Natural
sizeOnDisk} -> Maybe Natural
sizeOnDisk) (\s :: Build
s@Build' {} Maybe Natural
a -> Build
s {$sel:sizeOnDisk:Build' :: Maybe Natural
sizeOnDisk = Maybe Natural
a} :: Build)

-- | Current status of the build.
--
-- Possible build statuses include the following:
--
-- -   __INITIALIZED__ -- A new build has been defined, but no files have
--     been uploaded. You cannot create fleets for builds that are in this
--     status. When a build is successfully created, the build status is
--     set to this value.
--
-- -   __READY__ -- The game build has been successfully uploaded. You can
--     now create new fleets for this build.
--
-- -   __FAILED__ -- The game build upload failed. You cannot create new
--     fleets for this build.
build_status :: Lens.Lens' Build (Prelude.Maybe BuildStatus)
build_status :: Lens' Build (Maybe BuildStatus)
build_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Build' {Maybe BuildStatus
status :: Maybe BuildStatus
$sel:status:Build' :: Build -> Maybe BuildStatus
status} -> Maybe BuildStatus
status) (\s :: Build
s@Build' {} Maybe BuildStatus
a -> Build
s {$sel:status:Build' :: Maybe BuildStatus
status = Maybe BuildStatus
a} :: Build)

-- | Version information associated with a build or script. Version strings
-- do not need to be unique.
build_version :: Lens.Lens' Build (Prelude.Maybe Prelude.Text)
build_version :: Lens' Build (Maybe Text)
build_version = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Build' {Maybe Text
version :: Maybe Text
$sel:version:Build' :: Build -> Maybe Text
version} -> Maybe Text
version) (\s :: Build
s@Build' {} Maybe Text
a -> Build
s {$sel:version:Build' :: Maybe Text
version = Maybe Text
a} :: Build)

instance Data.FromJSON Build where
  parseJSON :: Value -> Parser Build
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Build"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe OperatingSystem
-> Maybe Text
-> Maybe Natural
-> Maybe BuildStatus
-> Maybe Text
-> Build
Build'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"BuildArn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"BuildId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"CreationTime")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Name")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"OperatingSystem")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"ServerSdkVersion")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"SizeOnDisk")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Status")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Version")
      )

instance Prelude.Hashable Build where
  hashWithSalt :: Int -> Build -> Int
hashWithSalt Int
_salt Build' {Maybe Natural
Maybe Text
Maybe POSIX
Maybe BuildStatus
Maybe OperatingSystem
version :: Maybe Text
status :: Maybe BuildStatus
sizeOnDisk :: Maybe Natural
serverSdkVersion :: Maybe Text
operatingSystem :: Maybe OperatingSystem
name :: Maybe Text
creationTime :: Maybe POSIX
buildId :: Maybe Text
buildArn :: Maybe Text
$sel:version:Build' :: Build -> Maybe Text
$sel:status:Build' :: Build -> Maybe BuildStatus
$sel:sizeOnDisk:Build' :: Build -> Maybe Natural
$sel:serverSdkVersion:Build' :: Build -> Maybe Text
$sel:operatingSystem:Build' :: Build -> Maybe OperatingSystem
$sel:name:Build' :: Build -> Maybe Text
$sel:creationTime:Build' :: Build -> Maybe POSIX
$sel:buildId:Build' :: Build -> Maybe Text
$sel:buildArn:Build' :: Build -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
buildArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
buildId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
creationTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe OperatingSystem
operatingSystem
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
serverSdkVersion
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
sizeOnDisk
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe BuildStatus
status
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
version

instance Prelude.NFData Build where
  rnf :: Build -> ()
rnf Build' {Maybe Natural
Maybe Text
Maybe POSIX
Maybe BuildStatus
Maybe OperatingSystem
version :: Maybe Text
status :: Maybe BuildStatus
sizeOnDisk :: Maybe Natural
serverSdkVersion :: Maybe Text
operatingSystem :: Maybe OperatingSystem
name :: Maybe Text
creationTime :: Maybe POSIX
buildId :: Maybe Text
buildArn :: Maybe Text
$sel:version:Build' :: Build -> Maybe Text
$sel:status:Build' :: Build -> Maybe BuildStatus
$sel:sizeOnDisk:Build' :: Build -> Maybe Natural
$sel:serverSdkVersion:Build' :: Build -> Maybe Text
$sel:operatingSystem:Build' :: Build -> Maybe OperatingSystem
$sel:name:Build' :: Build -> Maybe Text
$sel:creationTime:Build' :: Build -> Maybe POSIX
$sel:buildId:Build' :: Build -> Maybe Text
$sel:buildArn:Build' :: Build -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
buildArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
buildId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
creationTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe OperatingSystem
operatingSystem
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
serverSdkVersion
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
sizeOnDisk
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe BuildStatus
status
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
version