{-# 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.IoTSiteWise.Types.GatewaySummary
-- 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.IoTSiteWise.Types.GatewaySummary where

import qualified Amazonka.Core as Core
import Amazonka.IoTSiteWise.Types.GatewayCapabilitySummary
import Amazonka.IoTSiteWise.Types.GatewayPlatform
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Contains a summary of a gateway.
--
-- /See:/ 'newGatewaySummary' smart constructor.
data GatewaySummary = GatewaySummary'
  { GatewaySummary -> Maybe GatewayPlatform
gatewayPlatform :: Prelude.Maybe GatewayPlatform,
    -- | A list of gateway capability summaries that each contain a namespace and
    -- status. Each gateway capability defines data sources for the gateway. To
    -- retrieve a capability configuration\'s definition, use
    -- <https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/API_DescribeGatewayCapabilityConfiguration.html DescribeGatewayCapabilityConfiguration>.
    GatewaySummary -> Maybe [GatewayCapabilitySummary]
gatewayCapabilitySummaries :: Prelude.Maybe [GatewayCapabilitySummary],
    -- | The ID of the gateway device.
    GatewaySummary -> Text
gatewayId :: Prelude.Text,
    -- | The name of the asset.
    GatewaySummary -> Text
gatewayName :: Prelude.Text,
    -- | The date the gateway was created, in Unix epoch time.
    GatewaySummary -> POSIX
creationDate :: Core.POSIX,
    -- | The date the gateway was last updated, in Unix epoch time.
    GatewaySummary -> POSIX
lastUpdateDate :: Core.POSIX
  }
  deriving (GatewaySummary -> GatewaySummary -> Bool
(GatewaySummary -> GatewaySummary -> Bool)
-> (GatewaySummary -> GatewaySummary -> Bool) -> Eq GatewaySummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GatewaySummary -> GatewaySummary -> Bool
$c/= :: GatewaySummary -> GatewaySummary -> Bool
== :: GatewaySummary -> GatewaySummary -> Bool
$c== :: GatewaySummary -> GatewaySummary -> Bool
Prelude.Eq, ReadPrec [GatewaySummary]
ReadPrec GatewaySummary
Int -> ReadS GatewaySummary
ReadS [GatewaySummary]
(Int -> ReadS GatewaySummary)
-> ReadS [GatewaySummary]
-> ReadPrec GatewaySummary
-> ReadPrec [GatewaySummary]
-> Read GatewaySummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GatewaySummary]
$creadListPrec :: ReadPrec [GatewaySummary]
readPrec :: ReadPrec GatewaySummary
$creadPrec :: ReadPrec GatewaySummary
readList :: ReadS [GatewaySummary]
$creadList :: ReadS [GatewaySummary]
readsPrec :: Int -> ReadS GatewaySummary
$creadsPrec :: Int -> ReadS GatewaySummary
Prelude.Read, Int -> GatewaySummary -> ShowS
[GatewaySummary] -> ShowS
GatewaySummary -> String
(Int -> GatewaySummary -> ShowS)
-> (GatewaySummary -> String)
-> ([GatewaySummary] -> ShowS)
-> Show GatewaySummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GatewaySummary] -> ShowS
$cshowList :: [GatewaySummary] -> ShowS
show :: GatewaySummary -> String
$cshow :: GatewaySummary -> String
showsPrec :: Int -> GatewaySummary -> ShowS
$cshowsPrec :: Int -> GatewaySummary -> ShowS
Prelude.Show, (forall x. GatewaySummary -> Rep GatewaySummary x)
-> (forall x. Rep GatewaySummary x -> GatewaySummary)
-> Generic GatewaySummary
forall x. Rep GatewaySummary x -> GatewaySummary
forall x. GatewaySummary -> Rep GatewaySummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GatewaySummary x -> GatewaySummary
$cfrom :: forall x. GatewaySummary -> Rep GatewaySummary x
Prelude.Generic)

