{-# 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.Alias
-- 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.Alias 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.RoutingStrategy
import qualified Amazonka.Prelude as Prelude

-- | Properties that describe an alias resource.
--
-- __Related actions__
--
-- <https://docs.aws.amazon.com/gamelift/latest/developerguide/reference-awssdk.html#reference-awssdk-resources-fleets All APIs by task>
--
-- /See:/ 'newAlias' smart constructor.
data Alias = Alias'
  { -- | The Amazon Resource Name
    -- (<https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-arn-format.html ARN>)
    -- that is assigned to a GameLift alias resource and uniquely identifies
    -- it. ARNs are unique across all Regions. Format is
    -- @arn:aws:gamelift:\<region>::alias\/alias-a1234567-b8c9-0d1e-2fa3-b45c6d7e8912@.
    -- In a GameLift alias ARN, the resource ID matches the alias ID value.
    Alias -> Maybe Text
aliasArn :: Prelude.Maybe Prelude.Text,
    -- | A unique identifier for the alias. Alias IDs are unique within a Region.
    Alias -> Maybe Text
aliasId :: 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\"@).
    Alias -> Maybe POSIX
creationTime :: Prelude.Maybe Data.POSIX,
    -- | A human-readable description of an alias.
    Alias -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The time that this data object was last modified. Format is a number
    -- expressed in Unix time as milliseconds (for example
    -- @\"1469498468.057\"@).
    Alias -> Maybe POSIX
lastUpdatedTime :: Prelude.Maybe Data.POSIX,
    -- | A descriptive label that is associated with an alias. Alias names do not
    -- need to be unique.
    Alias -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The routing configuration, including routing type and fleet target, for
    -- the alias.
    Alias -> Maybe RoutingStrategy
routingStrategy :: Prelude.Maybe RoutingStrategy
  }
  deriving (Alias -> Alias -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Alias -> Alias -> Bool
$c/= :: Alias -> Alias -> Bool
== :: Alias -> Alias -> Bool
$c== :: Alias -> Alias -> Bool
Prelude.Eq, ReadPrec [Alias]
ReadPrec Alias
Int -> ReadS Alias
ReadS [Alias]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Alias]
$creadListPrec :: ReadPrec [Alias]
readPrec :: ReadPrec Alias
$creadPrec :: ReadPrec Alias
readList :: ReadS [Alias]
$creadList :: ReadS [Alias]
readsPrec :: Int -> ReadS Alias
$creadsPrec :: Int -> ReadS Alias
Prelude.Read, Int -> Alias -> ShowS
[Alias] -> ShowS
Alias -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Alias] -> ShowS
$cshowList :: [Alias] -> ShowS
show :: Alias -> String
$cshow :: Alias -> String
showsPrec :: Int -> Alias -> ShowS
$cshowsPrec :: Int -> Alias -> ShowS
Prelude.Show, forall x. Rep Alias x -> Alias
forall x. Alias -> Rep Alias x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Alias x -> Alias
$cfrom :: forall x. Alias -> Rep Alias x
Prelude.Generic)

