{-# 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.SageMaker.Types.DeviceStats
-- 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.SageMaker.Types.DeviceStats where

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

-- | Status of devices.
--
-- /See:/ 'newDeviceStats' smart constructor.
data DeviceStats = DeviceStats'
  { -- | The number of devices connected with a heartbeat.
    DeviceStats -> Integer
connectedDeviceCount :: Prelude.Integer,
    -- | The number of registered devices.
    DeviceStats -> Integer
registeredDeviceCount :: Prelude.Integer
  }
  deriving (DeviceStats -> DeviceStats -> Bool
(DeviceStats -> DeviceStats -> Bool)
-> (DeviceStats -> DeviceStats -> Bool) -> Eq DeviceStats
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeviceStats -> DeviceStats -> Bool
$c/= :: DeviceStats -> DeviceStats -> Bool
== :: DeviceStats -> DeviceStats -> Bool
$c== :: DeviceStats -> DeviceStats -> Bool
Prelude.Eq, ReadPrec [DeviceStats]
ReadPrec DeviceStats
Int -> ReadS DeviceStats
ReadS [DeviceStats]
(Int -> ReadS DeviceStats)
-> ReadS [DeviceStats]
-> ReadPrec DeviceStats
-> ReadPrec [DeviceStats]
-> Read DeviceStats
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeviceStats]
$creadListPrec :: ReadPrec [DeviceStats]
readPrec :: ReadPrec DeviceStats
$creadPrec :: ReadPrec DeviceStats
readList :: ReadS [DeviceStats]
$creadList :: ReadS [DeviceStats]
readsPrec :: Int -> ReadS DeviceStats
$creadsPrec :: Int -> ReadS DeviceStats
Prelude.Read, Int -> DeviceStats -> ShowS
[DeviceStats] -> ShowS
DeviceStats -> String
(Int -> DeviceStats -> ShowS)
-> (DeviceStats -> String)
-> ([DeviceStats] -> ShowS)
-> Show DeviceStats
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeviceStats] -> ShowS
$cshowList :: [DeviceStats] -> ShowS
show :: DeviceStats -> String
$cshow :: DeviceStats -> String
showsPrec :: Int -> DeviceStats -> ShowS
$cshowsPrec :: Int -> DeviceStats -> ShowS
Prelude.Show, (forall x. DeviceStats -> Rep DeviceStats x)
-> (forall x. Rep DeviceStats x -> DeviceStats)
-> Generic DeviceStats
forall x. Rep DeviceStats x -> DeviceStats
forall x. DeviceStats -> Rep DeviceStats x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeviceStats x -> DeviceStats
$cfrom :: forall x. DeviceStats -> Rep DeviceStats x
Prelude.Generic)

-- |
-- Create a value of 'DeviceStats' 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:
--
-- 'connectedDeviceCount', 'deviceStats_connectedDeviceCount' - The number of devices connected with a heartbeat.
--
-- 'registeredDeviceCount', 'deviceStats_registeredDeviceCount' - The number of registered devices.
newDeviceStats ::
  -- | 'connectedDeviceCount'
  Prelude.Integer ->
  -- | 'registeredDeviceCount'
  Prelude.Integer ->
  DeviceStats
newDeviceStats :: Integer -> Integer -> DeviceStats
newDeviceStats
  Integer
pConnectedDeviceCount_
  Integer
pRegisteredDeviceCount_ =
    DeviceStats' :: Integer -> Integer -> DeviceStats
DeviceStats'
      { $sel:connectedDeviceCount:DeviceStats' :: Integer
connectedDeviceCount =
          Integer
pConnectedDeviceCount_,
        $sel:registeredDeviceCount:DeviceStats' :: Integer
registeredDeviceCount = Integer
pRegisteredDeviceCount_
      }

-- | The number of devices connected with a heartbeat.
deviceStats_connectedDeviceCount :: Lens.Lens' DeviceStats Prelude.Integer
deviceStats_connectedDeviceCount :: (Integer -> f Integer) -> DeviceStats -> f DeviceStats
deviceStats_connectedDeviceCount = (DeviceStats -> Integer)
-> (DeviceStats -> Integer -> DeviceStats)
-> Lens DeviceStats DeviceStats Integer Integer
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeviceStats' {Integer
connectedDeviceCount :: Integer
$sel:connectedDeviceCount:DeviceStats' :: DeviceStats -> Integer
connectedDeviceCount} -> Integer
connectedDeviceCount) (\s :: DeviceStats
s@DeviceStats' {} Integer
a -> DeviceStats
s {$sel:connectedDeviceCount:DeviceStats' :: Integer
connectedDeviceCount = Integer
a} :: DeviceStats)

-- | The number of registered devices.
deviceStats_registeredDeviceCount :: Lens.Lens' DeviceStats Prelude.Integer
deviceStats_registeredDeviceCount :: (Integer -> f Integer) -> DeviceStats -> f DeviceStats
deviceStats_registeredDeviceCount = (DeviceStats -> Integer)
-> (DeviceStats -> Integer -> DeviceStats)
-> Lens DeviceStats DeviceStats Integer Integer
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeviceStats' {Integer
registeredDeviceCount :: Integer
$sel:registeredDeviceCount:DeviceStats' :: DeviceStats -> Integer
registeredDeviceCount} -> Integer
registeredDeviceCount) (\s :: DeviceStats
s@DeviceStats' {} Integer
a -> DeviceStats
s {$sel:registeredDeviceCount:DeviceStats' :: Integer
registeredDeviceCount = Integer
a} :: DeviceStats)

instance Core.FromJSON DeviceStats where
  parseJSON :: Value -> Parser DeviceStats
parseJSON =
    String
-> (Object -> Parser DeviceStats) -> Value -> Parser DeviceStats
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"DeviceStats"
      ( \Object
x ->
          Integer -> Integer -> DeviceStats
DeviceStats'
            (Integer -> Integer -> DeviceStats)
-> Parser Integer -> Parser (Integer -> DeviceStats)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Integer
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"ConnectedDeviceCount")
            Parser (Integer -> DeviceStats)
-> Parser Integer -> Parser DeviceStats
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Integer
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"RegisteredDeviceCount")
      )

instance Prelude.Hashable DeviceStats

instance Prelude.NFData DeviceStats