{-# 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.ServiceCatalog.Types.ResourceDetail
-- 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.ServiceCatalog.Types.ResourceDetail where

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

-- | Information about a resource.
--
-- /See:/ 'newResourceDetail' smart constructor.
data ResourceDetail = ResourceDetail'
  { -- | The ARN of the resource.
    ResourceDetail -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The creation time of the resource.
    ResourceDetail -> Maybe POSIX
createdTime :: Prelude.Maybe Core.POSIX,
    -- | The name of the resource.
    ResourceDetail -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The identifier of the resource.
    ResourceDetail -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
    -- | The description of the resource.
    ResourceDetail -> Maybe Text
description :: Prelude.Maybe Prelude.Text
  }
  deriving (ResourceDetail -> ResourceDetail -> Bool
(ResourceDetail -> ResourceDetail -> Bool)
-> (ResourceDetail -> ResourceDetail -> Bool) -> Eq ResourceDetail
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ResourceDetail -> ResourceDetail -> Bool
$c/= :: ResourceDetail -> ResourceDetail -> Bool
== :: ResourceDetail -> ResourceDetail -> Bool
$c== :: ResourceDetail -> ResourceDetail -> Bool
Prelude.Eq, ReadPrec [ResourceDetail]
ReadPrec ResourceDetail
Int -> ReadS ResourceDetail
ReadS [ResourceDetail]
(Int -> ReadS ResourceDetail)
-> ReadS [ResourceDetail]
-> ReadPrec ResourceDetail
-> ReadPrec [ResourceDetail]
-> Read ResourceDetail
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ResourceDetail]
$creadListPrec :: ReadPrec [ResourceDetail]
readPrec :: ReadPrec ResourceDetail
$creadPrec :: ReadPrec ResourceDetail
readList :: ReadS [ResourceDetail]
$creadList :: ReadS [ResourceDetail]
readsPrec :: Int -> ReadS ResourceDetail
$creadsPrec :: Int -> ReadS ResourceDetail
Prelude.Read, Int -> ResourceDetail -> ShowS
[ResourceDetail] -> ShowS
ResourceDetail -> String
(Int -> ResourceDetail -> ShowS)
-> (ResourceDetail -> String)
-> ([ResourceDetail] -> ShowS)
-> Show ResourceDetail
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ResourceDetail] -> ShowS
$cshowList :: [ResourceDetail] -> ShowS
show :: ResourceDetail -> String
$cshow :: ResourceDetail -> String
showsPrec :: Int -> ResourceDetail -> ShowS
$cshowsPrec :: Int -> ResourceDetail -> ShowS
Prelude.Show, (forall x. ResourceDetail -> Rep ResourceDetail x)
-> (forall x. Rep ResourceDetail x -> ResourceDetail)
-> Generic ResourceDetail
forall x. Rep ResourceDetail x -> ResourceDetail
forall x. ResourceDetail -> Rep ResourceDetail x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ResourceDetail x -> ResourceDetail
$cfrom :: forall x. ResourceDetail -> Rep ResourceDetail x
Prelude.Generic)

-- |
-- Create a value of 'ResourceDetail' 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:
--
-- 'arn', 'resourceDetail_arn' - The ARN of the resource.
--
-- 'createdTime', 'resourceDetail_createdTime' - The creation time of the resource.
--
-- 'name', 'resourceDetail_name' - The name of the resource.
--
-- 'id', 'resourceDetail_id' - The identifier of the resource.
--
-- 'description', 'resourceDetail_description' - The description of the resource.
newResourceDetail ::
  ResourceDetail
newResourceDetail :: ResourceDetail
newResourceDetail =
  ResourceDetail' :: Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> ResourceDetail
ResourceDetail'
    { $sel:arn:ResourceDetail' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:createdTime:ResourceDetail' :: Maybe POSIX
createdTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:name:ResourceDetail' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:id:ResourceDetail' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:description:ResourceDetail' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The ARN of the resource.
resourceDetail_arn :: Lens.Lens' ResourceDetail (Prelude.Maybe Prelude.Text)
resourceDetail_arn :: (Maybe Text -> f (Maybe Text))
-> ResourceDetail -> f ResourceDetail
resourceDetail_arn = (ResourceDetail -> Maybe Text)
-> (ResourceDetail -> Maybe Text -> ResourceDetail)
-> Lens ResourceDetail ResourceDetail (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResourceDetail' {Maybe Text
arn :: Maybe Text
$sel:arn:ResourceDetail' :: ResourceDetail -> Maybe Text
arn} -> Maybe Text
arn) (\s :: ResourceDetail
s@ResourceDetail' {} Maybe Text
a -> ResourceDetail
s {$sel:arn:ResourceDetail' :: Maybe Text
arn = Maybe Text
a} :: ResourceDetail)

