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

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

-- | The information about the resource.
--
-- /See:/ 'newResourceInfo' smart constructor.
data ResourceInfo = ResourceInfo'
  { -- | The Amazon resource name (ARN) that specifies the resource across
    -- services.
    ResourceInfo -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The name of the resource.
    ResourceInfo -> Maybe Text
name :: 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:
--
-- 'arn', 'resourceInfo_arn' - The Amazon resource name (ARN) that specifies the resource across
-- services.
--
-- 'name', 'resourceInfo_name' - The name of the resource.
newResourceInfo ::
  ResourceInfo
newResourceInfo :: ResourceInfo
newResourceInfo =
  ResourceInfo' :: Maybe Text -> Maybe Text -> ResourceInfo
ResourceInfo'
    { $sel:arn:ResourceInfo' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:ResourceInfo' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon resource name (ARN) that specifies the resource across
-- services.
resourceInfo_arn :: Lens.Lens' ResourceInfo (Prelude.Maybe Prelude.Text)
resourceInfo_arn :: (Maybe Text -> f (Maybe Text)) -> ResourceInfo -> f ResourceInfo
resourceInfo_arn = (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
arn :: Maybe Text
$sel:arn:ResourceInfo' :: ResourceInfo -> Maybe Text
arn} -> Maybe Text
arn) (\s :: ResourceInfo
s@ResourceInfo' {} Maybe Text
a -> ResourceInfo
s {$sel:arn:ResourceInfo' :: Maybe Text
arn = Maybe Text
a} :: ResourceInfo)

-- | The name of the resource.
resourceInfo_name :: Lens.Lens' ResourceInfo (Prelude.Maybe Prelude.Text)
resourceInfo_name :: (Maybe Text -> f (Maybe Text)) -> ResourceInfo -> f ResourceInfo
resourceInfo_name = (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
name :: Maybe Text
$sel:name:ResourceInfo' :: ResourceInfo -> Maybe Text
name} -> Maybe Text
name) (\s :: ResourceInfo
s@ResourceInfo' {} Maybe Text
a -> ResourceInfo
s {$sel:name:ResourceInfo' :: Maybe Text
name = 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 Text -> ResourceInfo
ResourceInfo'
            (Maybe Text -> Maybe Text -> ResourceInfo)
-> Parser (Maybe Text) -> Parser (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
"arn") 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
"name")
      )

instance Prelude.Hashable ResourceInfo

instance Prelude.NFData ResourceInfo