{-# 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.TrustAnchorDetail
-- 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.TrustAnchorDetail 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
import Amazonka.RolesAnywhere.Types.Source

-- | The state of the trust anchor after a read or write operation.
--
-- /See:/ 'newTrustAnchorDetail' smart constructor.
data TrustAnchorDetail = TrustAnchorDetail'
  { -- | The ISO-8601 timestamp when the trust anchor was created.
    TrustAnchorDetail -> Maybe ISO8601
createdAt :: Prelude.Maybe Data.ISO8601,
    -- | Indicates whether the trust anchor is enabled.
    TrustAnchorDetail -> Maybe Bool
enabled :: Prelude.Maybe Prelude.Bool,
    -- | The name of the trust anchor.
    TrustAnchorDetail -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The trust anchor type and its related certificate data.
    TrustAnchorDetail -> Maybe Source
source :: Prelude.Maybe Source,
    -- | The ARN of the trust anchor.
    TrustAnchorDetail -> Maybe Text
trustAnchorArn :: Prelude.Maybe Prelude.Text,
    -- | The unique identifier of the trust anchor.
    TrustAnchorDetail -> Maybe Text
trustAnchorId :: Prelude.Maybe Prelude.Text,
    -- | The ISO-8601 timestamp when the trust anchor was last updated.
    TrustAnchorDetail -> Maybe ISO8601
updatedAt :: Prelude.Maybe Data.ISO8601
  }
  deriving (TrustAnchorDetail -> TrustAnchorDetail -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TrustAnchorDetail -> TrustAnchorDetail -> Bool
$c/= :: TrustAnchorDetail -> TrustAnchorDetail -> Bool
== :: TrustAnchorDetail -> TrustAnchorDetail -> Bool
$c== :: TrustAnchorDetail -> TrustAnchorDetail -> Bool
Prelude.Eq, ReadPrec [TrustAnchorDetail]
ReadPrec TrustAnchorDetail
Int -> ReadS TrustAnchorDetail
ReadS [TrustAnchorDetail]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TrustAnchorDetail]
$creadListPrec :: ReadPrec [TrustAnchorDetail]
readPrec :: ReadPrec TrustAnchorDetail
$creadPrec :: ReadPrec TrustAnchorDetail
readList :: ReadS [TrustAnchorDetail]
$creadList :: ReadS [TrustAnchorDetail]
readsPrec :: Int -> ReadS TrustAnchorDetail
$creadsPrec :: Int -> ReadS TrustAnchorDetail
Prelude.Read, Int -> TrustAnchorDetail -> ShowS
[TrustAnchorDetail] -> ShowS
TrustAnchorDetail -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TrustAnchorDetail] -> ShowS
$cshowList :: [TrustAnchorDetail] -> ShowS
show :: TrustAnchorDetail -> String
$cshow :: TrustAnchorDetail -> String
showsPrec :: Int -> TrustAnchorDetail -> ShowS
$cshowsPrec :: Int -> TrustAnchorDetail -> ShowS
Prelude.Show, forall x. Rep TrustAnchorDetail x -> TrustAnchorDetail
forall x. TrustAnchorDetail -> Rep TrustAnchorDetail x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TrustAnchorDetail x -> TrustAnchorDetail
$cfrom :: forall x. TrustAnchorDetail -> Rep TrustAnchorDetail x
Prelude.Generic)

-- |
-- Create a value of 'TrustAnchorDetail' 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', 'trustAnchorDetail_createdAt' - The ISO-8601 timestamp when the trust anchor was created.
--
-- 'enabled', 'trustAnchorDetail_enabled' - Indicates whether the trust anchor is enabled.
--
-- 'name', 'trustAnchorDetail_name' - The name of the trust anchor.
--
-- 'source', 'trustAnchorDetail_source' - The trust anchor type and its related certificate data.
--
-- 'trustAnchorArn', 'trustAnchorDetail_trustAnchorArn' - The ARN of the trust anchor.
--
-- 'trustAnchorId', 'trustAnchorDetail_trustAnchorId' - The unique identifier of the trust anchor.
--
-- 'updatedAt', 'trustAnchorDetail_updatedAt' - The ISO-8601 timestamp when the trust anchor was last updated.
newTrustAnchorDetail ::
  TrustAnchorDetail
newTrustAnchorDetail :: TrustAnchorDetail
newTrustAnchorDetail =
  TrustAnchorDetail'
    { $sel:createdAt:TrustAnchorDetail' :: Maybe ISO8601
createdAt = forall a. Maybe a
Prelude.Nothing,
      $sel:enabled:TrustAnchorDetail' :: Maybe Bool
enabled = forall a. Maybe a
Prelude.Nothing,
      $sel:name:TrustAnchorDetail' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:source:TrustAnchorDetail' :: Maybe Source
source = forall a. Maybe a
Prelude.Nothing,
      $sel:trustAnchorArn:TrustAnchorDetail' :: Maybe Text
trustAnchorArn = forall a. Maybe a
Prelude.Nothing,
      $sel:trustAnchorId:TrustAnchorDetail' :: Maybe Text
trustAnchorId = forall a. Maybe a
Prelude.Nothing,
      $sel:updatedAt:TrustAnchorDetail' :: Maybe ISO8601
updatedAt = forall a. Maybe a
Prelude.Nothing
    }

