{-# 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.LakeFormation.Types.ResourceInfo
-- 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.LakeFormation.Types.ResourceInfo where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | A structure containing information about an AWS Lake Formation resource.
--
-- /See:/ 'newResourceInfo' smart constructor.
data ResourceInfo = ResourceInfo'
  { -- | The Amazon Resource Name (ARN) of the resource.
    ResourceInfo -> Maybe Text
resourceArn :: Prelude.Maybe Prelude.Text,
    -- | The date and time the resource was last modified.
    ResourceInfo -> Maybe POSIX
lastModified :: Prelude.Maybe Core.POSIX,
    -- | The IAM role that registered a resource.
    ResourceInfo -> Maybe Text
roleArn :: Prelude.Maybe Prelude.Text
  }
  deriving (ResourceInfo -> ResourceInfo -> Bool
(ResourceInfo -> ResourceInfo -> Bool)
-> (ResourceInfo -> ResourceInfo -> Bool) -> Eq ResourceInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ResourceInfo -> ResourceInfo -> Bool
$c/= :: ResourceInfo -> ResourceInfo -> Bool
== :: ResourceInfo -> ResourceInfo -> Bool
$c== :: ResourceInfo -> ResourceInfo -> Bool
Prelude.Eq, ReadPrec [ResourceInfo]
ReadPrec ResourceInfo
Int -> ReadS ResourceInfo
ReadS [ResourceInfo]
(Int -> ReadS ResourceInfo)
-> ReadS [ResourceInfo]
-> ReadPrec ResourceInfo
-> ReadPrec [ResourceInfo]
-> Read ResourceInfo
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ResourceInfo]
$creadListPrec :: ReadPrec [ResourceInfo]
readPrec :: ReadPrec ResourceInfo
$creadPrec :: ReadPrec ResourceInfo
readList :: ReadS [ResourceInfo]
$creadList :: ReadS [ResourceInfo]
readsPrec :: Int -> ReadS ResourceInfo
$creadsPrec :: Int -> ReadS ResourceInfo
Prelude.Read, Int -> ResourceInfo -> ShowS
[ResourceInfo] -> ShowS
ResourceInfo -> String
(Int -> ResourceInfo -> ShowS)
-> (ResourceInfo -> String)
-> ([ResourceInfo] -> ShowS)
-> Show ResourceInfo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ResourceInfo] -> ShowS
$cshowList :: [ResourceInfo] -> ShowS
show :: ResourceInfo -> String
$cshow :: ResourceInfo -> String
showsPrec :: Int -> ResourceInfo -> ShowS
$cshowsPrec :: Int -> ResourceInfo -> ShowS
Prelude.Show, (forall x. ResourceInfo -> Rep ResourceInfo x)
-> (forall x. Rep ResourceInfo x -> ResourceInfo)
-> Generic ResourceInfo
forall x. Rep ResourceInfo x -> ResourceInfo
forall x. ResourceInfo -> Rep ResourceInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ResourceInfo x -> ResourceInfo
$cfrom :: forall x. ResourceInfo -> Rep ResourceInfo x
Prelude.Generic)

-- |
-- Create a value of 'ResourceInfo' 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:
--
-- 'resourceArn', 'resourceInfo_resourceArn' - The Amazon Resource Name (ARN) of the resource.
--
-- 'lastModified', 'resourceInfo_lastModified' - The date and time the resource was last modified.
--
-- 'roleArn', 'resourceInfo_roleArn' - The IAM role that registered a resource.
newResourceInfo ::
  ResourceInfo
newResourceInfo :: ResourceInfo
newResourceInfo =
  ResourceInfo' :: Maybe Text -> Maybe POSIX -> Maybe Text -> ResourceInfo
