{-# 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.RolesAnywhere.Types.SubjectSummary
-- 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.RolesAnywhere.Types.SubjectSummary 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

-- | A summary representation of Subject resources returned in read
-- operations; primarily ListSubjects.
--
-- /See:/ 'newSubjectSummary' smart constructor.
data SubjectSummary = SubjectSummary'
  { -- | The ISO-8601 time stamp of when the certificate was first used in a
    -- <https://docs.aws.amazon.com/rolesanywhere/latest/APIReference/API_CreateSession.html CreateSession>
    -- operation.
    SubjectSummary -> Maybe ISO8601
createdAt :: Prelude.Maybe Data.ISO8601,
    -- | The enabled status of the Subject.
    SubjectSummary -> Maybe Bool
enabled :: Prelude.Maybe Prelude.Bool,
    -- | The ISO-8601 time stamp of when the certificate was last used in a
    -- <https://docs.aws.amazon.com/rolesanywhere/latest/APIReference/API_CreateSession.html CreateSession>
    -- operation.
    SubjectSummary -> Maybe ISO8601
lastSeenAt :: Prelude.Maybe Data.ISO8601,
    -- | The ARN of the resource.
    SubjectSummary -> Maybe Text
subjectArn :: Prelude.Maybe Prelude.Text,
    -- | The id of the resource.
    SubjectSummary -> Maybe Text
subjectId :: Prelude.Maybe Prelude.Text,
    -- | The ISO-8601 timestamp when the subject was last updated.
    SubjectSummary -> Maybe ISO8601
updatedAt :: Prelude.Maybe Data.ISO8601,
    -- | The x509 principal identifier of the authenticating certificate.
    SubjectSummary -> Maybe Text
x509Subject :: Prelude.Maybe Prelude.Text
  }
  deriving (SubjectSummary -> SubjectSummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SubjectSummary -> SubjectSummary -> Bool
$c/= :: SubjectSummary -> SubjectSummary -> Bool
== :: SubjectSummary -> SubjectSummary -> Bool
$c== :: SubjectSummary -> SubjectSummary -> Bool
Prelude.Eq, ReadPrec [SubjectSummary]
ReadPrec SubjectSummary
Int -> ReadS SubjectSummary
ReadS [SubjectSummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SubjectSummary]
$creadListPrec :: ReadPrec [SubjectSummary]
readPrec :: ReadPrec SubjectSummary
$creadPrec :: ReadPrec SubjectSummary
readList :: ReadS [SubjectSummary]
$creadList :: ReadS [SubjectSummary]
readsPrec :: Int -> ReadS SubjectSummary
$creadsPrec :: Int -> ReadS SubjectSummary
Prelude.Read, Int -> SubjectSummary -> ShowS
[SubjectSummary] -> ShowS
SubjectSummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SubjectSummary] -> ShowS
$cshowList :: [SubjectSummary] -> ShowS
show :: SubjectSummary -> String
$cshow :: SubjectSummary -> String
showsPrec :: Int -> SubjectSummary -> ShowS
$cshowsPrec :: Int -> SubjectSummary -> ShowS
Prelude.Show, forall x. Rep SubjectSummary x -> SubjectSummary
forall x. SubjectSummary -> Rep SubjectSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SubjectSummary x -> SubjectSummary
$cfrom :: forall x. SubjectSummary -> Rep SubjectSummary x
Prelude.Generic)

-- |
-- Create a value of 'SubjectSummary' 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:
--
-- 'createdAt', 'subjectSummary_createdAt' - The ISO-8601 time stamp of when the certificate was first used in a
-- <https://docs.aws.amazon.com/rolesanywhere/latest/APIReference/API_CreateSession.html CreateSession>
-- operation.
--
-- 'enabled', 'subjectSummary_enabled' - The enabled status of the Subject.
--
-- 'lastSeenAt', 'subjectSummary_lastSeenAt' - The ISO-8601 time stamp of when the certificate was last used in a
-- <https://docs.aws.amazon.com/rolesanywhere/latest/APIReference/API_CreateSession.html CreateSession>
-- operation.
--
-- 'subjectArn', 'subjectSummary_subjectArn' - The ARN of the resource.
--
-- 'subjectId', 'subjectSummary_subjectId' - The id of the resource.
--
-- 'updatedAt', 'subjectSummary_updatedAt' - The ISO-8601 timestamp when the subject was last updated.
--
-- 'x509Subject', 'subjectSummary_x509Subject' - The x509 principal identifier of the authenticating certificate.
newSubjectSummary ::
  SubjectSummary
