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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | A fleet or alias designated in a game session queue. Queues fulfill
-- requests for new game sessions by placing a new game session on any of
-- the queue\'s destinations.
--
-- Destinations are part of a GameSessionQueue.
--
-- /See:/ 'newGameSessionQueueDestination' smart constructor.
data GameSessionQueueDestination = GameSessionQueueDestination'
  { -- | The Amazon Resource Name (ARN) that is assigned to fleet or fleet alias.
    -- ARNs, which include a fleet ID or alias ID and a Region name, provide a
    -- unique identifier across all Regions.
    GameSessionQueueDestination -> Maybe Text
destinationArn :: Prelude.Maybe Prelude.Text
  }
  deriving (GameSessionQueueDestination -> GameSessionQueueDestination -> Bool
(GameSessionQueueDestination
 -> GameSessionQueueDestination -> Bool)
-> (GameSessionQueueDestination
    -> GameSessionQueueDestination -> Bool)
-> Eq GameSessionQueueDestination
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GameSessionQueueDestination -> GameSessionQueueDestination -> Bool
$c/= :: GameSessionQueueDestination -> GameSessionQueueDestination -> Bool
== :: GameSessionQueueDestination -> GameSessionQueueDestination -> Bool
$c== :: GameSessionQueueDestination -> GameSessionQueueDestination -> Bool
Prelude.Eq, ReadPrec [GameSessionQueueDestination]
ReadPrec GameSessionQueueDestination
Int -> ReadS GameSessionQueueDestination
ReadS [GameSessionQueueDestination]
(Int -> ReadS GameSessionQueueDestination)
-> ReadS [GameSessionQueueDestination]
-> ReadPrec GameSessionQueueDestination
-> ReadPrec [GameSessionQueueDestination]
-> Read GameSessionQueueDestination
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GameSessionQueueDestination]
$creadListPrec :: ReadPrec [GameSessionQueueDestination]
readPrec :: ReadPrec GameSessionQueueDestination
$creadPrec :: ReadPrec GameSessionQueueDestination
readList :: ReadS [GameSessionQueueDestination]
$creadList :: ReadS [GameSessionQueueDestination]
readsPrec :: Int -> ReadS GameSessionQueueDestination
$creadsPrec :: Int -> ReadS GameSessionQueueDestination
Prelude.Read, Int -> GameSessionQueueDestination -> ShowS
[GameSessionQueueDestination] -> ShowS
GameSessionQueueDestination -> String
(Int -> GameSessionQueueDestination -> ShowS)
-> (GameSessionQueueDestination -> String)
-> ([GameSessionQueueDestination] -> ShowS)
-> Show GameSessionQueueDestination
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GameSessionQueueDestination] -> ShowS
$cshowList :: [GameSessionQueueDestination] -> ShowS
show :: GameSessionQueueDestination -> String
$cshow :: GameSessionQueueDestination -> String
showsPrec :: Int -> GameSessionQueueDestination -> ShowS
$cshowsPrec :: Int -> GameSessionQueueDestination -> ShowS
Prelude.Show, (forall x.
 GameSessionQueueDestination -> Rep GameSessionQueueDestination x)
-> (forall x.
    Rep GameSessionQueueDestination x -> GameSessionQueueDestination)
-> Generic GameSessionQueueDestination
forall x.
Rep GameSessionQueueDestination x -> GameSessionQueueDestination
forall x.
GameSessionQueueDestination -> Rep GameSessionQueueDestination x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GameSessionQueueDestination x -> GameSessionQueueDestination
$cfrom :: forall x.
GameSessionQueueDestination -> Rep GameSessionQueueDestination x
Prelude.Generic)

-- |
-- Create a value of 'GameSessionQueueDestination' 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:
--
-- 'destinationArn', 'gameSessionQueueDestination_destinationArn' - The Amazon Resource Name (ARN) that is assigned to fleet or fleet alias.
-- ARNs, which include a fleet ID or alias ID and a Region name, provide a
-- unique identifier across all Regions.
newGameSessionQueueDestination ::
  GameSessionQueueDestination
newGameSessionQueueDestination :: GameSessionQueueDestination
newGameSessionQueueDestination =
  GameSessionQueueDestination' :: Maybe Text -> GameSessionQueueDestination
GameSessionQueueDestination'
    { $sel:destinationArn:GameSessionQueueDestination' :: Maybe Text
destinationArn =
        Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon Resource Name (ARN) that is assigned to fleet or fleet alias.
-- ARNs, which include a fleet ID or alias ID and a Region name, provide a
-- unique identifier across all Regions.
gameSessionQueueDestination_destinationArn :: Lens.Lens' GameSessionQueueDestination (Prelude.Maybe Prelude.Text)
gameSessionQueueDestination_destinationArn :: (Maybe Text -> f (Maybe Text))
-> GameSessionQueueDestination -> f GameSessionQueueDestination
gameSessionQueueDestination_destinationArn = (GameSessionQueueDestination -> Maybe Text)
-> (GameSessionQueueDestination
    -> Maybe Text -> GameSessionQueueDestination)
-> Lens
     GameSessionQueueDestination
     GameSessionQueueDestination
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GameSessionQueueDestination' {Maybe Text
destinationArn :: Maybe Text
$sel:destinationArn:GameSessionQueueDestination' :: GameSessionQueueDestination -> Maybe Text
destinationArn} -> Maybe Text
destinationArn) (\s :: GameSessionQueueDestination
s@GameSessionQueueDestination' {} Maybe Text
a -> GameSessionQueueDestination
s {$sel:destinationArn:GameSessionQueueDestination' :: Maybe Text
destinationArn = Maybe Text
a} :: GameSessionQueueDestination)

instance Core.FromJSON GameSessionQueueDestination where
  parseJSON :: Value -> Parser GameSessionQueueDestination
parseJSON =
    String
-> (Object -> Parser GameSessionQueueDestination)
-> Value
-> Parser GameSessionQueueDestination
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"GameSessionQueueDestination"
      ( \Object
x ->
          Maybe Text -> GameSessionQueueDestination
GameSessionQueueDestination'
            (Maybe Text -> GameSessionQueueDestination)
-> Parser (Maybe Text) -> Parser GameSessionQueueDestination
forall (f :: * -> *) a b. Functor 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
"DestinationArn")
      )

instance Prelude.Hashable GameSessionQueueDestination

instance Prelude.NFData GameSessionQueueDestination

instance Core.ToJSON GameSessionQueueDestination where
  toJSON :: GameSessionQueueDestination -> Value
toJSON GameSessionQueueDestination' {Maybe Text
destinationArn :: Maybe Text
$sel:destinationArn:GameSessionQueueDestination' :: GameSessionQueueDestination -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"DestinationArn" 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
destinationArn
          ]
      )