{-# 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.MigrationHubStrategy.Types.ServerStrategy
-- 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.MigrationHubStrategy.Types.ServerStrategy where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.MigrationHubStrategy.Types.RecommendationSet
import Amazonka.MigrationHubStrategy.Types.StrategyRecommendation
import qualified Amazonka.Prelude as Prelude

-- | Contains information about a strategy recommendation for a server.
--
-- /See:/ 'newServerStrategy' smart constructor.
data ServerStrategy = ServerStrategy'
  { -- | Set to true if the recommendation is set as preferred.
    ServerStrategy -> Maybe Bool
isPreferred :: Prelude.Maybe Prelude.Bool,
    -- | The number of application components with this strategy recommendation
    -- running on the server.
    ServerStrategy -> Maybe Int
numberOfApplicationComponents :: Prelude.Maybe Prelude.Int,
    -- | Strategy recommendation for the server.
    ServerStrategy -> Maybe RecommendationSet
recommendation :: Prelude.Maybe RecommendationSet,
    -- | The recommendation status of the strategy for the server.
    ServerStrategy -> Maybe StrategyRecommendation
status :: Prelude.Maybe StrategyRecommendation
  }
  deriving (ServerStrategy -> ServerStrategy -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ServerStrategy -> ServerStrategy -> Bool
$c/= :: ServerStrategy -> ServerStrategy -> Bool
== :: ServerStrategy -> ServerStrategy -> Bool
$c== :: ServerStrategy -> ServerStrategy -> Bool
Prelude.Eq, ReadPrec [ServerStrategy]
ReadPrec ServerStrategy
Int -> ReadS ServerStrategy
ReadS [ServerStrategy]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ServerStrategy]
$creadListPrec :: ReadPrec [ServerStrategy]
readPrec :: ReadPrec ServerStrategy
$creadPrec :: ReadPrec ServerStrategy
readList :: ReadS [ServerStrategy]
$creadList :: ReadS [ServerStrategy]
readsPrec :: Int -> ReadS ServerStrategy
$creadsPrec :: Int -> ReadS ServerStrategy
Prelude.Read, Int -> ServerStrategy -> ShowS
[ServerStrategy] -> ShowS
ServerStrategy -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ServerStrategy] -> ShowS
$cshowList :: [ServerStrategy] -> ShowS
show :: ServerStrategy -> String
$cshow :: ServerStrategy -> String
showsPrec :: Int -> ServerStrategy -> ShowS
$cshowsPrec :: Int -> ServerStrategy -> ShowS
Prelude.Show, forall x. Rep ServerStrategy x -> ServerStrategy
forall x. ServerStrategy -> Rep ServerStrategy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ServerStrategy x -> ServerStrategy
$cfrom :: forall x. ServerStrategy -> Rep ServerStrategy x
Prelude.Generic)

-- |
-- Create a value of 'ServerStrategy' 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:
--
-- 'isPreferred', 'serverStrategy_isPreferred' - Set to true if the recommendation is set as preferred.
--
-- 'numberOfApplicationComponents', 'serverStrategy_numberOfApplicationComponents' - The number of application components with this strategy recommendation
-- running on the server.
--
-- 'recommendation', 'serverStrategy_recommendation' - Strategy recommendation for the server.
--
-- 'status', 'serverStrategy_status' - The recommendation status of the strategy for the server.
newServerStrategy ::
  ServerStrategy
newServerStrategy :: ServerStrategy
newServerStrategy =
  ServerStrategy'
    { $sel:isPreferred:ServerStrategy' :: Maybe Bool
isPreferred = forall a. Maybe a
Prelude.Nothing,
      $sel:numberOfApplicationComponents:ServerStrategy' :: Maybe Int
numberOfApplicationComponents = forall a. Maybe a
Prelude.Nothing,
      $sel:recommendation:ServerStrategy' :: Maybe RecommendationSet
recommendation = forall a. Maybe a
Prelude.Nothing,
      $sel:status:ServerStrategy' :: Maybe StrategyRecommendation
status = forall a. Maybe a
Prelude.Nothing
    }

-- | Set to true if the recommendation is set as preferred.
serverStrategy_isPreferred :: Lens.Lens' ServerStrategy (Prelude.Maybe Prelude.Bool)
serverStrategy_isPreferred :: Lens' ServerStrategy (Maybe Bool)
serverStrategy_isPreferred = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServerStrategy' {Maybe Bool
isPreferred :: Maybe Bool
$sel:isPreferred:ServerStrategy' :: ServerStrategy -> Maybe Bool
isPreferred} -> Maybe Bool
isPreferred) (\s :: ServerStrategy
s@ServerStrategy' {} Maybe Bool
a -> ServerStrategy
s {$sel:isPreferred:ServerStrategy' :: Maybe Bool
isPreferred = Maybe Bool
a} :: ServerStrategy)