-- | The creation time of the resource.
resourceDetail_createdTime :: Lens.Lens' ResourceDetail (Prelude.Maybe Prelude.UTCTime)
resourceDetail_createdTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ResourceDetail -> f ResourceDetail
resourceDetail_createdTime = (ResourceDetail -> Maybe POSIX)
-> (ResourceDetail -> Maybe POSIX -> ResourceDetail)
-> Lens ResourceDetail ResourceDetail (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResourceDetail' {Maybe POSIX
createdTime :: Maybe POSIX
$sel:createdTime:ResourceDetail' :: ResourceDetail -> Maybe POSIX
createdTime} -> Maybe POSIX
createdTime) (\s :: ResourceDetail
s@ResourceDetail' {} Maybe POSIX
a -> ResourceDetail
s {$sel:createdTime:ResourceDetail' :: Maybe POSIX
createdTime = Maybe POSIX
a} :: ResourceDetail) ((Maybe POSIX -> f (Maybe POSIX))
 -> ResourceDetail -> f ResourceDetail)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ResourceDetail
-> f ResourceDetail
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 name of the resource.
resourceDetail_name :: Lens.Lens' ResourceDetail (Prelude.Maybe Prelude.Text)
resourceDetail_name :: (Maybe Text -> f (Maybe Text))
-> ResourceDetail -> f ResourceDetail
resourceDetail_name = (ResourceDetail -> Maybe Text)
-> (ResourceDetail -> Maybe Text -> ResourceDetail)
-> Lens ResourceDetail ResourceDetail (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResourceDetail' {Maybe Text
name :: Maybe Text
$sel:name:ResourceDetail' :: ResourceDetail -> Maybe Text
name} -> Maybe Text
name) (\s :: ResourceDetail
s@ResourceDetail' {} Maybe Text
a -> ResourceDetail
s {$sel:name:ResourceDetail' :: Maybe Text
name = Maybe Text
a} :: ResourceDetail)

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

-- | The description of the resource.
resourceDetail_description :: Lens.Lens' ResourceDetail (Prelude.Maybe Prelude.Text)
resourceDetail_description :: (Maybe Text -> f (Maybe Text))
-> ResourceDetail -> f ResourceDetail
resourceDetail_description = (ResourceDetail -> Maybe Text)
-> (ResourceDetail -> Maybe Text -> ResourceDetail)
-> Lens ResourceDetail ResourceDetail (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResourceDetail' {Maybe Text
description :: Maybe Text
$sel:description:ResourceDetail' :: ResourceDetail -> Maybe Text
description} -> Maybe Text
description) (\s :: ResourceDetail
s@ResourceDetail' {} Maybe Text
a -> ResourceDetail
s {$sel:description:ResourceDetail' :: Maybe Text
description = Maybe Text
a} :: ResourceDetail)

instance Core.FromJSON ResourceDetail where
  parseJSON :: Value -> Parser ResourceDetail
parseJSON =
    String
-> (Object -> Parser ResourceDetail)
-> Value
-> Parser ResourceDetail
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ResourceDetail"
      ( \Object
x ->
          Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> ResourceDetail
ResourceDetail'
            (Maybe Text
 -> Maybe POSIX
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> ResourceDetail)
-> Parser (Maybe Text)
-> Parser
     (Maybe POSIX
      -> Maybe Text -> Maybe Text -> Maybe Text -> ResourceDetail)
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
"ARN")
            Parser
  (Maybe POSIX
   -> Maybe Text -> Maybe Text -> Maybe Text -> ResourceDetail)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe Text -> Maybe Text -> Maybe Text -> ResourceDetail)
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
"CreatedTime")
            Parser (Maybe Text -> Maybe Text -> Maybe Text -> ResourceDetail)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> ResourceDetail)
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
"Name")
            Parser (Maybe Text -> Maybe Text -> ResourceDetail)
-> Parser (Maybe Text) -> Parser (Maybe Text -> ResourceDetail)
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
"Id")
            Parser (Maybe Text -> ResourceDetail)
-> Parser (Maybe Text) -> Parser ResourceDetail
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
"Description")
      )

instance Prelude.Hashable ResourceDetail

instance Prelude.NFData ResourceDetail