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

import qualified Amazonka.Core as Core
import Amazonka.GameLift.Types.FleetAction
import Amazonka.GameLift.Types.LocationState
import Amazonka.GameLift.Types.LocationUpdateStatus
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Represents a location in a multi-location fleet.
--
-- __Related actions__
--
-- DescribeFleetLocationAttributes
--
-- /See:/ 'newLocationAttributes' smart constructor.
data LocationAttributes = LocationAttributes'
  { -- | A list of fleet actions that have been suspended in the fleet location.
    LocationAttributes -> Maybe (NonEmpty FleetAction)
stoppedActions :: Prelude.Maybe (Prelude.NonEmpty FleetAction),
    -- | A fleet location and its current life-cycle state.
    LocationAttributes -> Maybe LocationState
locationState :: Prelude.Maybe LocationState,
    -- | The status of fleet activity updates to the location. The status
    -- @PENDING_UPDATE@ indicates that StopFleetActions or StartFleetActions
    -- has been requested but the update has not yet been completed for the
    -- location.
    LocationAttributes -> Maybe LocationUpdateStatus
updateStatus :: Prelude.Maybe LocationUpdateStatus
  }
  deriving (LocationAttributes -> LocationAttributes -> Bool
(LocationAttributes -> LocationAttributes -> Bool)
-> (LocationAttributes -> LocationAttributes -> Bool)
-> Eq LocationAttributes
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LocationAttributes -> LocationAttributes -> Bool
$c/= :: LocationAttributes -> LocationAttributes -> Bool
== :: LocationAttributes -> LocationAttributes -> Bool
$c== :: LocationAttributes -> LocationAttributes -> Bool
Prelude.Eq, ReadPrec [LocationAttributes]
ReadPrec LocationAttributes
Int -> ReadS LocationAttributes
ReadS [LocationAttributes]
(Int -> ReadS LocationAttributes)
-> ReadS [LocationAttributes]
-> ReadPrec LocationAttributes
-> ReadPrec [LocationAttributes]
-> Read LocationAttributes
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LocationAttributes]
$creadListPrec :: ReadPrec [LocationAttributes]
readPrec :: ReadPrec LocationAttributes
$creadPrec :: ReadPrec LocationAttributes
readList :: ReadS [LocationAttributes]
$creadList :: ReadS [LocationAttributes]
readsPrec :: Int -> ReadS LocationAttributes
$creadsPrec :: Int -> ReadS LocationAttributes
Prelude.Read, Int -> LocationAttributes -> ShowS
[LocationAttributes] -> ShowS
LocationAttributes -> String
(Int -> LocationAttributes -> ShowS)
-> (LocationAttributes -> String)
-> ([LocationAttributes] -> ShowS)
-> Show LocationAttributes
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LocationAttributes] -> ShowS
$cshowList :: [LocationAttributes] -> ShowS
show :: LocationAttributes -> String
$cshow :: LocationAttributes -> String
showsPrec :: Int -> LocationAttributes -> ShowS
$cshowsPrec :: Int -> LocationAttributes -> ShowS
Prelude.Show, (forall x. LocationAttributes -> Rep LocationAttributes x)
-> (forall x. Rep LocationAttributes x -> LocationAttributes)
-> Generic LocationAttributes
forall x. Rep LocationAttributes x -> LocationAttributes
forall x. LocationAttributes -> Rep LocationAttributes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LocationAttributes x -> LocationAttributes
$cfrom :: forall x. LocationAttributes -> Rep LocationAttributes x
Prelude.Generic)

-- |
-- Create a value of 'LocationAttributes' 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:
--
-- 'stoppedActions', 'locationAttributes_stoppedActions' - A list of fleet actions that have been suspended in the fleet location.
--
-- 'locationState', 'locationAttributes_locationState' - A fleet location and its current life-cycle state.
--
-- 'updateStatus', 'locationAttributes_updateStatus' - The status of fleet activity updates to the location. The status
-- @PENDING_UPDATE@ indicates that StopFleetActions or StartFleetActions
-- has been requested but the update has not yet been completed for the
-- location.
newLocationAttributes ::
  LocationAttributes
newLocationAttributes :: LocationAttributes
newLocationAttributes =
  LocationAttributes' :: Maybe (NonEmpty FleetAction)
-> Maybe LocationState
-> Maybe LocationUpdateStatus
-> LocationAttributes
LocationAttributes'
    { $sel:stoppedActions:LocationAttributes' :: Maybe (NonEmpty FleetAction)
stoppedActions =
        Maybe (NonEmpty FleetAction)
forall a. Maybe a
Prelude.Nothing,
      $sel:locationState:LocationAttributes' :: Maybe LocationState
locationState = Maybe LocationState
forall a. Maybe a
Prelude.Nothing,
      $sel:updateStatus:LocationAttributes' :: Maybe LocationUpdateStatus
updateStatus = Maybe LocationUpdateStatus
forall a. Maybe a
Prelude.Nothing
    }

-- | A list of fleet actions that have been suspended in the fleet location.
locationAttributes_stoppedActions :: Lens.Lens' LocationAttributes (Prelude.Maybe (Prelude.NonEmpty FleetAction))
locationAttributes_stoppedActions :: (Maybe (NonEmpty FleetAction) -> f (Maybe (NonEmpty FleetAction)))
-> LocationAttributes -> f LocationAttributes
locationAttributes_stoppedActions = (LocationAttributes -> Maybe (NonEmpty FleetAction))
-> (LocationAttributes
    -> Maybe (NonEmpty FleetAction) -> LocationAttributes)
