{-# 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-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)
module Amazonka.GameLift.Types.Build where

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

-- | Properties describing a custom game build.
--
-- __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>
--
-- /See:/ 'newBuild' smart constructor.
data Build = 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 -> Maybe POSIX
creationTime :: Prelude.Maybe Core.POSIX,
    -- | 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,
    -- | 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,
    -- | A unique identifier for the build.
    Build -> Maybe Text
buildId :: Prelude.Maybe Prelude.Text,
    -- | A descriptive label that is associated with a build. Build names do not
    -- need to be unique. It can be set using CreateBuild or UpdateBuild.
    Build -> 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. This value can be set using
    -- CreateBuild or UpdateBuild.
    Build -> Maybe Text
version :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name
    -- (<https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-arn-format.html ARN>)
    -- that is 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,
    -- | File size of the uploaded game build, expressed in bytes. When the build
    -- status is @INITIALIZED@, this value is 0.
    Build -> Maybe Natural
sizeOnDisk :: Prelude.Maybe Prelude.Natural
  }
  deriving (Build -> Build -> Bool
(Build -> Build -> Bool) -> (Build -> Build -> Bool) -> Eq Build
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]
(Int -> ReadS Build)
-> ReadS [Build]
-> ReadPrec Build
-> ReadPrec [Build]
-> Read 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
(Int -> Build -> ShowS)
-> (Build -> String) -> ([Build] -> ShowS) -> Show Build
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. Build -> Rep Build x)
-> (forall x. Rep Build x -> Build) -> Generic Build
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:
--
-- '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\"@).
--
-- '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.
--
-- '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.
--
-- 'buildId', 'build_buildId' - A unique identifier for the build.
--
-- 'name', 'build_name' - A descriptive label that is associated with a build. Build names do not
-- need to be unique. It can be set using CreateBuild or UpdateBuild.
--
-- 'version', 'build_version' - Version information that is associated with a build or script. Version
-- strings do not need to be unique. This value can be set using
-- CreateBuild or UpdateBuild.
--
-- 'buildArn', 'build_buildArn' - The Amazon Resource Name
-- (<https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-arn-format.html ARN>)
-- that is 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.
--
-- 'sizeOnDisk', 'build_sizeOnDisk' - File size of the uploaded game build, expressed in bytes. When the build
-- status is @INITIALIZED@, this value is 0.
newBuild ::
  Build
newBuild :: Build
newBuild =
  Build' :: Maybe POSIX
-> Maybe BuildStatus
-> Maybe OperatingSystem
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Natural
-> Build
Build'
    { $sel:creationTime:Build' :: Maybe POSIX
creationTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:status:Build' :: Maybe BuildStatus
status = Maybe BuildStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:operatingSystem:Build' :: Maybe OperatingSystem
operatingSystem = Maybe OperatingSystem
forall a. Maybe a
Prelude.Nothing,
      $sel:buildId:Build' :: Maybe Text
buildId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:Build' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:version:Build' :: Maybe Text
version = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:buildArn:Build' :: Maybe Text
buildArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:sizeOnDisk:Build' :: Maybe Natural
sizeOnDisk = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | 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 :: (Maybe UTCTime -> f (Maybe UTCTime)) -> Build -> f Build
build_creationTime = (Build -> Maybe POSIX)
-> (Build -> Maybe POSIX -> Build)
-> Lens Build Build (Maybe POSIX) (Maybe POSIX)
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) ((Maybe POSIX -> f (Maybe POSIX)) -> Build -> f Build)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Build
-> f Build
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | 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 :: (Maybe BuildStatus -> f (Maybe BuildStatus)) -> Build -> f Build
build_status = (Build -> Maybe BuildStatus)
-> (Build -> Maybe BuildStatus -> Build)
-> Lens Build Build (Maybe BuildStatus) (Maybe BuildStatus)
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)

-- | 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 :: (Maybe OperatingSystem -> f (Maybe OperatingSystem))
-> Build -> f Build
build_operatingSystem = (Build -> Maybe OperatingSystem)
-> (Build -> Maybe OperatingSystem -> Build)
-> Lens Build Build (Maybe OperatingSystem) (Maybe 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)

-- | A unique identifier for the build.
build_buildId :: Lens.Lens' Build (Prelude.Maybe Prelude.Text)
build_buildId :: (Maybe Text -> f (Maybe Text)) -> Build -> f Build
build_buildId = (Build -> Maybe Text)
-> (Build -> Maybe Text -> Build)
-> Lens Build Build (Maybe Text) (Maybe Text)
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 descriptive label that is associated with a build. Build names do not
-- need to be unique. It can be set using CreateBuild or UpdateBuild.
build_name :: Lens.Lens' Build (Prelude.Maybe Prelude.Text)
build_name :: (Maybe Text -> f (Maybe Text)) -> Build -> f Build
build_name = (Build -> Maybe Text)
-> (Build -> Maybe Text -> Build)
-> Lens Build Build (Maybe Text) (Maybe Text)
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)

-- | Version information that is associated with a build or script. Version
-- strings do not need to be unique. This value can be set using
-- CreateBuild or UpdateBuild.
build_version :: Lens.Lens' Build (Prelude.Maybe Prelude.Text)
build_version :: (Maybe Text -> f (Maybe Text)) -> Build -> f Build
build_version = (Build -> Maybe Text)
-> (Build -> Maybe Text -> Build)
-> Lens Build Build (Maybe Text) (Maybe Text)
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)

-- | The Amazon Resource Name
-- (<https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-arn-format.html ARN>)
-- that is 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 :: (Maybe Text -> f (Maybe Text)) -> Build -> f Build
build_buildArn = (Build -> Maybe Text)
-> (Build -> Maybe Text -> Build)
-> Lens Build Build (Maybe Text) (Maybe Text)
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)

-- | File size of the uploaded game build, expressed in bytes. When the build
-- status is @INITIALIZED@, this value is 0.
build_sizeOnDisk :: Lens.Lens' Build (Prelude.Maybe Prelude.Natural)
build_sizeOnDisk :: (Maybe Natural -> f (Maybe Natural)) -> Build -> f Build
build_sizeOnDisk = (Build -> Maybe Natural)
-> (Build -> Maybe Natural -> Build)
-> Lens Build Build (Maybe Natural) (Maybe Natural)
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)

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

instance Prelude.Hashable Build

instance Prelude.NFData Build