-- | The ISO-8601 timestamp when the trust anchor was created.
trustAnchorDetail_createdAt :: Lens.Lens' TrustAnchorDetail (Prelude.Maybe Prelude.UTCTime)
trustAnchorDetail_createdAt :: Lens' TrustAnchorDetail (Maybe UTCTime)
trustAnchorDetail_createdAt = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TrustAnchorDetail' {Maybe ISO8601
createdAt :: Maybe ISO8601
$sel:createdAt:TrustAnchorDetail' :: TrustAnchorDetail -> Maybe ISO8601
createdAt} -> Maybe ISO8601
createdAt) (\s :: TrustAnchorDetail
s@TrustAnchorDetail' {} Maybe ISO8601
a -> TrustAnchorDetail
s {$sel:createdAt:TrustAnchorDetail' :: Maybe ISO8601
createdAt = Maybe ISO8601
a} :: TrustAnchorDetail) 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

-- | Indicates whether the trust anchor is enabled.
trustAnchorDetail_enabled :: Lens.Lens' TrustAnchorDetail (Prelude.Maybe Prelude.Bool)
trustAnchorDetail_enabled :: Lens' TrustAnchorDetail (Maybe Bool)
trustAnchorDetail_enabled = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TrustAnchorDetail' {Maybe Bool
enabled :: Maybe Bool
$sel:enabled:TrustAnchorDetail' :: TrustAnchorDetail -> Maybe Bool
enabled} -> Maybe Bool
enabled) (\s :: TrustAnchorDetail
s@TrustAnchorDetail' {} Maybe Bool
a -> TrustAnchorDetail
s {$sel:enabled:TrustAnchorDetail' :: Maybe Bool
enabled = Maybe Bool
a} :: TrustAnchorDetail)

-- | The name of the trust anchor.
trustAnchorDetail_name :: Lens.Lens' TrustAnchorDetail (Prelude.Maybe Prelude.Text)
trustAnchorDetail_name :: Lens' TrustAnchorDetail (Maybe Text)
trustAnchorDetail_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TrustAnchorDetail' {Maybe Text
name :: Maybe Text
$sel:name:TrustAnchorDetail' :: TrustAnchorDetail -> Maybe Text
name} -> Maybe Text
name) (\s :: TrustAnchorDetail
s@TrustAnchorDetail' {} Maybe Text
a -> TrustAnchorDetail
s {$sel:name:TrustAnchorDetail' :: Maybe Text
name = Maybe Text
a} :: TrustAnchorDetail)

-- | The trust anchor type and its related certificate data.
trustAnchorDetail_source :: Lens.Lens' TrustAnchorDetail (Prelude.Maybe Source)
trustAnchorDetail_source :: Lens' TrustAnchorDetail (Maybe Source)
trustAnchorDetail_source = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TrustAnchorDetail' {Maybe Source
source :: Maybe Source
$sel:source:TrustAnchorDetail' :: TrustAnchorDetail -> Maybe Source
source} -> Maybe Source
source) (\s :: TrustAnchorDetail
s@TrustAnchorDetail' {} Maybe Source
a -> TrustAnchorDetail
s {$sel:source:TrustAnchorDetail' :: Maybe Source
source = Maybe Source
a} :: TrustAnchorDetail)

-- | The ARN of the trust anchor.
trustAnchorDetail_trustAnchorArn :: Lens.Lens' TrustAnchorDetail (Prelude.Maybe Prelude.Text)
trustAnchorDetail_trustAnchorArn :: Lens' TrustAnchorDetail (Maybe Text)
trustAnchorDetail_trustAnchorArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TrustAnchorDetail' {Maybe Text
trustAnchorArn :: Maybe Text
$sel:trustAnchorArn:TrustAnchorDetail' :: TrustAnchorDetail -> Maybe Text
trustAnchorArn} -> Maybe Text
trustAnchorArn) (\s :: TrustAnchorDetail
s@TrustAnchorDetail' {} Maybe Text
a -> TrustAnchorDetail
s {$sel:trustAnchorArn:TrustAnchorDetail' :: Maybe Text
trustAnchorArn = Maybe Text
a} :: TrustAnchorDetail)

