{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.IoTSiteWise.Types.PortalSummary where

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

-- | Contains a portal summary.
--
-- /See:/ 'newPortalSummary' smart constructor.
data PortalSummary = PortalSummary'
  { -- | The date the portal was created, in Unix epoch time.
    PortalSummary -> Maybe POSIX
creationDate :: Prelude.Maybe Data.POSIX,
    -- | The portal\'s description.
    PortalSummary -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The date the portal was last updated, in Unix epoch time.
    PortalSummary -> Maybe POSIX
lastUpdateDate :: Prelude.Maybe Data.POSIX,
    -- | 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 IAM Identity Center 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
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]
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
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. 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:
--
-- 'creationDate', 'portalSummary_creationDate' - The date the portal was created, in Unix epoch time.
--
-- 'description', 'portalSummary_description' - The portal\'s description.
--
-- 'lastUpdateDate', 'portalSummary_lastUpdateDate' - The date the portal was last updated, in Unix epoch time.
--
-- '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 IAM Identity Center 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'
    { $sel:creationDate:PortalSummary' :: Maybe POSIX
creationDate = forall a. Maybe a
Prelude.Nothing,
      $sel:description:PortalSummary' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:lastUpdateDate:PortalSummary' :: Maybe POSIX
lastUpdateDate = forall a. Maybe a
Prelude.Nothing,
      $sel:roleArn:PortalSummary' :: Maybe Text
roleArn = 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 created, in Unix epoch time.
portalSummary_creationDate :: Lens.Lens' PortalSummary (Prelude.Maybe Prelude.UTCTime)
portalSummary_creationDate :: Lens' PortalSummary (Maybe UTCTime)
portalSummary_creationDate = 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) 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 portal\'s description.
portalSummary_description :: Lens.Lens' PortalSummary (Prelude.Maybe Prelude.Text)
portalSummary_description :: Lens' PortalSummary (Maybe Text)
portalSummary_description = 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 date the portal was last updated, in Unix epoch time.
portalSummary_lastUpdateDate :: Lens.Lens' PortalSummary (Prelude.Maybe Prelude.UTCTime)
portalSummary_lastUpdateDate :: Lens' PortalSummary (Maybe UTCTime)
portalSummary_lastUpdateDate = 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) 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
-- <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 :: Lens' PortalSummary (Maybe Text)
portalSummary_roleArn = 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 :: Lens' PortalSummary Text
portalSummary_id = 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 :: Lens' PortalSummary Text
portalSummary_name = 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 IAM Identity Center 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 :: Lens' PortalSummary Text
portalSummary_startUrl = 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 :: Lens' PortalSummary PortalStatus
portalSummary_status = 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 Data.FromJSON PortalSummary where
  parseJSON :: Value -> Parser PortalSummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"PortalSummary"
      ( \Object
x ->
          Maybe POSIX
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Text
-> Text
-> Text
-> PortalStatus
-> PortalSummary
PortalSummary'
            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
"creationDate")
            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
"lastUpdateDate")
            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
"roleArn")
            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
"id")
            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
"name")
            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
"startUrl")
            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
"status")
      )

instance Prelude.Hashable PortalSummary where
  hashWithSalt :: Int -> PortalSummary -> Int
hashWithSalt Int
_salt PortalSummary' {Maybe Text
Maybe POSIX
Text
PortalStatus
status :: PortalStatus
startUrl :: Text
name :: Text
id :: Text
roleArn :: Maybe Text
lastUpdateDate :: Maybe POSIX
description :: Maybe Text
creationDate :: Maybe POSIX
$sel:status:PortalSummary' :: PortalSummary -> PortalStatus
$sel:startUrl:PortalSummary' :: PortalSummary -> Text
$sel:name:PortalSummary' :: PortalSummary -> Text
$sel:id:PortalSummary' :: PortalSummary -> Text
$sel:roleArn:PortalSummary' :: PortalSummary -> Maybe Text
$sel:lastUpdateDate:PortalSummary' :: PortalSummary -> Maybe POSIX
$sel:description:PortalSummary' :: PortalSummary -> Maybe Text
$sel:creationDate:PortalSummary' :: PortalSummary -> Maybe POSIX
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
creationDate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
lastUpdateDate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
roleArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
id
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
startUrl
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` PortalStatus
status

instance Prelude.NFData PortalSummary where
  rnf :: PortalSummary -> ()
rnf PortalSummary' {Maybe Text
Maybe POSIX
Text
PortalStatus
status :: PortalStatus
startUrl :: Text
name :: Text
id :: Text
roleArn :: Maybe Text
lastUpdateDate :: Maybe POSIX
description :: Maybe Text
creationDate :: Maybe POSIX
$sel:status:PortalSummary' :: PortalSummary -> PortalStatus
$sel:startUrl:PortalSummary' :: PortalSummary -> Text
$sel:name:PortalSummary' :: PortalSummary -> Text
$sel:id:PortalSummary' :: PortalSummary -> Text
$sel:roleArn:PortalSummary' :: PortalSummary -> Maybe Text
$sel:lastUpdateDate:PortalSummary' :: PortalSummary -> Maybe POSIX
$sel:description:PortalSummary' :: PortalSummary -> Maybe Text
$sel:creationDate:PortalSummary' :: PortalSummary -> Maybe POSIX
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
creationDate
      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 POSIX
lastUpdateDate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
roleArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
id
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
startUrl
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf PortalStatus
status