-- |
-- Create a value of 'GatewaySummary' 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:
--
-- 'gatewayPlatform', 'gatewaySummary_gatewayPlatform' - Undocumented member.
--
-- 'gatewayCapabilitySummaries', 'gatewaySummary_gatewayCapabilitySummaries' - A list of gateway capability summaries that each contain a namespace and
-- status. Each gateway capability defines data sources for the gateway. To
-- retrieve a capability configuration\'s definition, use
-- <https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/API_DescribeGatewayCapabilityConfiguration.html DescribeGatewayCapabilityConfiguration>.
--
-- 'gatewayId', 'gatewaySummary_gatewayId' - The ID of the gateway device.
--
-- 'gatewayName', 'gatewaySummary_gatewayName' - The name of the asset.
--
-- 'creationDate', 'gatewaySummary_creationDate' - The date the gateway was created, in Unix epoch time.
--
-- 'lastUpdateDate', 'gatewaySummary_lastUpdateDate' - The date the gateway was last updated, in Unix epoch time.
newGatewaySummary ::
  -- | 'gatewayId'
  Prelude.Text ->
  -- | 'gatewayName'
  Prelude.Text ->
  -- | 'creationDate'
  Prelude.UTCTime ->
  -- | 'lastUpdateDate'
  Prelude.UTCTime ->
  GatewaySummary
newGatewaySummary :: Text -> Text -> UTCTime -> UTCTime -> GatewaySummary
newGatewaySummary
  Text
pGatewayId_
  Text
pGatewayName_
  UTCTime
pCreationDate_
  UTCTime
pLastUpdateDate_ =
    GatewaySummary' :: Maybe GatewayPlatform
-> Maybe [GatewayCapabilitySummary]
-> Text
-> Text
-> POSIX
-> POSIX
-> GatewaySummary
GatewaySummary'
      { $sel:gatewayPlatform:GatewaySummary' :: Maybe GatewayPlatform
gatewayPlatform = Maybe GatewayPlatform
forall a. Maybe a
Prelude.Nothing,
        $sel:gatewayCapabilitySummaries:GatewaySummary' :: Maybe [GatewayCapabilitySummary]
gatewayCapabilitySummaries = Maybe [GatewayCapabilitySummary]
forall a. Maybe a
Prelude.Nothing,
        $sel:gatewayId:GatewaySummary' :: Text
gatewayId = Text
pGatewayId_,
        $sel:gatewayName:GatewaySummary' :: Text
gatewayName = Text
pGatewayName_,
        $sel:creationDate:GatewaySummary' :: POSIX
creationDate = Tagged UTCTime (Identity UTCTime) -> Tagged POSIX (Identity POSIX)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
 -> Tagged POSIX (Identity POSIX))
-> UTCTime -> POSIX
forall t b. AReview t b -> b -> t
Lens.# UTCTime
pCreationDate_,
        $sel:lastUpdateDate:GatewaySummary' :: POSIX
lastUpdateDate = Tagged UTCTime (Identity UTCTime) -> Tagged POSIX (Identity POSIX)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
 -> Tagged POSIX (Identity POSIX))
-> UTCTime -> POSIX
forall t b. AReview t b -> b -> t
Lens.# UTCTime
pLastUpdateDate_
      }

-- | Undocumented member.
gatewaySummary_gatewayPlatform :: Lens.Lens' GatewaySummary (Prelude.Maybe GatewayPlatform)
gatewaySummary_gatewayPlatform :: (Maybe GatewayPlatform -> f (Maybe GatewayPlatform))
-> GatewaySummary -> f GatewaySummary
gatewaySummary_gatewayPlatform = (GatewaySummary -> Maybe GatewayPlatform)
-> (GatewaySummary -> Maybe GatewayPlatform -> GatewaySummary)
-> Lens
     GatewaySummary
     GatewaySummary
     (Maybe GatewayPlatform)
     (Maybe GatewayPlatform)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GatewaySummary' {Maybe GatewayPlatform
gatewayPlatform :: Maybe GatewayPlatform
$sel:gatewayPlatform:GatewaySummary' :: GatewaySummary -> Maybe GatewayPlatform
gatewayPlatform} -> Maybe GatewayPlatform
gatewayPlatform) (\s :: GatewaySummary
s@GatewaySummary' {} Maybe GatewayPlatform
a -> GatewaySummary
s {$sel:gatewayPlatform:GatewaySummary' :: Maybe GatewayPlatform
gatewayPlatform = Maybe GatewayPlatform
a} :: GatewaySummary)

-- | A list of gateway capability summaries that each contain a namespace and
-- status. Each gateway capability defines data sources for the gateway. To
-- retrieve a capability configuration\'s definition, use
-- <https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/API_DescribeGatewayCapabilityConfiguration.html DescribeGatewayCapabilityConfiguration>.
gatewaySummary_gatewayCapabilitySummaries :: Lens.Lens' GatewaySummary (Prelude.Maybe [GatewayCapabilitySummary])
gatewaySummary_gatewayCapabilitySummaries :: (Maybe [GatewayCapabilitySummary]
 -> f (Maybe [GatewayCapabilitySummary]))
