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

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

-- | A remote location where a multi-location fleet can deploy EC2 instances
-- for game hosting.
--
-- /See:/ 'newLocationConfiguration' smart constructor.
data LocationConfiguration = LocationConfiguration'
  { -- | An Amazon Web Services Region code, such as @us-west-2@.
    LocationConfiguration -> Text
location :: Prelude.Text
  }
  deriving (LocationConfiguration -> LocationConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LocationConfiguration -> LocationConfiguration -> Bool
$c/= :: LocationConfiguration -> LocationConfiguration -> Bool
== :: LocationConfiguration -> LocationConfiguration -> Bool
$c== :: LocationConfiguration -> LocationConfiguration -> Bool
Prelude.Eq, ReadPrec [LocationConfiguration]
ReadPrec LocationConfiguration
Int -> ReadS LocationConfiguration
ReadS [LocationConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LocationConfiguration]
$creadListPrec :: ReadPrec [LocationConfiguration]
readPrec :: ReadPrec LocationConfiguration
$creadPrec :: ReadPrec LocationConfiguration
readList :: ReadS [LocationConfiguration]
$creadList :: ReadS [LocationConfiguration]
readsPrec :: Int -> ReadS LocationConfiguration
$creadsPrec :: Int -> ReadS LocationConfiguration
Prelude.Read, Int -> LocationConfiguration -> ShowS
[LocationConfiguration] -> ShowS
LocationConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LocationConfiguration] -> ShowS
$cshowList :: [LocationConfiguration] -> ShowS
show :: LocationConfiguration -> String
$cshow :: LocationConfiguration -> String
showsPrec :: Int -> LocationConfiguration -> ShowS
$cshowsPrec :: Int -> LocationConfiguration -> ShowS
Prelude.Show, forall x. Rep LocationConfiguration x -> LocationConfiguration
forall x. LocationConfiguration -> Rep LocationConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LocationConfiguration x -> LocationConfiguration
$cfrom :: forall x. LocationConfiguration -> Rep LocationConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'LocationConfiguration' 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:
--
-- 'location', 'locationConfiguration_location' - An Amazon Web Services Region code, such as @us-west-2@.
newLocationConfiguration ::
  -- | 'location'
  Prelude.Text ->
  LocationConfiguration
newLocationConfiguration :: Text -> LocationConfiguration
newLocationConfiguration Text
pLocation_ =
  LocationConfiguration' {$sel:location:LocationConfiguration' :: Text
location = Text
pLocation_}

-- | An Amazon Web Services Region code, such as @us-west-2@.
locationConfiguration_location :: Lens.Lens' LocationConfiguration Prelude.Text
locationConfiguration_location :: Lens' LocationConfiguration Text
locationConfiguration_location = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LocationConfiguration' {Text
location :: Text
$sel:location:LocationConfiguration' :: LocationConfiguration -> Text
location} -> Text
location) (\s :: LocationConfiguration
s@LocationConfiguration' {} Text
a -> LocationConfiguration
s {$sel:location:LocationConfiguration' :: Text
location = Text
a} :: LocationConfiguration)

instance Prelude.Hashable LocationConfiguration where
  hashWithSalt :: Int -> LocationConfiguration -> Int
hashWithSalt Int
_salt LocationConfiguration' {Text
location :: Text
$sel:location:LocationConfiguration' :: LocationConfiguration -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
location

instance Prelude.NFData LocationConfiguration where
  rnf :: LocationConfiguration -> ()
rnf LocationConfiguration' {Text
location :: Text
$sel:location:LocationConfiguration' :: LocationConfiguration -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
location

instance Data.ToJSON LocationConfiguration where
  toJSON :: LocationConfiguration -> Value
toJSON LocationConfiguration' {Text
location :: Text
$sel:location:LocationConfiguration' :: LocationConfiguration -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [forall a. a -> Maybe a
Prelude.Just (Key
"Location" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
location)]
      )