{-# 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.PortalSummary
-- 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.PortalSummary where

import qualified Amazonka.Core as Core
import Amazonka.IoTSiteWise.Types.PortalStatus
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Contains a portal summary.
--
-- /See:/ 'newPortalSummary' smart constructor.
data PortalSummary = PortalSummary'
  { -- | The date the portal was last updated, in Unix epoch time.
    PortalSummary -> Maybe POSIX
lastUpdateDate :: Prelude.Maybe Core.POSIX,
    -- | The date the portal was created, in Unix epoch time.
    PortalSummary -> Maybe POSIX
creationDate :: Prelude.Maybe Core.POSIX,
    -- | The portal\'s description.
    PortalSummary -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The
    -- <https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html ARN>
    -- of the service role that allows the portal\'s users to access your IoT
    -- SiteWise resources on your behalf. For more information, see
    -- <https://docs.aws.amazon.com/iot-sitewise/latest/userguide/monitor-service-role.html Using service roles for IoT SiteWise Monitor>
    -- in the /IoT SiteWise User Guide/.
    PortalSummary -> Maybe Text
roleArn :: Prelude.Maybe Prelude.Text,
    -- | The ID of the portal.
    PortalSummary -> Text
id :: Prelude.Text,
    -- | The name of the portal.
    PortalSummary -> Text
name :: Prelude.Text,
    -- | The URL for the IoT SiteWise Monitor portal. You can use this URL to
    -- access portals that use Amazon Web Services SSO for authentication. For
    -- portals that use IAM for authentication, you must use the IoT SiteWise
    -- console to get a URL that you can use to access the portal.
    PortalSummary -> Text
startUrl :: Prelude.Text,
    PortalSummary -> PortalStatus
status :: PortalStatus
  }
  deriving (PortalSummary -> PortalSummary -> Bool
(PortalSummary -> PortalSummary -> Bool)
-> (PortalSummary -> PortalSummary -> Bool) -> Eq PortalSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PortalSummary -> PortalSummary -> Bool
$c/= :: PortalSummary -> PortalSummary -> Bool
== :: PortalSummary -> PortalSummary -> Bool
$c== :: PortalSummary -> PortalSummary -> Bool
Prelude.Eq, ReadPrec [PortalSummary]
ReadPrec PortalSummary
Int -> ReadS PortalSummary
ReadS [PortalSummary]
(Int -> ReadS PortalSummary)
-> ReadS [PortalSummary]
-> ReadPrec PortalSummary
-> ReadPrec [PortalSummary]
-> Read PortalSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PortalSummary]
$creadListPrec :: ReadPrec [PortalSummary]
readPrec :: ReadPrec PortalSummary
$creadPrec :: ReadPrec PortalSummary
readList :: ReadS [PortalSummary]
$creadList :: ReadS [PortalSummary]
readsPrec :: Int -> ReadS PortalSummary
$creadsPrec :: Int -> ReadS PortalSummary
Prelude.Read, Int -> PortalSummary -> ShowS
[PortalSummary] -> ShowS
PortalSummary -> String
(Int -> PortalSummary -> ShowS)
-> (PortalSummary -> String)
-> ([PortalSummary] -> ShowS)
-> Show PortalSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PortalSummary] -> ShowS
$cshowList :: [PortalSummary] -> ShowS
show :: PortalSummary -> String
$cshow :: PortalSummary -> String
showsPrec :: Int -> PortalSummary -> ShowS
$cshowsPrec :: Int -> PortalSummary -> ShowS
Prelude.Show, (forall x. PortalSummary -> Rep PortalSummary x)
-> (forall x. Rep PortalSummary x -> PortalSummary)
-> Generic PortalSummary
forall x. Rep PortalSummary x -> PortalSummary
forall x. PortalSummary -> Rep PortalSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PortalSummary x -> PortalSummary
$cfrom :: forall x. PortalSummary -> Rep PortalSummary x
Prelude.Generic)