-> GatewaySummary -> f GatewaySummary
gatewaySummary_gatewayCapabilitySummaries = (GatewaySummary -> Maybe [GatewayCapabilitySummary])
-> (GatewaySummary
    -> Maybe [GatewayCapabilitySummary] -> GatewaySummary)
-> Lens
     GatewaySummary
     GatewaySummary
     (Maybe [GatewayCapabilitySummary])
     (Maybe [GatewayCapabilitySummary])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GatewaySummary' {Maybe [GatewayCapabilitySummary]
gatewayCapabilitySummaries :: Maybe [GatewayCapabilitySummary]
$sel:gatewayCapabilitySummaries:GatewaySummary' :: GatewaySummary -> Maybe [GatewayCapabilitySummary]
gatewayCapabilitySummaries} -> Maybe [GatewayCapabilitySummary]
gatewayCapabilitySummaries) (\s :: GatewaySummary
s@GatewaySummary' {} Maybe [GatewayCapabilitySummary]
a -> GatewaySummary
s {$sel:gatewayCapabilitySummaries:GatewaySummary' :: Maybe [GatewayCapabilitySummary]
gatewayCapabilitySummaries = Maybe [GatewayCapabilitySummary]
a} :: GatewaySummary) ((Maybe [GatewayCapabilitySummary]
  -> f (Maybe [GatewayCapabilitySummary]))
 -> GatewaySummary -> f GatewaySummary)
-> ((Maybe [GatewayCapabilitySummary]
     -> f (Maybe [GatewayCapabilitySummary]))
    -> Maybe [GatewayCapabilitySummary]
    -> f (Maybe [GatewayCapabilitySummary]))
-> (Maybe [GatewayCapabilitySummary]
    -> f (Maybe [GatewayCapabilitySummary]))
-> GatewaySummary
-> f GatewaySummary
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [GatewayCapabilitySummary]
  [GatewayCapabilitySummary]
  [GatewayCapabilitySummary]
  [GatewayCapabilitySummary]
-> Iso
     (Maybe [GatewayCapabilitySummary])
     (Maybe [GatewayCapabilitySummary])
     (Maybe [GatewayCapabilitySummary])
     (Maybe [GatewayCapabilitySummary])
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
  [GatewayCapabilitySummary]
  [GatewayCapabilitySummary]
  [GatewayCapabilitySummary]
  [GatewayCapabilitySummary]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The ID of the gateway device.
gatewaySummary_gatewayId :: Lens.Lens' GatewaySummary Prelude.Text
gatewaySummary_gatewayId :: (Text -> f Text) -> GatewaySummary -> f GatewaySummary
gatewaySummary_gatewayId = (GatewaySummary -> Text)
-> (GatewaySummary -> Text -> GatewaySummary)
-> Lens GatewaySummary GatewaySummary Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GatewaySummary' {Text
gatewayId :: Text
$sel:gatewayId:GatewaySummary' :: GatewaySummary -> Text
gatewayId} -> Text
gatewayId) (\s :: GatewaySummary
s@GatewaySummary' {} Text
a -> GatewaySummary
s {$sel:gatewayId:GatewaySummary' :: Text
gatewayId = Text
a} :: GatewaySummary)

-- | The name of the asset.
gatewaySummary_gatewayName :: Lens.Lens' GatewaySummary Prelude.Text
gatewaySummary_gatewayName :: (Text -> f Text) -> GatewaySummary -> f GatewaySummary
gatewaySummary_gatewayName = (GatewaySummary -> Text)
-> (GatewaySummary -> Text -> GatewaySummary)
-> Lens GatewaySummary GatewaySummary Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GatewaySummary' {Text
gatewayName :: Text
$sel:gatewayName:GatewaySummary' :: GatewaySummary -> Text
gatewayName} -> Text
gatewayName) (\s :: GatewaySummary
s@GatewaySummary' {} Text
a -> GatewaySummary
s {$sel:gatewayName:GatewaySummary' :: Text
gatewayName = Text
a} :: GatewaySummary)