newSubjectSummary :: SubjectSummary
newSubjectSummary =
  SubjectSummary'
    { $sel:createdAt:SubjectSummary' :: Maybe ISO8601
createdAt = forall a. Maybe a
Prelude.Nothing,
      $sel:enabled:SubjectSummary' :: Maybe Bool
enabled = forall a. Maybe a
Prelude.Nothing,
      $sel:lastSeenAt:SubjectSummary' :: Maybe ISO8601
lastSeenAt = forall a. Maybe a
Prelude.Nothing,
      $sel:subjectArn:SubjectSummary' :: Maybe Text
subjectArn = forall a. Maybe a
Prelude.Nothing,
      $sel:subjectId:SubjectSummary' :: Maybe Text
subjectId = forall a. Maybe a
Prelude.Nothing,
      $sel:updatedAt:SubjectSummary' :: Maybe ISO8601
updatedAt = forall a. Maybe a
Prelude.Nothing,
      $sel:x509Subject:SubjectSummary' :: Maybe Text
x509Subject = forall a. Maybe a
Prelude.Nothing
    }

-- | The ISO-8601 time stamp of when the certificate was first used in a
-- <https://docs.aws.amazon.com/rolesanywhere/latest/APIReference/API_CreateSession.html CreateSession>
-- operation.
subjectSummary_createdAt :: Lens.Lens' SubjectSummary (Prelude.Maybe Prelude.UTCTime)
subjectSummary_createdAt :: Lens' SubjectSummary (Maybe UTCTime)
subjectSummary_createdAt = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SubjectSummary' {Maybe ISO8601
createdAt :: Maybe ISO8601
$sel:createdAt:SubjectSummary' :: SubjectSummary -> Maybe ISO8601
createdAt} -> Maybe ISO8601
createdAt) (\s :: SubjectSummary
s@SubjectSummary' {} Maybe ISO8601
a -> SubjectSummary
s {$sel:createdAt:SubjectSummary' :: Maybe ISO8601
createdAt = Maybe ISO8601
a} :: SubjectSummary) 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 enabled status of the Subject.
subjectSummary_enabled :: Lens.Lens' SubjectSummary (Prelude.Maybe Prelude.Bool)
subjectSummary_enabled :: Lens' SubjectSummary (Maybe Bool)
subjectSummary_enabled = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SubjectSummary' {Maybe Bool
enabled :: Maybe Bool
$sel:enabled:SubjectSummary' :: SubjectSummary -> Maybe Bool
enabled} -> Maybe Bool
enabled) (\s :: SubjectSummary
s@SubjectSummary' {} Maybe Bool
a -> SubjectSummary
s {$sel:enabled:SubjectSummary' :: Maybe Bool
enabled = Maybe Bool
a} :: SubjectSummary)

-- | The ISO-8601 time stamp of when the certificate was last used in a
-- <https://docs.aws.amazon.com/rolesanywhere/latest/APIReference/API_CreateSession.html CreateSession>
-- operation.
subjectSummary_lastSeenAt :: Lens.Lens' SubjectSummary (Prelude.Maybe Prelude.UTCTime)
subjectSummary_lastSeenAt :: Lens' SubjectSummary (Maybe UTCTime)
subjectSummary_lastSeenAt = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SubjectSummary' {Maybe ISO8601
lastSeenAt :: Maybe ISO8601
$sel:lastSeenAt:SubjectSummary' :: SubjectSummary -> Maybe ISO8601
lastSeenAt} -> Maybe ISO8601
lastSeenAt) (\s :: SubjectSummary
s@SubjectSummary' {} Maybe ISO8601
a -> SubjectSummary
s {$sel:lastSeenAt:SubjectSummary' :: Maybe ISO8601
lastSeenAt = Maybe ISO8601
a} :: SubjectSummary) 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 ARN of the resource.
subjectSummary_subjectArn :: Lens.Lens' SubjectSummary (Prelude.Maybe Prelude.Text)
subjectSummary_subjectArn :: Lens' SubjectSummary (Maybe Text)
subjectSummary_subjectArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SubjectSummary' {Maybe Text
subjectArn :: Maybe Text
$sel:subjectArn:SubjectSummary' :: SubjectSummary -> Maybe Text
subjectArn} -> Maybe Text
subjectArn) (\s :: SubjectSummary
s@SubjectSummary' {} Maybe Text
a -> SubjectSummary
s {$sel:subjectArn:SubjectSummary' :: Maybe Text
subjectArn = Maybe Text
a} :: SubjectSummary)

-- | The id of the resource.
subjectSummary_subjectId :: Lens.Lens' SubjectSummary (Prelude.Maybe Prelude.Text)
subjectSummary_subjectId :: Lens' SubjectSummary (Maybe Text)
subjectSummary_subjectId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SubjectSummary' {Maybe Text
subjectId :: Maybe Text
$sel:subjectId:SubjectSummary' :: SubjectSummary -> Maybe Text
subjectId} -> Maybe Text
subjectId) (\s :: SubjectSummary
s@SubjectSummary' {} Maybe Text
a -> SubjectSummary
s {$sel:subjectId:SubjectSummary' :: Maybe Text
subjectId = Maybe Text
a} :: SubjectSummary)