ResourceInfo'
    { $sel:resourceArn:ResourceInfo' :: Maybe Text
resourceArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:lastModified:ResourceInfo' :: Maybe POSIX
lastModified = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:roleArn:ResourceInfo' :: Maybe Text
roleArn = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon Resource Name (ARN) of the resource.
resourceInfo_resourceArn :: Lens.Lens' ResourceInfo (Prelude.Maybe Prelude.Text)
resourceInfo_resourceArn :: (Maybe Text -> f (Maybe Text)) -> ResourceInfo -> f ResourceInfo
resourceInfo_resourceArn = (ResourceInfo -> Maybe Text)
-> (ResourceInfo -> Maybe Text -> ResourceInfo)
-> Lens ResourceInfo ResourceInfo (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResourceInfo' {Maybe Text
resourceArn :: Maybe Text
$sel:resourceArn:ResourceInfo' :: ResourceInfo -> Maybe Text
resourceArn} -> Maybe Text
resourceArn) (\s :: ResourceInfo
s@ResourceInfo' {} Maybe Text
a -> ResourceInfo
s {$sel:resourceArn:ResourceInfo' :: Maybe Text
resourceArn = Maybe Text
a} :: ResourceInfo)

-- | The date and time the resource was last modified.
resourceInfo_lastModified :: Lens.Lens' ResourceInfo (Prelude.Maybe Prelude.UTCTime)
resourceInfo_lastModified :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ResourceInfo -> f ResourceInfo
resourceInfo_lastModified = (ResourceInfo -> Maybe POSIX)
-> (ResourceInfo -> Maybe POSIX -> ResourceInfo)
-> Lens ResourceInfo ResourceInfo (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResourceInfo' {Maybe POSIX
lastModified :: Maybe POSIX
$sel:lastModified:ResourceInfo' :: ResourceInfo -> Maybe POSIX
lastModified} -> Maybe POSIX
lastModified) (\s :: ResourceInfo
s@ResourceInfo' {} Maybe POSIX
a -> ResourceInfo
s {$sel:lastModified:ResourceInfo' :: Maybe POSIX
lastModified = Maybe POSIX
a} :: ResourceInfo) ((Maybe POSIX -> f (Maybe POSIX))
 -> ResourceInfo -> f ResourceInfo)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ResourceInfo
-> f ResourceInfo
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 IAM role that registered a resource.
resourceInfo_roleArn :: Lens.Lens' ResourceInfo (Prelude.Maybe Prelude.Text)
resourceInfo_roleArn :: (Maybe Text -> f (Maybe Text)) -> ResourceInfo -> f ResourceInfo
resourceInfo_roleArn = (ResourceInfo -> Maybe Text)
-> (ResourceInfo -> Maybe Text -> ResourceInfo)
-> Lens ResourceInfo ResourceInfo (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResourceInfo' {Maybe Text
roleArn :: Maybe Text
$sel:roleArn:ResourceInfo' :: ResourceInfo -> Maybe Text
roleArn} -> Maybe Text
roleArn) (\s :: ResourceInfo
s@ResourceInfo' {} Maybe Text
a -> ResourceInfo
s {$sel:roleArn:ResourceInfo' :: Maybe Text
roleArn = Maybe Text
a} :: ResourceInfo)

instance Core.FromJSON ResourceInfo where
  parseJSON :: Value -> Parser ResourceInfo
parseJSON =
    String
-> (Object -> Parser ResourceInfo) -> Value -> Parser ResourceInfo
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ResourceInfo"
      ( \Object
x ->
          Maybe Text -> Maybe POSIX -> Maybe Text -> ResourceInfo
ResourceInfo'
            (Maybe Text -> Maybe POSIX -> Maybe Text -> ResourceInfo)
-> Parser (Maybe Text)
-> Parser (Maybe POSIX -> Maybe Text -> ResourceInfo)
forall (f :: * -> *) a b. Functor 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
"ResourceArn")
            Parser (Maybe POSIX -> Maybe Text -> ResourceInfo)
-> Parser (Maybe POSIX) -> Parser (Maybe Text -> ResourceInfo)
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
"LastModified")
            Parser (Maybe Text -> ResourceInfo)
-> Parser (Maybe Text) -> Parser ResourceInfo
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")
      )

instance Prelude.Hashable ResourceInfo

instance Prelude.NFData ResourceInfo