-- |
-- Create a value of 'Alias' 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:
--
-- 'aliasArn', 'alias_aliasArn' - The Amazon Resource Name
-- (<https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-arn-format.html ARN>)
-- that is assigned to a GameLift alias resource and uniquely identifies
-- it. ARNs are unique across all Regions. Format is
-- @arn:aws:gamelift:\<region>::alias\/alias-a1234567-b8c9-0d1e-2fa3-b45c6d7e8912@.
-- In a GameLift alias ARN, the resource ID matches the alias ID value.
--
-- 'aliasId', 'alias_aliasId' - A unique identifier for the alias. Alias IDs are unique within a Region.
--
-- 'creationTime', 'alias_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\"@).
--
-- 'description', 'alias_description' - A human-readable description of an alias.
--
-- 'lastUpdatedTime', 'alias_lastUpdatedTime' - The time that this data object was last modified. Format is a number
-- expressed in Unix time as milliseconds (for example
-- @\"1469498468.057\"@).
--
-- 'name', 'alias_name' - A descriptive label that is associated with an alias. Alias names do not
-- need to be unique.
--
-- 'routingStrategy', 'alias_routingStrategy' - The routing configuration, including routing type and fleet target, for
-- the alias.
newAlias ::
  Alias
newAlias :: Alias
newAlias =
  Alias'
    { $sel:aliasArn:Alias' :: Maybe Text
aliasArn = forall a. Maybe a
Prelude.Nothing,
      $sel:aliasId:Alias' :: Maybe Text
aliasId = forall a. Maybe a
Prelude.Nothing,
      $sel:creationTime:Alias' :: Maybe POSIX
creationTime = forall a. Maybe a
Prelude.Nothing,
      $sel:description:Alias' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:lastUpdatedTime:Alias' :: Maybe POSIX
lastUpdatedTime = forall a. Maybe a
Prelude.Nothing,
      $sel:name:Alias' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:routingStrategy:Alias' :: Maybe RoutingStrategy
routingStrategy = forall a. Maybe a
Prelude.Nothing
    }

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

-- | A unique identifier for the alias. Alias IDs are unique within a Region.
alias_aliasId :: Lens.Lens' Alias (Prelude.Maybe Prelude.Text)
alias_aliasId :: Lens' Alias (Maybe Text)
alias_aliasId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Alias' {Maybe Text
aliasId :: Maybe Text
$sel:aliasId:Alias' :: Alias -> Maybe Text
aliasId} -> Maybe Text
aliasId) (\s :: Alias
s@Alias' {} Maybe Text
a -> Alias
s {$sel:aliasId:Alias' :: Maybe Text
aliasId = Maybe Text
a} :: Alias)

-- | A time stamp indicating when this data object was created. Format is a
-- number expressed in Unix time as milliseconds (for example
-- @\"1469498468.057\"@).
alias_creationTime :: Lens.Lens' Alias (Prelude.Maybe Prelude.UTCTime)
alias_creationTime :: Lens' Alias (Maybe UTCTime)
alias_creationTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Alias' {Maybe POSIX
creationTime :: Maybe POSIX
$sel:creationTime:Alias' :: Alias -> Maybe POSIX
creationTime} -> Maybe POSIX
creationTime) (\s :: Alias
s@Alias' {} Maybe POSIX
a -> Alias
s {$sel:creationTime:Alias' :: Maybe POSIX
creationTime = Maybe POSIX
a} :: Alias) 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 human-readable description of an alias.
alias_description :: Lens.Lens' Alias (Prelude.Maybe Prelude.Text)
alias_description :: Lens' Alias (Maybe Text)
alias_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Alias' {Maybe Text
description :: Maybe Text
$sel:description:Alias' :: Alias -> Maybe Text
description} -> Maybe Text
description) (\s :: Alias
s@Alias' {} Maybe Text
a -> Alias
s {$sel:description:Alias' :: Maybe Text
description = Maybe Text
a} :: Alias)

-- | The time that this data object was last modified. Format is a number
-- expressed in Unix time as milliseconds (for example
-- @\"1469498468.057\"@).
alias_lastUpdatedTime :: Lens.Lens' Alias (Prelude.Maybe Prelude.UTCTime)
alias_lastUpdatedTime :: Lens' Alias (Maybe UTCTime)
alias_lastUpdatedTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Alias' {Maybe POSIX
lastUpdatedTime :: Maybe POSIX
$sel:lastUpdatedTime:Alias' :: Alias -> Maybe POSIX
lastUpdatedTime} -> Maybe POSIX
lastUpdatedTime) (\s :: Alias
s@Alias' {} Maybe POSIX
a -> Alias
s {$sel:lastUpdatedTime:Alias' :: Maybe POSIX
lastUpdatedTime = Maybe POSIX
a} :: Alias) 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 that is associated with an alias. Alias names do not
-- need to be unique.
alias_name :: Lens.Lens' Alias (Prelude.Maybe Prelude.Text)
alias_name :: Lens' Alias (Maybe Text)
alias_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Alias' {Maybe Text
name :: Maybe Text
$sel:name:Alias' :: Alias -> Maybe Text
name} -> Maybe Text
name) (\s :: Alias
s@Alias' {} Maybe Text
a -> Alias
s {$sel:name:Alias' :: Maybe Text
name = Maybe Text
a} :: Alias)