-- | The ISO-8601 timestamp when the subject was last updated.
subjectSummary_updatedAt :: Lens.Lens' SubjectSummary (Prelude.Maybe Prelude.UTCTime)
subjectSummary_updatedAt :: Lens' SubjectSummary (Maybe UTCTime)
subjectSummary_updatedAt = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SubjectSummary' {Maybe ISO8601
updatedAt :: Maybe ISO8601
$sel:updatedAt:SubjectSummary' :: SubjectSummary -> Maybe ISO8601
updatedAt} -> Maybe ISO8601
updatedAt) (\s :: SubjectSummary
s@SubjectSummary' {} Maybe ISO8601
a -> SubjectSummary
s {$sel:updatedAt:SubjectSummary' :: Maybe ISO8601
updatedAt = Maybe ISO8601
a} :: SubjectSummary) 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 x509 principal identifier of the authenticating certificate.
subjectSummary_x509Subject :: Lens.Lens' SubjectSummary (Prelude.Maybe Prelude.Text)
subjectSummary_x509Subject :: Lens' SubjectSummary (Maybe Text)
subjectSummary_x509Subject = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SubjectSummary' {Maybe Text
x509Subject :: Maybe Text
$sel:x509Subject:SubjectSummary' :: SubjectSummary -> Maybe Text
x509Subject} -> Maybe Text
x509Subject) (\s :: SubjectSummary
s@SubjectSummary' {} Maybe Text
a -> SubjectSummary
s {$sel:x509Subject:SubjectSummary' :: Maybe Text
x509Subject = Maybe Text
a} :: SubjectSummary)

instance Data.FromJSON SubjectSummary where
  parseJSON :: Value -> Parser SubjectSummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"SubjectSummary"
      ( \Object
x ->
          Maybe ISO8601
-> Maybe Bool
-> Maybe ISO8601
-> Maybe Text
-> Maybe Text
-> Maybe ISO8601
-> Maybe Text
-> SubjectSummary
SubjectSummary'
            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
"createdAt")
            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
"enabled")
            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
"lastSeenAt")
            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
"subjectArn")
            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
"subjectId")
            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
"updatedAt")
            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
"x509Subject")
      )

instance Prelude.Hashable SubjectSummary where
  hashWithSalt :: Int -> SubjectSummary -> Int
hashWithSalt Int
_salt SubjectSummary' {Maybe Bool
Maybe Text
Maybe ISO8601
x509Subject :: Maybe Text
updatedAt :: Maybe ISO8601
subjectId :: Maybe Text
subjectArn :: Maybe Text
lastSeenAt :: Maybe ISO8601
enabled :: Maybe Bool
createdAt :: Maybe ISO8601
$sel:x509Subject:SubjectSummary' :: SubjectSummary -> Maybe Text
$sel:updatedAt:SubjectSummary' :: SubjectSummary -> Maybe ISO8601
$sel:subjectId:SubjectSummary' :: SubjectSummary -> Maybe Text
$sel:subjectArn:SubjectSummary' :: SubjectSummary -> Maybe Text
$sel:lastSeenAt:SubjectSummary' :: SubjectSummary -> Maybe ISO8601
$sel:enabled:SubjectSummary' :: SubjectSummary -> Maybe Bool
$sel:createdAt:SubjectSummary' :: SubjectSummary -> Maybe ISO8601
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ISO8601
createdAt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
enabled
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ISO8601
lastSeenAt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
subjectArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
subjectId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ISO8601
updatedAt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
x509Subject

instance Prelude.NFData SubjectSummary where
  rnf :: SubjectSummary -> ()
rnf SubjectSummary' {Maybe Bool
Maybe Text
Maybe ISO8601
x509Subject :: Maybe Text
updatedAt :: Maybe ISO8601
subjectId :: Maybe Text
subjectArn :: Maybe Text
lastSeenAt :: Maybe ISO8601
enabled :: Maybe Bool
createdAt :: Maybe ISO8601
$sel:x509Subject:SubjectSummary' :: SubjectSummary -> Maybe Text
$sel:updatedAt:SubjectSummary' :: SubjectSummary -> Maybe ISO8601
$sel:subjectId:SubjectSummary' :: SubjectSummary -> Maybe Text
$sel:subjectArn:SubjectSummary' :: SubjectSummary -> Maybe Text
$sel:lastSeenAt:SubjectSummary' :: SubjectSummary -> Maybe ISO8601
$sel:enabled:SubjectSummary' :: SubjectSummary -> Maybe Bool
$sel:createdAt:SubjectSummary' :: SubjectSummary -> Maybe ISO8601
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe ISO8601
createdAt
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
enabled
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ISO8601
lastSeenAt
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
subjectArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
subjectId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ISO8601
updatedAt
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
x509Subject