{-# 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.AnywhereConfiguration
-- 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.AnywhereConfiguration 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

-- | GameLift Anywhere configuration options for your Anywhere fleets.
--
-- /See:/ 'newAnywhereConfiguration' smart constructor.
data AnywhereConfiguration = AnywhereConfiguration'
  { -- | The cost to run your fleet per hour. GameLift uses the provided cost of
    -- your fleet to balance usage in queues. For more information about
    -- queues, see
    -- <https://docs.aws.amazon.com/gamelift/latest/developerguide/queues-intro.html Setting up queues>.
    AnywhereConfiguration -> Text
cost :: Prelude.Text
  }
  deriving (AnywhereConfiguration -> AnywhereConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AnywhereConfiguration -> AnywhereConfiguration -> Bool
$c/= :: AnywhereConfiguration -> AnywhereConfiguration -> Bool
== :: AnywhereConfiguration -> AnywhereConfiguration -> Bool
$c== :: AnywhereConfiguration -> AnywhereConfiguration -> Bool
Prelude.Eq, ReadPrec [AnywhereConfiguration]
ReadPrec AnywhereConfiguration
Int -> ReadS AnywhereConfiguration
ReadS [AnywhereConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AnywhereConfiguration]
$creadListPrec :: ReadPrec [AnywhereConfiguration]
readPrec :: ReadPrec AnywhereConfiguration
$creadPrec :: ReadPrec AnywhereConfiguration
readList :: ReadS [AnywhereConfiguration]
$creadList :: ReadS [AnywhereConfiguration]
readsPrec :: Int -> ReadS AnywhereConfiguration
$creadsPrec :: Int -> ReadS AnywhereConfiguration
Prelude.Read, Int -> AnywhereConfiguration -> ShowS
[AnywhereConfiguration] -> ShowS
AnywhereConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AnywhereConfiguration] -> ShowS
$cshowList :: [AnywhereConfiguration] -> ShowS
show :: AnywhereConfiguration -> String
$cshow :: AnywhereConfiguration -> String
showsPrec :: Int -> AnywhereConfiguration -> ShowS
$cshowsPrec :: Int -> AnywhereConfiguration -> ShowS
Prelude.Show, forall x. Rep AnywhereConfiguration x -> AnywhereConfiguration
forall x. AnywhereConfiguration -> Rep AnywhereConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AnywhereConfiguration x -> AnywhereConfiguration
$cfrom :: forall x. AnywhereConfiguration -> Rep AnywhereConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'AnywhereConfiguration' 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:
--
-- 'cost', 'anywhereConfiguration_cost' - The cost to run your fleet per hour. GameLift uses the provided cost of
-- your fleet to balance usage in queues. For more information about
-- queues, see
-- <https://docs.aws.amazon.com/gamelift/latest/developerguide/queues-intro.html Setting up queues>.
newAnywhereConfiguration ::
  -- | 'cost'
  Prelude.Text ->
  AnywhereConfiguration
newAnywhereConfiguration :: Text -> AnywhereConfiguration
newAnywhereConfiguration Text
pCost_ =
  AnywhereConfiguration' {$sel:cost:AnywhereConfiguration' :: Text
cost = Text
pCost_}

-- | The cost to run your fleet per hour. GameLift uses the provided cost of
-- your fleet to balance usage in queues. For more information about
-- queues, see
-- <https://docs.aws.amazon.com/gamelift/latest/developerguide/queues-intro.html Setting up queues>.
anywhereConfiguration_cost :: Lens.Lens' AnywhereConfiguration Prelude.Text
anywhereConfiguration_cost :: Lens' AnywhereConfiguration Text
anywhereConfiguration_cost = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AnywhereConfiguration' {Text
cost :: Text
$sel:cost:AnywhereConfiguration' :: AnywhereConfiguration -> Text
cost} -> Text
cost) (\s :: AnywhereConfiguration
s@AnywhereConfiguration' {} Text
a -> AnywhereConfiguration
s {$sel:cost:AnywhereConfiguration' :: Text
cost = Text
a} :: AnywhereConfiguration)

instance Data.FromJSON AnywhereConfiguration where
  parseJSON :: Value -> Parser AnywhereConfiguration
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"AnywhereConfiguration"
      ( \Object
x ->
          Text -> AnywhereConfiguration
AnywhereConfiguration'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Cost")
      )

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

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

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