{-# 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.SnowDeviceManagement.Types.InstanceSummary
-- 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.SnowDeviceManagement.Types.InstanceSummary where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SnowDeviceManagement.Types.Instance

-- | The details about the instance.
--
-- /See:/ 'newInstanceSummary' smart constructor.
data InstanceSummary = InstanceSummary'
  { -- | When the instance summary was last updated.
    InstanceSummary -> Maybe POSIX
lastUpdatedAt :: Prelude.Maybe Core.POSIX,
    -- | A structure containing details about the instance.
    InstanceSummary -> Maybe Instance
instance' :: Prelude.Maybe Instance
  }
  deriving (InstanceSummary -> InstanceSummary -> Bool
(InstanceSummary -> InstanceSummary -> Bool)
-> (InstanceSummary -> InstanceSummary -> Bool)
-> Eq InstanceSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InstanceSummary -> InstanceSummary -> Bool
$c/= :: InstanceSummary -> InstanceSummary -> Bool
== :: InstanceSummary -> InstanceSummary -> Bool
$c== :: InstanceSummary -> InstanceSummary -> Bool
Prelude.Eq, ReadPrec [InstanceSummary]
ReadPrec InstanceSummary
Int -> ReadS InstanceSummary
ReadS [InstanceSummary]
(Int -> ReadS InstanceSummary)
-> ReadS [InstanceSummary]
-> ReadPrec InstanceSummary
-> ReadPrec [InstanceSummary]
-> Read InstanceSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InstanceSummary]
$creadListPrec :: ReadPrec [InstanceSummary]
readPrec :: ReadPrec InstanceSummary
$creadPrec :: ReadPrec InstanceSummary
readList :: ReadS [InstanceSummary]
$creadList :: ReadS [InstanceSummary]
readsPrec :: Int -> ReadS InstanceSummary
$creadsPrec :: Int -> ReadS InstanceSummary
Prelude.Read, Int -> InstanceSummary -> ShowS
[InstanceSummary] -> ShowS
InstanceSummary -> String
(Int -> InstanceSummary -> ShowS)
-> (InstanceSummary -> String)
-> ([InstanceSummary] -> ShowS)
-> Show InstanceSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InstanceSummary] -> ShowS
$cshowList :: [InstanceSummary] -> ShowS
show :: InstanceSummary -> String
$cshow :: InstanceSummary -> String
showsPrec :: Int -> InstanceSummary -> ShowS
$cshowsPrec :: Int -> InstanceSummary -> ShowS
Prelude.Show, (forall x. InstanceSummary -> Rep InstanceSummary x)
-> (forall x. Rep InstanceSummary x -> InstanceSummary)
-> Generic InstanceSummary
forall x. Rep InstanceSummary x -> InstanceSummary
forall x. InstanceSummary -> Rep InstanceSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep InstanceSummary x -> InstanceSummary
$cfrom :: forall x. InstanceSummary -> Rep InstanceSummary x
Prelude.Generic)

-- |
-- Create a value of 'InstanceSummary' 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:
--
-- 'lastUpdatedAt', 'instanceSummary_lastUpdatedAt' - When the instance summary was last updated.
--
-- 'instance'', 'instanceSummary_instance' - A structure containing details about the instance.
newInstanceSummary ::
  InstanceSummary
newInstanceSummary :: InstanceSummary
newInstanceSummary =
  InstanceSummary' :: Maybe POSIX -> Maybe Instance -> InstanceSummary
InstanceSummary'
    { $sel:lastUpdatedAt:InstanceSummary' :: Maybe POSIX
lastUpdatedAt = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:instance':InstanceSummary' :: Maybe Instance
instance' = Maybe Instance
forall a. Maybe a
Prelude.Nothing
    }

-- | When the instance summary was last updated.
instanceSummary_lastUpdatedAt :: Lens.Lens' InstanceSummary (Prelude.Maybe Prelude.UTCTime)
instanceSummary_lastUpdatedAt :: (Maybe UTCTime -> f (Maybe UTCTime))
-> InstanceSummary -> f InstanceSummary
instanceSummary_lastUpdatedAt = (InstanceSummary -> Maybe POSIX)
-> (InstanceSummary -> Maybe POSIX -> InstanceSummary)
-> Lens InstanceSummary InstanceSummary (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceSummary' {Maybe POSIX
lastUpdatedAt :: Maybe POSIX
$sel:lastUpdatedAt:InstanceSummary' :: InstanceSummary -> Maybe POSIX
lastUpdatedAt} -> Maybe POSIX
lastUpdatedAt) (\s :: InstanceSummary
s@InstanceSummary' {} Maybe POSIX
a -> InstanceSummary
s {$sel:lastUpdatedAt:InstanceSummary' :: Maybe POSIX
lastUpdatedAt = Maybe POSIX
a} :: InstanceSummary) ((Maybe POSIX -> f (Maybe POSIX))
 -> InstanceSummary -> f InstanceSummary)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> InstanceSummary
-> f InstanceSummary
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | A structure containing details about the instance.
instanceSummary_instance :: Lens.Lens' InstanceSummary (Prelude.Maybe Instance)
instanceSummary_instance :: (Maybe Instance -> f (Maybe Instance))
-> InstanceSummary -> f InstanceSummary
instanceSummary_instance = (InstanceSummary -> Maybe Instance)
-> (InstanceSummary -> Maybe Instance -> InstanceSummary)
-> Lens
     InstanceSummary InstanceSummary (Maybe Instance) (Maybe Instance)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceSummary' {Maybe Instance
instance' :: Maybe Instance
$sel:instance':InstanceSummary' :: InstanceSummary -> Maybe Instance
instance'} -> Maybe Instance
instance') (\s :: InstanceSummary
s@InstanceSummary' {} Maybe Instance
a -> InstanceSummary
s {$sel:instance':InstanceSummary' :: Maybe Instance
instance' = Maybe Instance
a} :: InstanceSummary)

instance Core.FromJSON InstanceSummary where
  parseJSON :: Value -> Parser InstanceSummary
parseJSON =
    String
-> (Object -> Parser InstanceSummary)
-> Value
-> Parser InstanceSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"InstanceSummary"
      ( \Object
x ->
          Maybe POSIX -> Maybe Instance -> InstanceSummary
InstanceSummary'
            (Maybe POSIX -> Maybe Instance -> InstanceSummary)
-> Parser (Maybe POSIX)
-> Parser (Maybe Instance -> InstanceSummary)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"lastUpdatedAt")
            Parser (Maybe Instance -> InstanceSummary)
-> Parser (Maybe Instance) -> Parser InstanceSummary
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Instance)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"instance")
      )

instance Prelude.Hashable InstanceSummary

instance Prelude.NFData InstanceSummary