-- |
-- Create a value of 'PortalSummary' 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:
--
-- 'lastUpdateDate', 'portalSummary_lastUpdateDate' - The date the portal was last updated, in Unix epoch time.
--
-- 'creationDate', 'portalSummary_creationDate' - The date the portal was created, in Unix epoch time.
--
-- 'description', 'portalSummary_description' - The portal\'s description.
--
-- 'roleArn', 'portalSummary_roleArn' - The
-- <https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html ARN>
-- of the service role that allows the portal\'s users to access your IoT
-- SiteWise resources on your behalf. For more information, see
-- <https://docs.aws.amazon.com/iot-sitewise/latest/userguide/monitor-service-role.html Using service roles for IoT SiteWise Monitor>
-- in the /IoT SiteWise User Guide/.
--
-- 'id', 'portalSummary_id' - The ID of the portal.
--
-- 'name', 'portalSummary_name' - The name of the portal.
--
-- 'startUrl', 'portalSummary_startUrl' - The URL for the IoT SiteWise Monitor portal. You can use this URL to
-- access portals that use Amazon Web Services SSO for authentication. For
-- portals that use IAM for authentication, you must use the IoT SiteWise
-- console to get a URL that you can use to access the portal.
--
-- 'status', 'portalSummary_status' - Undocumented member.
newPortalSummary ::
  -- | 'id'
  Prelude.Text ->
  -- | 'name'
  Prelude.Text ->
  -- | 'startUrl'
  Prelude.Text ->
  -- | 'status'
  PortalStatus ->
  PortalSummary
newPortalSummary :: Text -> Text -> Text -> PortalStatus -> PortalSummary
newPortalSummary Text
pId_ Text
pName_ Text
pStartUrl_ PortalStatus
pStatus_ =
  PortalSummary' :: Maybe POSIX
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Text
-> Text
-> Text
-> PortalStatus
-> PortalSummary
PortalSummary'
    { $sel:lastUpdateDate:PortalSummary' :: Maybe POSIX
lastUpdateDate = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:creationDate:PortalSummary' :: Maybe POSIX
creationDate = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:description:PortalSummary' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:roleArn:PortalSummary' :: Maybe Text
roleArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:id:PortalSummary' :: Text
id = Text
pId_,
      $sel:name:PortalSummary' :: Text
name = Text
pName_,
      $sel:startUrl:PortalSummary' :: Text
startUrl = Text
pStartUrl_,
      $sel:status:PortalSummary' :: PortalStatus
status = PortalStatus
pStatus_
    }

-- | The date the portal was last updated, in Unix epoch time.
portalSummary_lastUpdateDate :: Lens.Lens' PortalSummary (Prelude.Maybe Prelude.UTCTime)
portalSummary_lastUpdateDate :: (Maybe UTCTime -> f (Maybe UTCTime))
-> PortalSummary -> f PortalSummary
portalSummary_lastUpdateDate = (PortalSummary -> Maybe POSIX)
-> (PortalSummary -> Maybe POSIX -> PortalSummary)
-> Lens PortalSummary PortalSummary (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PortalSummary' {Maybe POSIX
lastUpdateDate :: Maybe POSIX
$sel:lastUpdateDate:PortalSummary' :: PortalSummary -> Maybe POSIX
lastUpdateDate} -> Maybe POSIX
lastUpdateDate) (\s :: PortalSummary
s@PortalSummary' {} Maybe POSIX
a -> PortalSummary
s {$sel:lastUpdateDate:PortalSummary' :: Maybe POSIX
lastUpdateDate = Maybe POSIX
a} :: PortalSummary) ((Maybe POSIX -> f (Maybe POSIX))
 -> PortalSummary -> f PortalSummary)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> PortalSummary
-> f PortalSummary
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

