{-# 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.DeviceSummary
-- 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.SageMaker.Types.DeviceSummary 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
import Amazonka.SageMaker.Types.EdgeModelSummary

-- | Summary of the device.
--
-- /See:/ 'newDeviceSummary' smart constructor.
data DeviceSummary = DeviceSummary'
  { -- | Edge Manager agent version.
    DeviceSummary -> Maybe Text
agentVersion :: Prelude.Maybe Prelude.Text,
    -- | A description of the device.
    DeviceSummary -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The name of the fleet the device belongs to.
    DeviceSummary -> Maybe Text
deviceFleetName :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Web Services Internet of Things (IoT) object thing name
    -- associated with the device..
    DeviceSummary -> Maybe Text
iotThingName :: Prelude.Maybe Prelude.Text,
    -- | The last heartbeat received from the device.
    DeviceSummary -> Maybe POSIX
latestHeartbeat :: Prelude.Maybe Data.POSIX,
    -- | Models on the device.
    DeviceSummary -> Maybe [EdgeModelSummary]
models :: Prelude.Maybe [EdgeModelSummary],
    -- | The timestamp of the last registration or de-reregistration.
    DeviceSummary -> Maybe POSIX
registrationTime :: Prelude.Maybe Data.POSIX,
    -- | The unique identifier of the device.
    DeviceSummary -> Text
deviceName :: Prelude.Text,
    -- | Amazon Resource Name (ARN) of the device.
    DeviceSummary -> Text
deviceArn :: Prelude.Text
  }
  deriving (DeviceSummary -> DeviceSummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeviceSummary -> DeviceSummary -> Bool
$c/= :: DeviceSummary -> DeviceSummary -> Bool
== :: DeviceSummary -> DeviceSummary -> Bool
$c== :: DeviceSummary -> DeviceSummary -> Bool
Prelude.Eq, ReadPrec [DeviceSummary]
ReadPrec DeviceSummary
Int -> ReadS DeviceSummary
ReadS [DeviceSummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeviceSummary]
$creadListPrec :: ReadPrec [DeviceSummary]
readPrec :: ReadPrec DeviceSummary
$creadPrec :: ReadPrec DeviceSummary
readList :: ReadS [DeviceSummary]
$creadList :: ReadS [DeviceSummary]
readsPrec :: Int -> ReadS DeviceSummary
$creadsPrec :: Int -> ReadS DeviceSummary
Prelude.Read, Int -> DeviceSummary -> ShowS
[DeviceSummary] -> ShowS
DeviceSummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeviceSummary] -> ShowS
$cshowList :: [DeviceSummary] -> ShowS
show :: DeviceSummary -> String
$cshow :: DeviceSummary -> String
showsPrec :: Int -> DeviceSummary -> ShowS
$cshowsPrec :: Int -> DeviceSummary -> ShowS
Prelude.Show, forall x. Rep DeviceSummary x -> DeviceSummary
forall x. DeviceSummary -> Rep DeviceSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeviceSummary x -> DeviceSummary
$cfrom :: forall x. DeviceSummary -> Rep DeviceSummary x
Prelude.Generic)

-- |
-- Create a value of 'DeviceSummary' 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:
--
-- 'agentVersion', 'deviceSummary_agentVersion' - Edge Manager agent version.
--
-- 'description', 'deviceSummary_description' - A description of the device.
--
-- 'deviceFleetName', 'deviceSummary_deviceFleetName' - The name of the fleet the device belongs to.
--
-- 'iotThingName', 'deviceSummary_iotThingName' - The Amazon Web Services Internet of Things (IoT) object thing name
-- associated with the device..
--
-- 'latestHeartbeat', 'deviceSummary_latestHeartbeat' - The last heartbeat received from the device.
--
-- 'models', 'deviceSummary_models' - Models on the device.
--
-- 'registrationTime', 'deviceSummary_registrationTime' - The timestamp of the last registration or de-reregistration.
--
-- 'deviceName', 'deviceSummary_deviceName' - The unique identifier of the device.
--
-- 'deviceArn', 'deviceSummary_deviceArn' - Amazon Resource Name (ARN) of the device.
newDeviceSummary ::
  -- | 'deviceName'
  Prelude.Text ->
  -- | 'deviceArn'
  Prelude.Text ->
  DeviceSummary