-- | The number of application components with this strategy recommendation
-- running on the server.
serverStrategy_numberOfApplicationComponents :: Lens.Lens' ServerStrategy (Prelude.Maybe Prelude.Int)
serverStrategy_numberOfApplicationComponents :: Lens' ServerStrategy (Maybe Int)
serverStrategy_numberOfApplicationComponents = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServerStrategy' {Maybe Int
numberOfApplicationComponents :: Maybe Int
$sel:numberOfApplicationComponents:ServerStrategy' :: ServerStrategy -> Maybe Int
numberOfApplicationComponents} -> Maybe Int
numberOfApplicationComponents) (\s :: ServerStrategy
s@ServerStrategy' {} Maybe Int
a -> ServerStrategy
s {$sel:numberOfApplicationComponents:ServerStrategy' :: Maybe Int
numberOfApplicationComponents = Maybe Int
a} :: ServerStrategy)

-- | Strategy recommendation for the server.
serverStrategy_recommendation :: Lens.Lens' ServerStrategy (Prelude.Maybe RecommendationSet)
serverStrategy_recommendation :: Lens' ServerStrategy (Maybe RecommendationSet)
serverStrategy_recommendation = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServerStrategy' {Maybe RecommendationSet
recommendation :: Maybe RecommendationSet
$sel:recommendation:ServerStrategy' :: ServerStrategy -> Maybe RecommendationSet
recommendation} -> Maybe RecommendationSet
recommendation) (\s :: ServerStrategy
s@ServerStrategy' {} Maybe RecommendationSet
a -> ServerStrategy
s {$sel:recommendation:ServerStrategy' :: Maybe RecommendationSet
recommendation = Maybe RecommendationSet
a} :: ServerStrategy)

-- | The recommendation status of the strategy for the server.
serverStrategy_status :: Lens.Lens' ServerStrategy (Prelude.Maybe StrategyRecommendation)
serverStrategy_status :: Lens' ServerStrategy (Maybe StrategyRecommendation)
serverStrategy_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServerStrategy' {Maybe StrategyRecommendation
status :: Maybe StrategyRecommendation
$sel:status:ServerStrategy' :: ServerStrategy -> Maybe StrategyRecommendation
status} -> Maybe StrategyRecommendation
status) (\s :: ServerStrategy
s@ServerStrategy' {} Maybe StrategyRecommendation
a -> ServerStrategy
s {$sel:status:ServerStrategy' :: Maybe StrategyRecommendation
status = Maybe StrategyRecommendation
a} :: ServerStrategy)

instance Data.FromJSON ServerStrategy where
  parseJSON :: Value -> Parser ServerStrategy
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ServerStrategy"
      ( \Object
x ->
          Maybe Bool
-> Maybe Int
-> Maybe RecommendationSet
-> Maybe StrategyRecommendation
-> ServerStrategy
ServerStrategy'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"isPreferred")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"numberOfApplicationComponents")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"recommendation")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"status")
      )

instance Prelude.Hashable ServerStrategy where
  hashWithSalt :: Int -> ServerStrategy -> Int
hashWithSalt Int
_salt ServerStrategy' {Maybe Bool
Maybe Int
Maybe StrategyRecommendation
Maybe RecommendationSet
status :: Maybe StrategyRecommendation
recommendation :: Maybe RecommendationSet
numberOfApplicationComponents :: Maybe Int
isPreferred :: Maybe Bool
$sel:status:ServerStrategy' :: ServerStrategy -> Maybe StrategyRecommendation
$sel:recommendation:ServerStrategy' :: ServerStrategy -> Maybe RecommendationSet
$sel:numberOfApplicationComponents:ServerStrategy' :: ServerStrategy -> Maybe Int
$sel:isPreferred:ServerStrategy' :: ServerStrategy -> Maybe Bool
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
isPreferred
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
numberOfApplicationComponents
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe RecommendationSet
recommendation
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe StrategyRecommendation
status

instance Prelude.NFData ServerStrategy where
  rnf :: ServerStrategy -> ()
rnf ServerStrategy' {Maybe Bool
Maybe Int
Maybe StrategyRecommendation
Maybe RecommendationSet
status :: Maybe StrategyRecommendation
recommendation :: Maybe RecommendationSet
numberOfApplicationComponents :: Maybe Int
isPreferred :: Maybe Bool
$sel:status:ServerStrategy' :: ServerStrategy -> Maybe StrategyRecommendation
$sel:recommendation:ServerStrategy' :: ServerStrategy -> Maybe RecommendationSet
$sel:numberOfApplicationComponents:ServerStrategy' :: ServerStrategy -> Maybe Int
$sel:isPreferred:ServerStrategy' :: ServerStrategy -> Maybe Bool
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
isPreferred
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
numberOfApplicationComponents
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe RecommendationSet
recommendation
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe StrategyRecommendation
status