-- | The date the portal was created, in Unix epoch time.
portalSummary_creationDate :: Lens.Lens' PortalSummary (Prelude.Maybe Prelude.UTCTime)
portalSummary_creationDate :: (Maybe UTCTime -> f (Maybe UTCTime))
-> PortalSummary -> f PortalSummary
portalSummary_creationDate = (PortalSummary -> Maybe POSIX)
-> (PortalSummary -> Maybe POSIX -> PortalSummary)
-> Lens PortalSummary PortalSummary (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PortalSummary' {Maybe POSIX
creationDate :: Maybe POSIX
$sel:creationDate:PortalSummary' :: PortalSummary -> Maybe POSIX
creationDate} -> Maybe POSIX
creationDate) (\s :: PortalSummary
s@PortalSummary' {} Maybe POSIX
a -> PortalSummary
s {$sel:creationDate:PortalSummary' :: Maybe POSIX
creationDate = Maybe POSIX
a} :: PortalSummary) ((Maybe POSIX -> f (Maybe POSIX))
 -> PortalSummary -> f PortalSummary)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> PortalSummary
-> f PortalSummary
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

-- | The portal\'s description.
portalSummary_description :: Lens.Lens' PortalSummary (Prelude.Maybe Prelude.Text)
portalSummary_description :: (Maybe Text -> f (Maybe Text)) -> PortalSummary -> f PortalSummary
portalSummary_description = (PortalSummary -> Maybe Text)
-> (PortalSummary -> Maybe Text -> PortalSummary)
-> Lens PortalSummary PortalSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PortalSummary' {Maybe Text
description :: Maybe Text
$sel:description:PortalSummary' :: PortalSummary -> Maybe Text
description} -> Maybe Text
description) (\s :: PortalSummary
s@PortalSummary' {} Maybe Text
a -> PortalSummary
s {$sel:description:PortalSummary' :: Maybe Text
description = Maybe Text
a} :: PortalSummary)

-- | The
-- <https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html ARN>
-- of the service role that allows the portal\'s users to access your IoT
-- SiteWise resources on your behalf. For more information, see
-- <https://docs.aws.amazon.com/iot-sitewise/latest/userguide/monitor-service-role.html Using service roles for IoT SiteWise Monitor>
-- in the /IoT SiteWise User Guide/.
portalSummary_roleArn :: Lens.Lens' PortalSummary (Prelude.Maybe Prelude.Text)
portalSummary_roleArn :: (Maybe Text -> f (Maybe Text)) -> PortalSummary -> f PortalSummary
portalSummary_roleArn = (PortalSummary -> Maybe Text)
-> (PortalSummary -> Maybe Text -> PortalSummary)
-> Lens PortalSummary PortalSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PortalSummary' {Maybe Text
roleArn :: Maybe Text
$sel:roleArn:PortalSummary' :: PortalSummary -> Maybe Text
roleArn} -> Maybe Text
roleArn) (\s :: PortalSummary
s@PortalSummary' {} Maybe Text
a -> PortalSummary
s {$sel:roleArn:PortalSummary' :: Maybe Text
roleArn = Maybe Text
a} :: PortalSummary)

-- | The ID of the portal.
portalSummary_id :: Lens.Lens' PortalSummary Prelude.Text
portalSummary_id :: (Text -> f Text) -> PortalSummary -> f PortalSummary
portalSummary_id = (PortalSummary -> Text)
-> (PortalSummary -> Text -> PortalSummary)
-> Lens PortalSummary PortalSummary Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PortalSummary' {Text
id :: Text
$sel:id:PortalSummary' :: PortalSummary -> Text
id} -> Text
id) (\s :: PortalSummary
s@PortalSummary' {} Text
a -> PortalSummary
s {$sel:id:PortalSummary' :: Text
id = Text
a} :: PortalSummary)

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