newDeviceSummary :: Text -> Text -> DeviceSummary
newDeviceSummary Text
pDeviceName_ Text
pDeviceArn_ =
  DeviceSummary'
    { $sel:agentVersion:DeviceSummary' :: Maybe Text
agentVersion = forall a. Maybe a
Prelude.Nothing,
      $sel:description:DeviceSummary' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:deviceFleetName:DeviceSummary' :: Maybe Text
deviceFleetName = forall a. Maybe a
Prelude.Nothing,
      $sel:iotThingName:DeviceSummary' :: Maybe Text
iotThingName = forall a. Maybe a
Prelude.Nothing,
      $sel:latestHeartbeat:DeviceSummary' :: Maybe POSIX
latestHeartbeat = forall a. Maybe a
Prelude.Nothing,
      $sel:models:DeviceSummary' :: Maybe [EdgeModelSummary]
models = forall a. Maybe a
Prelude.Nothing,
      $sel:registrationTime:DeviceSummary' :: Maybe POSIX
registrationTime = forall a. Maybe a
Prelude.Nothing,
      $sel:deviceName:DeviceSummary' :: Text
deviceName = Text
pDeviceName_,
      $sel:deviceArn:DeviceSummary' :: Text
deviceArn = Text
pDeviceArn_
    }

-- | Edge Manager agent version.
deviceSummary_agentVersion :: Lens.Lens' DeviceSummary (Prelude.Maybe Prelude.Text)
deviceSummary_agentVersion :: Lens' DeviceSummary (Maybe Text)
deviceSummary_agentVersion = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeviceSummary' {Maybe Text
agentVersion :: Maybe Text
$sel:agentVersion:DeviceSummary' :: DeviceSummary -> Maybe Text
agentVersion} -> Maybe Text
agentVersion) (\s :: DeviceSummary
s@DeviceSummary' {} Maybe Text
a -> DeviceSummary
s {$sel:agentVersion:DeviceSummary' :: Maybe Text
agentVersion = Maybe Text
a} :: DeviceSummary)

-- | A description of the device.
deviceSummary_description :: Lens.Lens' DeviceSummary (Prelude.Maybe Prelude.Text)
deviceSummary_description :: Lens' DeviceSummary (Maybe Text)
deviceSummary_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeviceSummary' {Maybe Text
description :: Maybe Text
$sel:description:DeviceSummary' :: DeviceSummary -> Maybe Text
description} -> Maybe Text
description) (\s :: DeviceSummary
s@DeviceSummary' {} Maybe Text
a -> DeviceSummary
s {$sel:description:DeviceSummary' :: Maybe Text
description = Maybe Text
a} :: DeviceSummary)

-- | The name of the fleet the device belongs to.
deviceSummary_deviceFleetName :: Lens.Lens' DeviceSummary (Prelude.Maybe Prelude.Text)
deviceSummary_deviceFleetName :: Lens' DeviceSummary (Maybe Text)
deviceSummary_deviceFleetName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeviceSummary' {Maybe Text
deviceFleetName :: Maybe Text
$sel:deviceFleetName:DeviceSummary' :: DeviceSummary -> Maybe Text
deviceFleetName} -> Maybe Text
deviceFleetName) (\s :: DeviceSummary
s@DeviceSummary' {} Maybe Text
a -> DeviceSummary
s {$sel:deviceFleetName:DeviceSummary' :: Maybe Text
deviceFleetName = Maybe Text
a} :: DeviceSummary)