-- | The routing configuration, including routing type and fleet target, for
-- the alias.
alias_routingStrategy :: Lens.Lens' Alias (Prelude.Maybe RoutingStrategy)
alias_routingStrategy :: Lens' Alias (Maybe RoutingStrategy)
alias_routingStrategy = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Alias' {Maybe RoutingStrategy
routingStrategy :: Maybe RoutingStrategy
$sel:routingStrategy:Alias' :: Alias -> Maybe RoutingStrategy
routingStrategy} -> Maybe RoutingStrategy
routingStrategy) (\s :: Alias
s@Alias' {} Maybe RoutingStrategy
a -> Alias
s {$sel:routingStrategy:Alias' :: Maybe RoutingStrategy
routingStrategy = Maybe RoutingStrategy
a} :: Alias)

instance Data.FromJSON Alias where
  parseJSON :: Value -> Parser Alias
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Alias"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe RoutingStrategy
-> Alias
Alias'
            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
"AliasArn")
            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
"AliasId")
            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
"Description")
            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
"LastUpdatedTime")
            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
"RoutingStrategy")
      )

instance Prelude.Hashable Alias where
  hashWithSalt :: Int -> Alias -> Int
hashWithSalt Int
_salt Alias' {Maybe Text
Maybe POSIX
Maybe RoutingStrategy
routingStrategy :: Maybe RoutingStrategy
name :: Maybe Text
lastUpdatedTime :: Maybe POSIX
description :: Maybe Text
creationTime :: Maybe POSIX
aliasId :: Maybe Text
aliasArn :: Maybe Text
$sel:routingStrategy:Alias' :: Alias -> Maybe RoutingStrategy
$sel:name:Alias' :: Alias -> Maybe Text
$sel:lastUpdatedTime:Alias' :: Alias -> Maybe POSIX
$sel:description:Alias' :: Alias -> Maybe Text
$sel:creationTime:Alias' :: Alias -> Maybe POSIX
$sel:aliasId:Alias' :: Alias -> Maybe Text
$sel:aliasArn:Alias' :: Alias -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
aliasArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
aliasId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
creationTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
lastUpdatedTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe RoutingStrategy
routingStrategy

instance Prelude.NFData Alias where
  rnf :: Alias -> ()
rnf Alias' {Maybe Text
Maybe POSIX
Maybe RoutingStrategy
routingStrategy :: Maybe RoutingStrategy
name :: Maybe Text
lastUpdatedTime :: Maybe POSIX
description :: Maybe Text
creationTime :: Maybe POSIX
aliasId :: Maybe Text
aliasArn :: Maybe Text
$sel:routingStrategy:Alias' :: Alias -> Maybe RoutingStrategy
$sel:name:Alias' :: Alias -> Maybe Text
$sel:lastUpdatedTime:Alias' :: Alias -> Maybe POSIX
$sel:description:Alias' :: Alias -> Maybe Text
$sel:creationTime:Alias' :: Alias -> Maybe POSIX
$sel:aliasId:Alias' :: Alias -> Maybe Text
$sel:aliasArn:Alias' :: Alias -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
aliasArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
aliasId
      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
description
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
lastUpdatedTime
      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 RoutingStrategy
routingStrategy