-> Lens
     LocationAttributes
     LocationAttributes
     (Maybe (NonEmpty FleetAction))
     (Maybe (NonEmpty FleetAction))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LocationAttributes' {Maybe (NonEmpty FleetAction)
stoppedActions :: Maybe (NonEmpty FleetAction)
$sel:stoppedActions:LocationAttributes' :: LocationAttributes -> Maybe (NonEmpty FleetAction)
stoppedActions} -> Maybe (NonEmpty FleetAction)
stoppedActions) (\s :: LocationAttributes
s@LocationAttributes' {} Maybe (NonEmpty FleetAction)
a -> LocationAttributes
s {$sel:stoppedActions:LocationAttributes' :: Maybe (NonEmpty FleetAction)
stoppedActions = Maybe (NonEmpty FleetAction)
a} :: LocationAttributes) ((Maybe (NonEmpty FleetAction) -> f (Maybe (NonEmpty FleetAction)))
 -> LocationAttributes -> f LocationAttributes)
-> ((Maybe (NonEmpty FleetAction)
     -> f (Maybe (NonEmpty FleetAction)))
    -> Maybe (NonEmpty FleetAction)
    -> f (Maybe (NonEmpty FleetAction)))
-> (Maybe (NonEmpty FleetAction)
    -> f (Maybe (NonEmpty FleetAction)))
-> LocationAttributes
-> f LocationAttributes
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty FleetAction)
  (NonEmpty FleetAction)
  (NonEmpty FleetAction)
  (NonEmpty FleetAction)
-> Iso
     (Maybe (NonEmpty FleetAction))
     (Maybe (NonEmpty FleetAction))
     (Maybe (NonEmpty FleetAction))
     (Maybe (NonEmpty FleetAction))
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
  (NonEmpty FleetAction)
  (NonEmpty FleetAction)
  (NonEmpty FleetAction)
  (NonEmpty FleetAction)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A fleet location and its current life-cycle state.
locationAttributes_locationState :: Lens.Lens' LocationAttributes (Prelude.Maybe LocationState)
locationAttributes_locationState :: (Maybe LocationState -> f (Maybe LocationState))
-> LocationAttributes -> f LocationAttributes
locationAttributes_locationState = (LocationAttributes -> Maybe LocationState)
-> (LocationAttributes
    -> Maybe LocationState -> LocationAttributes)
-> Lens
     LocationAttributes
     LocationAttributes
     (Maybe LocationState)
     (Maybe LocationState)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LocationAttributes' {Maybe LocationState
locationState :: Maybe LocationState
$sel:locationState:LocationAttributes' :: LocationAttributes -> Maybe LocationState
locationState} -> Maybe LocationState
locationState) (\s :: LocationAttributes
s@LocationAttributes' {} Maybe LocationState
a -> LocationAttributes
s {$sel:locationState:LocationAttributes' :: Maybe LocationState
locationState = Maybe LocationState
a} :: LocationAttributes)

-- | The status of fleet activity updates to the location. The status
-- @PENDING_UPDATE@ indicates that StopFleetActions or StartFleetActions
-- has been requested but the update has not yet been completed for the
-- location.
locationAttributes_updateStatus :: Lens.Lens' LocationAttributes (Prelude.Maybe LocationUpdateStatus)
locationAttributes_updateStatus :: (Maybe LocationUpdateStatus -> f (Maybe LocationUpdateStatus))
-> LocationAttributes -> f LocationAttributes
locationAttributes_updateStatus = (LocationAttributes -> Maybe LocationUpdateStatus)
-> (LocationAttributes
    -> Maybe LocationUpdateStatus -> LocationAttributes)
-> Lens
     LocationAttributes
     LocationAttributes
     (Maybe LocationUpdateStatus)
     (Maybe LocationUpdateStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LocationAttributes' {Maybe LocationUpdateStatus
updateStatus :: Maybe LocationUpdateStatus
$sel:updateStatus:LocationAttributes' :: LocationAttributes -> Maybe LocationUpdateStatus
updateStatus} -> Maybe LocationUpdateStatus
updateStatus) (\s :: LocationAttributes
s@LocationAttributes' {} Maybe LocationUpdateStatus
a -> LocationAttributes
s {$sel:updateStatus:LocationAttributes' :: Maybe LocationUpdateStatus
updateStatus = Maybe LocationUpdateStatus
a} :: LocationAttributes)

instance Core.FromJSON LocationAttributes where
  parseJSON :: Value -> Parser LocationAttributes
parseJSON =
    String
-> (Object -> Parser LocationAttributes)
-> Value
-> Parser LocationAttributes
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"LocationAttributes"
      ( \Object
x ->
          Maybe (NonEmpty FleetAction)
-> Maybe LocationState
-> Maybe LocationUpdateStatus
-> LocationAttributes
LocationAttributes'
            (Maybe (NonEmpty FleetAction)
 -> Maybe LocationState
 -> Maybe LocationUpdateStatus
 -> LocationAttributes)
-> Parser (Maybe (NonEmpty FleetAction))
-> Parser
     (Maybe LocationState
      -> Maybe LocationUpdateStatus -> LocationAttributes)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (NonEmpty FleetAction))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"StoppedActions")
            Parser
  (Maybe LocationState
   -> Maybe LocationUpdateStatus -> LocationAttributes)
-> Parser (Maybe LocationState)
-> Parser (Maybe LocationUpdateStatus -> LocationAttributes)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe LocationState)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"LocationState")
            Parser (Maybe LocationUpdateStatus -> LocationAttributes)
-> Parser (Maybe LocationUpdateStatus) -> Parser LocationAttributes
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe LocationUpdateStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"UpdateStatus")
      )

instance Prelude.Hashable LocationAttributes

instance Prelude.NFData LocationAttributes