-- | The Amazon Web Services Internet of Things (IoT) object thing name
-- associated with the device..
deviceSummary_iotThingName :: Lens.Lens' DeviceSummary (Prelude.Maybe Prelude.Text)
deviceSummary_iotThingName :: Lens' DeviceSummary (Maybe Text)
deviceSummary_iotThingName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeviceSummary' {Maybe Text
iotThingName :: Maybe Text
$sel:iotThingName:DeviceSummary' :: DeviceSummary -> Maybe Text
iotThingName} -> Maybe Text
iotThingName) (\s :: DeviceSummary
s@DeviceSummary' {} Maybe Text
a -> DeviceSummary
s {$sel:iotThingName:DeviceSummary' :: Maybe Text
iotThingName = Maybe Text
a} :: DeviceSummary)

-- | The last heartbeat received from the device.
deviceSummary_latestHeartbeat :: Lens.Lens' DeviceSummary (Prelude.Maybe Prelude.UTCTime)
deviceSummary_latestHeartbeat :: Lens' DeviceSummary (Maybe UTCTime)
deviceSummary_latestHeartbeat = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeviceSummary' {Maybe POSIX
latestHeartbeat :: Maybe POSIX
$sel:latestHeartbeat:DeviceSummary' :: DeviceSummary -> Maybe POSIX
latestHeartbeat} -> Maybe POSIX
latestHeartbeat) (\s :: DeviceSummary
s@DeviceSummary' {} Maybe POSIX
a -> DeviceSummary
s {$sel:latestHeartbeat:DeviceSummary' :: Maybe POSIX
latestHeartbeat = Maybe POSIX
a} :: DeviceSummary) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | Models on the device.
deviceSummary_models :: Lens.Lens' DeviceSummary (Prelude.Maybe [EdgeModelSummary])
deviceSummary_models :: Lens' DeviceSummary (Maybe [EdgeModelSummary])
deviceSummary_models = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeviceSummary' {Maybe [EdgeModelSummary]
models :: Maybe [EdgeModelSummary]
$sel:models:DeviceSummary' :: DeviceSummary -> Maybe [EdgeModelSummary]
models} -> Maybe [EdgeModelSummary]
models) (\s :: DeviceSummary
s@DeviceSummary' {} Maybe [EdgeModelSummary]
a -> DeviceSummary
s {$sel:models:DeviceSummary' :: Maybe [EdgeModelSummary]
models = Maybe [EdgeModelSummary]
a} :: DeviceSummary) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The timestamp of the last registration or de-reregistration.
deviceSummary_registrationTime :: Lens.Lens' DeviceSummary (Prelude.Maybe Prelude.UTCTime)
deviceSummary_registrationTime :: Lens' DeviceSummary (Maybe UTCTime)
deviceSummary_registrationTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeviceSummary' {Maybe POSIX
registrationTime :: Maybe POSIX
$sel:registrationTime:DeviceSummary' :: DeviceSummary -> Maybe POSIX
registrationTime} -> Maybe POSIX
registrationTime) (\s :: DeviceSummary
s@DeviceSummary' {} Maybe POSIX
a -> DeviceSummary
s {$sel:registrationTime:DeviceSummary' :: Maybe POSIX
registrationTime = Maybe POSIX
a} :: DeviceSummary) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The unique identifier of the device.
deviceSummary_deviceName :: Lens.Lens' DeviceSummary Prelude.Text
deviceSummary_deviceName :: Lens' DeviceSummary Text
deviceSummary_deviceName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeviceSummary' {Text
deviceName :: Text
$sel:deviceName:DeviceSummary' :: DeviceSummary -> Text
deviceName} -> Text
deviceName) (\s :: DeviceSummary
s@DeviceSummary' {} Text
a -> DeviceSummary
s {$sel:deviceName:DeviceSummary' :: Text
deviceName = Text
a} :: DeviceSummary)