-- | The URL for the IoT SiteWise Monitor portal. You can use this URL to
-- access portals that use Amazon Web Services SSO for authentication. For
-- portals that use IAM for authentication, you must use the IoT SiteWise
-- console to get a URL that you can use to access the portal.
portalSummary_startUrl :: Lens.Lens' PortalSummary Prelude.Text
portalSummary_startUrl :: (Text -> f Text) -> PortalSummary -> f PortalSummary
portalSummary_startUrl = (PortalSummary -> Text)
-> (PortalSummary -> Text -> PortalSummary)
-> Lens PortalSummary PortalSummary Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PortalSummary' {Text
startUrl :: Text
$sel:startUrl:PortalSummary' :: PortalSummary -> Text
startUrl} -> Text
startUrl) (\s :: PortalSummary
s@PortalSummary' {} Text
a -> PortalSummary
s {$sel:startUrl:PortalSummary' :: Text
startUrl = Text
a} :: PortalSummary)

-- | Undocumented member.
portalSummary_status :: Lens.Lens' PortalSummary PortalStatus
portalSummary_status :: (PortalStatus -> f PortalStatus)
-> PortalSummary -> f PortalSummary
portalSummary_status = (PortalSummary -> PortalStatus)
-> (PortalSummary -> PortalStatus -> PortalSummary)
-> Lens PortalSummary PortalSummary PortalStatus PortalStatus
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PortalSummary' {PortalStatus
status :: PortalStatus
$sel:status:PortalSummary' :: PortalSummary -> PortalStatus
status} -> PortalStatus
status) (\s :: PortalSummary
s@PortalSummary' {} PortalStatus
a -> PortalSummary
s {$sel:status:PortalSummary' :: PortalStatus
status = PortalStatus
a} :: PortalSummary)

instance Core.FromJSON PortalSummary where
  parseJSON :: Value -> Parser PortalSummary
parseJSON =
    String
-> (Object -> Parser PortalSummary)
-> Value
-> Parser PortalSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"PortalSummary"
      ( \Object
x ->
          Maybe POSIX
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Text
-> Text
-> Text
-> PortalStatus
-> PortalSummary
PortalSummary'
            (Maybe POSIX
 -> Maybe POSIX
 -> Maybe Text
 -> Maybe Text
 -> Text
 -> Text
 -> Text
 -> PortalStatus
 -> PortalSummary)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe POSIX
      -> Maybe Text
      -> Maybe Text
      -> Text
      -> Text
      -> Text
      -> PortalStatus
      -> PortalSummary)
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
"lastUpdateDate")
            Parser
  (Maybe POSIX
   -> Maybe Text
   -> Maybe Text
   -> Text
   -> Text
   -> Text
   -> PortalStatus
   -> PortalSummary)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Text
      -> Text
      -> Text
      -> PortalStatus
      -> PortalSummary)
forall (f :: * -> *) a b. Applicative f => 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
"creationDate")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Text
   -> Text
   -> Text
   -> PortalStatus
   -> PortalSummary)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Text -> Text -> Text -> PortalStatus -> PortalSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"description")
            Parser
  (Maybe Text
   -> Text -> Text -> Text -> PortalStatus -> PortalSummary)
-> Parser (Maybe Text)
-> Parser (Text -> Text -> Text -> PortalStatus -> PortalSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"roleArn")
            Parser (Text -> Text -> Text -> PortalStatus -> PortalSummary)
-> Parser Text
-> Parser (Text -> Text -> PortalStatus -> PortalSummary)
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
"id")
            Parser (Text -> Text -> PortalStatus -> PortalSummary)
-> Parser Text -> Parser (Text -> PortalStatus -> PortalSummary)
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
"name")
            Parser (Text -> PortalStatus -> PortalSummary)
-> Parser Text -> Parser (PortalStatus -> PortalSummary)
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
"startUrl")
            Parser (PortalStatus -> PortalSummary)
-> Parser PortalStatus -> Parser PortalSummary
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser PortalStatus
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"status")
      )

instance Prelude.Hashable PortalSummary

instance Prelude.NFData PortalSummary