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

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

-- | A remote location where a multi-location fleet can deploy EC2 instances
-- for game hosting.
--
-- __Related actions__
--
-- CreateFleet
--
-- /See:/ 'newLocationConfiguration' smart constructor.
data LocationConfiguration = LocationConfiguration'
  { -- | An AWS Region code, such as @us-west-2@.
    LocationConfiguration -> Maybe Text
location :: Prelude.Maybe Prelude.Text
  }
  deriving (LocationConfiguration -> LocationConfiguration -> Bool
(LocationConfiguration -> LocationConfiguration -> Bool)
-> (LocationConfiguration -> LocationConfiguration -> Bool)
-> Eq LocationConfiguration
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]
(Int -> ReadS LocationConfiguration)
-> ReadS [LocationConfiguration]
-> ReadPrec LocationConfiguration
-> ReadPrec [LocationConfiguration]
-> Read 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
(Int -> LocationConfiguration -> ShowS)
-> (LocationConfiguration -> String)
-> ([LocationConfiguration] -> ShowS)
-> Show LocationConfiguration
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. LocationConfiguration -> Rep LocationConfiguration x)
-> (forall x. Rep LocationConfiguration x -> LocationConfiguration)
-> Generic LocationConfiguration
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 AWS Region code, such as @us-west-2@.
newLocationConfiguration ::
  LocationConfiguration
newLocationConfiguration :: LocationConfiguration
newLocationConfiguration =
  LocationConfiguration' :: Maybe Text -> LocationConfiguration
LocationConfiguration' {$sel:location:LocationConfiguration' :: Maybe Text
location = Maybe Text
forall a. Maybe a
Prelude.Nothing}

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

instance Prelude.Hashable LocationConfiguration

instance Prelude.NFData LocationConfiguration

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