-- | The unique identifier of the trust anchor.
trustAnchorDetail_trustAnchorId :: Lens.Lens' TrustAnchorDetail (Prelude.Maybe Prelude.Text)
trustAnchorDetail_trustAnchorId :: Lens' TrustAnchorDetail (Maybe Text)
trustAnchorDetail_trustAnchorId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TrustAnchorDetail' {Maybe Text
trustAnchorId :: Maybe Text
$sel:trustAnchorId:TrustAnchorDetail' :: TrustAnchorDetail -> Maybe Text
trustAnchorId} -> Maybe Text
trustAnchorId) (\s :: TrustAnchorDetail
s@TrustAnchorDetail' {} Maybe Text
a -> TrustAnchorDetail
s {$sel:trustAnchorId:TrustAnchorDetail' :: Maybe Text
trustAnchorId = Maybe Text
a} :: TrustAnchorDetail)

-- | The ISO-8601 timestamp when the trust anchor was last updated.
trustAnchorDetail_updatedAt :: Lens.Lens' TrustAnchorDetail (Prelude.Maybe Prelude.UTCTime)
trustAnchorDetail_updatedAt :: Lens' TrustAnchorDetail (Maybe UTCTime)
trustAnchorDetail_updatedAt = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TrustAnchorDetail' {Maybe ISO8601
updatedAt :: Maybe ISO8601
$sel:updatedAt:TrustAnchorDetail' :: TrustAnchorDetail -> Maybe ISO8601
updatedAt} -> Maybe ISO8601
updatedAt) (\s :: TrustAnchorDetail
s@TrustAnchorDetail' {} Maybe ISO8601
a -> TrustAnchorDetail
s {$sel:updatedAt:TrustAnchorDetail' :: Maybe ISO8601
updatedAt = Maybe ISO8601
a} :: TrustAnchorDetail) 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

instance Data.FromJSON TrustAnchorDetail where
  parseJSON :: Value -> Parser TrustAnchorDetail
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"TrustAnchorDetail"
      ( \Object
x ->
          Maybe ISO8601
-> Maybe Bool
-> Maybe Text
-> Maybe Source
-> Maybe Text
-> Maybe Text
-> Maybe ISO8601
-> TrustAnchorDetail
TrustAnchorDetail'
            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
"name")
            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
"source")
            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
"trustAnchorArn")
            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
"trustAnchorId")
            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")
      )

instance Prelude.Hashable TrustAnchorDetail where
  hashWithSalt :: Int -> TrustAnchorDetail -> Int
hashWithSalt Int
_salt TrustAnchorDetail' {Maybe Bool
Maybe Text
Maybe ISO8601
Maybe Source
updatedAt :: Maybe ISO8601
trustAnchorId :: Maybe Text
trustAnchorArn :: Maybe Text
source :: Maybe Source
name :: Maybe Text
enabled :: Maybe Bool
createdAt :: Maybe ISO8601
$sel:updatedAt:TrustAnchorDetail' :: TrustAnchorDetail -> Maybe ISO8601
$sel:trustAnchorId:TrustAnchorDetail' :: TrustAnchorDetail -> Maybe Text
$sel:trustAnchorArn:TrustAnchorDetail' :: TrustAnchorDetail -> Maybe Text
$sel:source:TrustAnchorDetail' :: TrustAnchorDetail -> Maybe Source
$sel:name:TrustAnchorDetail' :: TrustAnchorDetail -> Maybe Text
$sel:enabled:TrustAnchorDetail' :: TrustAnchorDetail -> Maybe Bool
$sel:createdAt:TrustAnchorDetail' :: TrustAnchorDetail -> 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 Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Source
source
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
trustAnchorArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
trustAnchorId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ISO8601
updatedAt

instance Prelude.NFData TrustAnchorDetail where
  rnf :: TrustAnchorDetail -> ()
rnf TrustAnchorDetail' {Maybe Bool
Maybe Text
Maybe ISO8601
Maybe Source
updatedAt :: Maybe ISO8601
trustAnchorId :: Maybe Text
trustAnchorArn :: Maybe Text
source :: Maybe Source
name :: Maybe Text
enabled :: Maybe Bool
createdAt :: Maybe ISO8601
$sel:updatedAt:TrustAnchorDetail' :: TrustAnchorDetail -> Maybe ISO8601
$sel:trustAnchorId:TrustAnchorDetail' :: TrustAnchorDetail -> Maybe Text
$sel:trustAnchorArn:TrustAnchorDetail' :: TrustAnchorDetail -> Maybe Text
$sel:source:TrustAnchorDetail' :: TrustAnchorDetail -> Maybe Source
$sel:name:TrustAnchorDetail' :: TrustAnchorDetail -> Maybe Text
$sel:enabled:TrustAnchorDetail' :: TrustAnchorDetail -> Maybe Bool
$sel:createdAt:TrustAnchorDetail' :: TrustAnchorDetail -> 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 Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Source
source
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
trustAnchorArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
trustAnchorId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ISO8601
updatedAt