-- | Amazon Resource Name (ARN) of the device.
deviceSummary_deviceArn :: Lens.Lens' DeviceSummary Prelude.Text
deviceSummary_deviceArn :: Lens' DeviceSummary Text
deviceSummary_deviceArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeviceSummary' {Text
deviceArn :: Text
$sel:deviceArn:DeviceSummary' :: DeviceSummary -> Text
deviceArn} -> Text
deviceArn) (\s :: DeviceSummary
s@DeviceSummary' {} Text
a -> DeviceSummary
s {$sel:deviceArn:DeviceSummary' :: Text
deviceArn = Text
a} :: DeviceSummary)

instance Data.FromJSON DeviceSummary where
  parseJSON :: Value -> Parser DeviceSummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"DeviceSummary"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe [EdgeModelSummary]
-> Maybe POSIX
-> Text
-> Text
-> DeviceSummary
DeviceSummary'
            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
"AgentVersion")
            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
"Description")
            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
"DeviceFleetName")
            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
"IotThingName")
            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
"LatestHeartbeat")
            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
"Models" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            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
"RegistrationTime")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"DeviceName")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"DeviceArn")
      )

instance Prelude.Hashable DeviceSummary where
  hashWithSalt :: Int -> DeviceSummary -> Int
hashWithSalt Int
_salt DeviceSummary' {Maybe [EdgeModelSummary]
Maybe Text
Maybe POSIX
Text
deviceArn :: Text
deviceName :: Text
registrationTime :: Maybe POSIX
models :: Maybe [EdgeModelSummary]
latestHeartbeat :: Maybe POSIX
iotThingName :: Maybe Text
deviceFleetName :: Maybe Text
description :: Maybe Text
agentVersion :: Maybe Text
$sel:deviceArn:DeviceSummary' :: DeviceSummary -> Text
$sel:deviceName:DeviceSummary' :: DeviceSummary -> Text
$sel:registrationTime:DeviceSummary' :: DeviceSummary -> Maybe POSIX
$sel:models:DeviceSummary' :: DeviceSummary -> Maybe [EdgeModelSummary]
$sel:latestHeartbeat:DeviceSummary' :: DeviceSummary -> Maybe POSIX
$sel:iotThingName:DeviceSummary' :: DeviceSummary -> Maybe Text
$sel:deviceFleetName:DeviceSummary' :: DeviceSummary -> Maybe Text
$sel:description:DeviceSummary' :: DeviceSummary -> Maybe Text
$sel:agentVersion:DeviceSummary' :: DeviceSummary -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
agentVersion
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
deviceFleetName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
iotThingName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
latestHeartbeat
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [EdgeModelSummary]
models
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
registrationTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
deviceName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
deviceArn

instance Prelude.NFData DeviceSummary where
  rnf :: DeviceSummary -> ()
rnf DeviceSummary' {Maybe [EdgeModelSummary]
Maybe Text
Maybe POSIX
Text
deviceArn :: Text
deviceName :: Text
registrationTime :: Maybe POSIX
models :: Maybe [EdgeModelSummary]
latestHeartbeat :: Maybe POSIX
iotThingName :: Maybe Text
deviceFleetName :: Maybe Text
description :: Maybe Text
agentVersion :: Maybe Text
$sel:deviceArn:DeviceSummary' :: DeviceSummary -> Text
$sel:deviceName:DeviceSummary' :: DeviceSummary -> Text
$sel:registrationTime:DeviceSummary' :: DeviceSummary -> Maybe POSIX
$sel:models:DeviceSummary' :: DeviceSummary -> Maybe [EdgeModelSummary]
$sel:latestHeartbeat:DeviceSummary' :: DeviceSummary -> Maybe POSIX
$sel:iotThingName:DeviceSummary' :: DeviceSummary -> Maybe Text
$sel:deviceFleetName:DeviceSummary' :: DeviceSummary -> Maybe Text
$sel:description:DeviceSummary' :: DeviceSummary -> Maybe Text
$sel:agentVersion:DeviceSummary' :: DeviceSummary -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
agentVersion
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
deviceFleetName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
iotThingName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
latestHeartbeat
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [EdgeModelSummary]
models
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
registrationTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
deviceName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
deviceArn