{-# 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-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.Alias where

import qualified Amazonka.Core as Core
import Amazonka.GameLift.Types.RoutingStrategy
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Properties that describe an alias resource.
--
-- __Related actions__
--
-- CreateAlias | ListAliases | DescribeAlias | UpdateAlias | DeleteAlias |
-- ResolveAlias |
-- <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'
  { -- | 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 Core.POSIX,
    -- | 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 Core.POSIX,
    -- | A unique identifier for the alias. Alias IDs are unique within a Region.
    Alias -> Maybe Text
aliasId :: Prelude.Maybe Prelude.Text,
    -- | The routing configuration, including routing type and fleet target, for
    -- the alias.
    Alias -> Maybe RoutingStrategy
routingStrategy :: Prelude.Maybe RoutingStrategy,
    -- | 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 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 human-readable description of an alias.
    Alias -> Maybe Text
description :: Prelude.Maybe Prelude.Text
  }
  deriving (Alias -> Alias -> Bool
(Alias -> Alias -> Bool) -> (Alias -> Alias -> Bool) -> Eq Alias
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]
(Int -> ReadS Alias)
-> ReadS [Alias]
-> ReadPrec Alias
-> ReadPrec [Alias]
-> Read 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
(Int -> Alias -> ShowS)
-> (Alias -> String) -> ([Alias] -> ShowS) -> Show Alias
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. Alias -> Rep Alias x)
-> (forall x. Rep Alias x -> Alias) -> Generic Alias
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:
--
-- '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\"@).
--
-- '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\"@).
--
-- 'aliasId', 'alias_aliasId' - A unique identifier for the alias. Alias IDs are unique within a Region.
--
-- 'routingStrategy', 'alias_routingStrategy' - The routing configuration, including routing type and fleet target, for
-- the alias.
--
-- 'name', 'alias_name' - A descriptive label that is associated with an alias. Alias names do not
-- need to be unique.
--
-- '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.
--
-- 'description', 'alias_description' - A human-readable description of an alias.
newAlias ::
  Alias
newAlias :: Alias
newAlias =
  Alias' :: Maybe POSIX
-> Maybe POSIX
-> Maybe Text
-> Maybe RoutingStrategy
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Alias
Alias'
    { $sel:creationTime:Alias' :: Maybe POSIX
creationTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:lastUpdatedTime:Alias' :: Maybe POSIX
lastUpdatedTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:aliasId:Alias' :: Maybe Text
aliasId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:routingStrategy:Alias' :: Maybe RoutingStrategy
routingStrategy = Maybe RoutingStrategy
forall a. Maybe a
Prelude.Nothing,
      $sel:name:Alias' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:aliasArn:Alias' :: Maybe Text
aliasArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:description:Alias' :: Maybe Text
description = Maybe Text
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\"@).
alias_creationTime :: Lens.Lens' Alias (Prelude.Maybe Prelude.UTCTime)
alias_creationTime :: (Maybe UTCTime -> f (Maybe UTCTime)) -> Alias -> f Alias
alias_creationTime = (Alias -> Maybe POSIX)
-> (Alias -> Maybe POSIX -> Alias)
-> Lens Alias Alias (Maybe POSIX) (Maybe POSIX)
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) ((Maybe POSIX -> f (Maybe POSIX)) -> Alias -> f Alias)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Alias
-> f Alias
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

-- | 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 :: (Maybe UTCTime -> f (Maybe UTCTime)) -> Alias -> f Alias
alias_lastUpdatedTime = (Alias -> Maybe POSIX)
-> (Alias -> Maybe POSIX -> Alias)
-> Lens Alias Alias (Maybe POSIX) (Maybe POSIX)
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) ((Maybe POSIX -> f (Maybe POSIX)) -> Alias -> f Alias)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Alias
-> f Alias
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

-- | A unique identifier for the alias. Alias IDs are unique within a Region.
alias_aliasId :: Lens.Lens' Alias (Prelude.Maybe Prelude.Text)
alias_aliasId :: (Maybe Text -> f (Maybe Text)) -> Alias -> f Alias
alias_aliasId = (Alias -> Maybe Text)
-> (Alias -> Maybe Text -> Alias)
-> Lens Alias Alias (Maybe Text) (Maybe Text)
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)

-- | The routing configuration, including routing type and fleet target, for
-- the alias.
alias_routingStrategy :: Lens.Lens' Alias (Prelude.Maybe RoutingStrategy)
alias_routingStrategy :: (Maybe RoutingStrategy -> f (Maybe RoutingStrategy))
-> Alias -> f Alias
alias_routingStrategy = (Alias -> Maybe RoutingStrategy)
-> (Alias -> Maybe RoutingStrategy -> Alias)
-> Lens Alias Alias (Maybe RoutingStrategy) (Maybe 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)

-- | 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 :: (Maybe Text -> f (Maybe Text)) -> Alias -> f Alias
alias_name = (Alias -> Maybe Text)
-> (Alias -> Maybe Text -> Alias)
-> Lens Alias Alias (Maybe Text) (Maybe Text)
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 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 :: (Maybe Text -> f (Maybe Text)) -> Alias -> f Alias
alias_aliasArn = (Alias -> Maybe Text)
-> (Alias -> Maybe Text -> Alias)
-> Lens Alias Alias (Maybe Text) (Maybe Text)
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 human-readable description of an alias.
alias_description :: Lens.Lens' Alias (Prelude.Maybe Prelude.Text)
alias_description :: (Maybe Text -> f (Maybe Text)) -> Alias -> f Alias
alias_description = (Alias -> Maybe Text)
-> (Alias -> Maybe Text -> Alias)
-> Lens Alias Alias (Maybe Text) (Maybe Text)
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)

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

instance Prelude.Hashable Alias

instance Prelude.NFData Alias