-- | The date the gateway was created, in Unix epoch time.
gatewaySummary_creationDate :: Lens.Lens' GatewaySummary Prelude.UTCTime
gatewaySummary_creationDate :: (UTCTime -> f UTCTime) -> GatewaySummary -> f GatewaySummary
gatewaySummary_creationDate = (GatewaySummary -> POSIX)
-> (GatewaySummary -> POSIX -> GatewaySummary)
-> Lens GatewaySummary GatewaySummary POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GatewaySummary' {POSIX
creationDate :: POSIX
$sel:creationDate:GatewaySummary' :: GatewaySummary -> POSIX
creationDate} -> POSIX
creationDate) (\s :: GatewaySummary
s@GatewaySummary' {} POSIX
a -> GatewaySummary
s {$sel:creationDate:GatewaySummary' :: POSIX
creationDate = POSIX
a} :: GatewaySummary) ((POSIX -> f POSIX) -> GatewaySummary -> f GatewaySummary)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> GatewaySummary
-> f GatewaySummary
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> POSIX -> f POSIX
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The date the gateway was last updated, in Unix epoch time.
gatewaySummary_lastUpdateDate :: Lens.Lens' GatewaySummary Prelude.UTCTime
gatewaySummary_lastUpdateDate :: (UTCTime -> f UTCTime) -> GatewaySummary -> f GatewaySummary
gatewaySummary_lastUpdateDate = (GatewaySummary -> POSIX)
-> (GatewaySummary -> POSIX -> GatewaySummary)
-> Lens GatewaySummary GatewaySummary POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GatewaySummary' {POSIX
lastUpdateDate :: POSIX
$sel:lastUpdateDate:GatewaySummary' :: GatewaySummary -> POSIX
lastUpdateDate} -> POSIX
lastUpdateDate) (\s :: GatewaySummary
s@GatewaySummary' {} POSIX
a -> GatewaySummary
s {$sel:lastUpdateDate:GatewaySummary' :: POSIX
lastUpdateDate = POSIX
a} :: GatewaySummary) ((POSIX -> f POSIX) -> GatewaySummary -> f GatewaySummary)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> GatewaySummary
-> f GatewaySummary
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> POSIX -> f POSIX
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

instance Core.FromJSON GatewaySummary where
  parseJSON :: Value -> Parser GatewaySummary
parseJSON =
    String
-> (Object -> Parser GatewaySummary)
-> Value
-> Parser GatewaySummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"GatewaySummary"
      ( \Object
x ->
          Maybe GatewayPlatform
-> Maybe [GatewayCapabilitySummary]
-> Text
-> Text
-> POSIX
-> POSIX
-> GatewaySummary
GatewaySummary'
            (Maybe GatewayPlatform
 -> Maybe [GatewayCapabilitySummary]
 -> Text
 -> Text
 -> POSIX
 -> POSIX
 -> GatewaySummary)
-> Parser (Maybe GatewayPlatform)
-> Parser
     (Maybe [GatewayCapabilitySummary]
      -> Text -> Text -> POSIX -> POSIX -> GatewaySummary)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe GatewayPlatform)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"gatewayPlatform")
            Parser
  (Maybe [GatewayCapabilitySummary]
   -> Text -> Text -> POSIX -> POSIX -> GatewaySummary)
-> Parser (Maybe [GatewayCapabilitySummary])
-> Parser (Text -> Text -> POSIX -> POSIX -> GatewaySummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe [GatewayCapabilitySummary]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"gatewayCapabilitySummaries"
                            Parser (Maybe (Maybe [GatewayCapabilitySummary]))
-> Maybe [GatewayCapabilitySummary]
-> Parser (Maybe [GatewayCapabilitySummary])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [GatewayCapabilitySummary]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser (Text -> Text -> POSIX -> POSIX -> GatewaySummary)
-> Parser Text -> Parser (Text -> POSIX -> POSIX -> GatewaySummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"gatewayId")
            Parser (Text -> POSIX -> POSIX -> GatewaySummary)
-> Parser Text -> Parser (POSIX -> POSIX -> GatewaySummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"gatewayName")
            Parser (POSIX -> POSIX -> GatewaySummary)
-> Parser POSIX -> Parser (POSIX -> GatewaySummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser POSIX
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"creationDate")
            Parser (POSIX -> GatewaySummary)
-> Parser POSIX -> Parser GatewaySummary
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser POSIX
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"lastUpdateDate")
      )

instance Prelude.Hashable GatewaySummary

instance Prelude.NFData GatewaySummary