{-# 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.InstanceProperty
-- 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.InstanceProperty 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 key-value pair you set that identifies a property of the
-- authenticating instance.
--
-- /See:/ 'newInstanceProperty' smart constructor.
data InstanceProperty = InstanceProperty'
  { -- | Indicates whether the
    -- <https://docs.aws.amazon.com/rolesanywhere/latest/APIReference/API_CreateSession.html CreateSession>
    -- operation was successful.
    InstanceProperty -> Maybe Bool
failed :: Prelude.Maybe Prelude.Bool,
    -- | A list of instanceProperty objects.
    InstanceProperty -> Maybe (HashMap Text Text)
properties :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | 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.
    InstanceProperty -> Maybe ISO8601
seenAt :: Prelude.Maybe Data.ISO8601
  }
  deriving (InstanceProperty -> InstanceProperty -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InstanceProperty -> InstanceProperty -> Bool
$c/= :: InstanceProperty -> InstanceProperty -> Bool
== :: InstanceProperty -> InstanceProperty -> Bool
$c== :: InstanceProperty -> InstanceProperty -> Bool
Prelude.Eq, ReadPrec [InstanceProperty]
ReadPrec InstanceProperty
Int -> ReadS InstanceProperty
ReadS [InstanceProperty]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InstanceProperty]
$creadListPrec :: ReadPrec [InstanceProperty]
readPrec :: ReadPrec InstanceProperty
$creadPrec :: ReadPrec InstanceProperty
readList :: ReadS [InstanceProperty]
$creadList :: ReadS [InstanceProperty]
readsPrec :: Int -> ReadS InstanceProperty
$creadsPrec :: Int -> ReadS InstanceProperty
Prelude.Read, Int -> InstanceProperty -> ShowS
[InstanceProperty] -> ShowS
InstanceProperty -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InstanceProperty] -> ShowS
$cshowList :: [InstanceProperty] -> ShowS
show :: InstanceProperty -> String
$cshow :: InstanceProperty -> String
showsPrec :: Int -> InstanceProperty -> ShowS
$cshowsPrec :: Int -> InstanceProperty -> ShowS
Prelude.Show, forall x. Rep InstanceProperty x -> InstanceProperty
forall x. InstanceProperty -> Rep InstanceProperty x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep InstanceProperty x -> InstanceProperty
$cfrom :: forall x. InstanceProperty -> Rep InstanceProperty x
Prelude.Generic)

-- |
-- Create a value of 'InstanceProperty' 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:
--
-- 'failed', 'instanceProperty_failed' - Indicates whether the
-- <https://docs.aws.amazon.com/rolesanywhere/latest/APIReference/API_CreateSession.html CreateSession>
-- operation was successful.
--
-- 'properties', 'instanceProperty_properties' - A list of instanceProperty objects.
--
-- 'seenAt', 'instanceProperty_seenAt' - 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.
newInstanceProperty ::
  InstanceProperty
newInstanceProperty :: InstanceProperty
newInstanceProperty =
  InstanceProperty'
    { $sel:failed:InstanceProperty' :: Maybe Bool
failed = forall a. Maybe a
Prelude.Nothing,
      $sel:properties:InstanceProperty' :: Maybe (HashMap Text Text)
properties = forall a. Maybe a
Prelude.Nothing,
      $sel:seenAt:InstanceProperty' :: Maybe ISO8601
seenAt = forall a. Maybe a
Prelude.Nothing
    }

-- | Indicates whether the
-- <https://docs.aws.amazon.com/rolesanywhere/latest/APIReference/API_CreateSession.html CreateSession>
-- operation was successful.
instanceProperty_failed :: Lens.Lens' InstanceProperty (Prelude.Maybe Prelude.Bool)
instanceProperty_failed :: Lens' InstanceProperty (Maybe Bool)
instanceProperty_failed = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceProperty' {Maybe Bool
failed :: Maybe Bool
$sel:failed:InstanceProperty' :: InstanceProperty -> Maybe Bool
failed} -> Maybe Bool
failed) (\s :: InstanceProperty
s@InstanceProperty' {} Maybe Bool
a -> InstanceProperty
s {$sel:failed:InstanceProperty' :: Maybe Bool
failed = Maybe Bool
a} :: InstanceProperty)

-- | A list of instanceProperty objects.
instanceProperty_properties :: Lens.Lens' InstanceProperty (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
instanceProperty_properties :: Lens' InstanceProperty (Maybe (HashMap Text Text))
instanceProperty_properties = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceProperty' {Maybe (HashMap Text Text)
properties :: Maybe (HashMap Text Text)
$sel:properties:InstanceProperty' :: InstanceProperty -> Maybe (HashMap Text Text)
properties} -> Maybe (HashMap Text Text)
properties) (\s :: InstanceProperty
s@InstanceProperty' {} Maybe (HashMap Text Text)
a -> InstanceProperty
s {$sel:properties:InstanceProperty' :: Maybe (HashMap Text Text)
properties = Maybe (HashMap Text Text)
a} :: InstanceProperty) 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 s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | 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.
instanceProperty_seenAt :: Lens.Lens' InstanceProperty (Prelude.Maybe Prelude.UTCTime)
instanceProperty_seenAt :: Lens' InstanceProperty (Maybe UTCTime)
instanceProperty_seenAt = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceProperty' {Maybe ISO8601
seenAt :: Maybe ISO8601
$sel:seenAt:InstanceProperty' :: InstanceProperty -> Maybe ISO8601
seenAt} -> Maybe ISO8601
seenAt) (\s :: InstanceProperty
s@InstanceProperty' {} Maybe ISO8601
a -> InstanceProperty
s {$sel:seenAt:InstanceProperty' :: Maybe ISO8601
seenAt = Maybe ISO8601
a} :: InstanceProperty) 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 InstanceProperty where
  parseJSON :: Value -> Parser InstanceProperty
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"InstanceProperty"
      ( \Object
x ->
          Maybe Bool
-> Maybe (HashMap Text Text) -> Maybe ISO8601 -> InstanceProperty
InstanceProperty'
            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
"failed")
            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
"properties" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            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
"seenAt")
      )

instance Prelude.Hashable InstanceProperty where
  hashWithSalt :: Int -> InstanceProperty -> Int
hashWithSalt Int
_salt InstanceProperty' {Maybe Bool
Maybe (HashMap Text Text)
Maybe ISO8601
seenAt :: Maybe ISO8601
properties :: Maybe (HashMap Text Text)
failed :: Maybe Bool
$sel:seenAt:InstanceProperty' :: InstanceProperty -> Maybe ISO8601
$sel:properties:InstanceProperty' :: InstanceProperty -> Maybe (HashMap Text Text)
$sel:failed:InstanceProperty' :: InstanceProperty -> Maybe Bool
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
failed
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
properties
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ISO8601
seenAt

instance Prelude.NFData InstanceProperty where
  rnf :: InstanceProperty -> ()
rnf InstanceProperty' {Maybe Bool
Maybe (HashMap Text Text)
Maybe ISO8601
seenAt :: Maybe ISO8601
properties :: Maybe (HashMap Text Text)
failed :: Maybe Bool
$sel:seenAt:InstanceProperty' :: InstanceProperty -> Maybe ISO8601
$sel:properties:InstanceProperty' :: InstanceProperty -> Maybe (HashMap Text Text)
$sel:failed:InstanceProperty' :: InstanceProperty -> Maybe Bool
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
failed
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
properties
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ISO8601
seenAt