{-# 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.ServerSummary
-- 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.ServerSummary 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.ServerOsType
import qualified Amazonka.Prelude as Prelude

-- | Object containing details about the servers imported by Application
-- Discovery Service
--
-- /See:/ 'newServerSummary' smart constructor.
data ServerSummary = ServerSummary'
  { -- | Type of operating system for the servers.
    ServerSummary -> Maybe ServerOsType
serverOsType :: Prelude.Maybe ServerOsType,
    -- | Number of servers.
    ServerSummary -> Maybe Int
count :: Prelude.Maybe Prelude.Int
  }
  deriving (ServerSummary -> ServerSummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ServerSummary -> ServerSummary -> Bool
$c/= :: ServerSummary -> ServerSummary -> Bool
== :: ServerSummary -> ServerSummary -> Bool
$c== :: ServerSummary -> ServerSummary -> Bool
Prelude.Eq, ReadPrec [ServerSummary]
ReadPrec ServerSummary
Int -> ReadS ServerSummary
ReadS [ServerSummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ServerSummary]
$creadListPrec :: ReadPrec [ServerSummary]
readPrec :: ReadPrec ServerSummary
$creadPrec :: ReadPrec ServerSummary
readList :: ReadS [ServerSummary]
$creadList :: ReadS [ServerSummary]
readsPrec :: Int -> ReadS ServerSummary
$creadsPrec :: Int -> ReadS ServerSummary
Prelude.Read, Int -> ServerSummary -> ShowS
[ServerSummary] -> ShowS
ServerSummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ServerSummary] -> ShowS
$cshowList :: [ServerSummary] -> ShowS
show :: ServerSummary -> String
$cshow :: ServerSummary -> String
showsPrec :: Int -> ServerSummary -> ShowS
$cshowsPrec :: Int -> ServerSummary -> ShowS
Prelude.Show, forall x. Rep ServerSummary x -> ServerSummary
forall x. ServerSummary -> Rep ServerSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ServerSummary x -> ServerSummary
$cfrom :: forall x. ServerSummary -> Rep ServerSummary x
Prelude.Generic)

-- |
-- Create a value of 'ServerSummary' 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:
--
-- 'serverOsType', 'serverSummary_serverOsType' - Type of operating system for the servers.
--
-- 'count', 'serverSummary_count' - Number of servers.
newServerSummary ::
  ServerSummary
newServerSummary :: ServerSummary
newServerSummary =
  ServerSummary'
    { $sel:serverOsType:ServerSummary' :: Maybe ServerOsType
serverOsType = forall a. Maybe a
Prelude.Nothing,
      $sel:count:ServerSummary' :: Maybe Int
count = forall a. Maybe a
Prelude.Nothing
    }

-- | Type of operating system for the servers.
serverSummary_serverOsType :: Lens.Lens' ServerSummary (Prelude.Maybe ServerOsType)
serverSummary_serverOsType :: Lens' ServerSummary (Maybe ServerOsType)
serverSummary_serverOsType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServerSummary' {Maybe ServerOsType
serverOsType :: Maybe ServerOsType
$sel:serverOsType:ServerSummary' :: ServerSummary -> Maybe ServerOsType
serverOsType} -> Maybe ServerOsType
serverOsType) (\s :: ServerSummary
s@ServerSummary' {} Maybe ServerOsType
a -> ServerSummary
s {$sel:serverOsType:ServerSummary' :: Maybe ServerOsType
serverOsType = Maybe ServerOsType
a} :: ServerSummary)

-- | Number of servers.
serverSummary_count :: Lens.Lens' ServerSummary (Prelude.Maybe Prelude.Int)
serverSummary_count :: Lens' ServerSummary (Maybe Int)
serverSummary_count = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServerSummary' {Maybe Int
count :: Maybe Int
$sel:count:ServerSummary' :: ServerSummary -> Maybe Int
count} -> Maybe Int
count) (\s :: ServerSummary
s@ServerSummary' {} Maybe Int
a -> ServerSummary
s {$sel:count:ServerSummary' :: Maybe Int
count = Maybe Int
a} :: ServerSummary)

instance Data.FromJSON ServerSummary where
  parseJSON :: Value -> Parser ServerSummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ServerSummary"
      ( \Object
x ->
          Maybe ServerOsType -> Maybe Int -> ServerSummary
ServerSummary'
            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
"ServerOsType")
            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
"count")
      )

instance Prelude.Hashable ServerSummary where
  hashWithSalt :: Int -> ServerSummary -> Int
hashWithSalt Int
_salt ServerSummary' {Maybe Int
Maybe ServerOsType
count :: Maybe Int
serverOsType :: Maybe ServerOsType
$sel:count:ServerSummary' :: ServerSummary -> Maybe Int
$sel:serverOsType:ServerSummary' :: ServerSummary -> Maybe ServerOsType
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ServerOsType
serverOsType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
count

instance Prelude.NFData ServerSummary where
  rnf :: ServerSummary -> ()
rnf ServerSummary' {Maybe Int
Maybe ServerOsType
count :: Maybe Int
serverOsType :: Maybe ServerOsType
$sel:count:ServerSummary' :: ServerSummary -> Maybe Int
$sel:serverOsType:ServerSummary' :: ServerSummary -> Maybe ServerOsType
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe ServerOsType
serverOsType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
count