{-# 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.CloudControl.Types.ResourceDescription
-- 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.CloudControl.Types.ResourceDescription 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

-- | Represents information about a provisioned resource.
--
-- /See:/ 'newResourceDescription' smart constructor.
data ResourceDescription = ResourceDescription'
  { -- | The primary identifier for the resource.
    --
    -- For more information, see
    -- <https://docs.aws.amazon.com/cloudcontrolapi/latest/userguide/resource-identifier.html Identifying resources>
    -- in the /Amazon Web Services Cloud Control API User Guide/.
    ResourceDescription -> Maybe Text
identifier :: Prelude.Maybe Prelude.Text,
    -- | A list of the resource properties and their current values.
    ResourceDescription -> Maybe (Sensitive Text)
properties :: Prelude.Maybe (Data.Sensitive Prelude.Text)
  }
  deriving (ResourceDescription -> ResourceDescription -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ResourceDescription -> ResourceDescription -> Bool
$c/= :: ResourceDescription -> ResourceDescription -> Bool
== :: ResourceDescription -> ResourceDescription -> Bool
$c== :: ResourceDescription -> ResourceDescription -> Bool
Prelude.Eq, Int -> ResourceDescription -> ShowS
[ResourceDescription] -> ShowS
ResourceDescription -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ResourceDescription] -> ShowS
$cshowList :: [ResourceDescription] -> ShowS
show :: ResourceDescription -> String
$cshow :: ResourceDescription -> String
showsPrec :: Int -> ResourceDescription -> ShowS
$cshowsPrec :: Int -> ResourceDescription -> ShowS
Prelude.Show, forall x. Rep ResourceDescription x -> ResourceDescription
forall x. ResourceDescription -> Rep ResourceDescription x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ResourceDescription x -> ResourceDescription
$cfrom :: forall x. ResourceDescription -> Rep ResourceDescription x
Prelude.Generic)

-- |
-- Create a value of 'ResourceDescription' 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:
--
-- 'identifier', 'resourceDescription_identifier' - The primary identifier for the resource.
--
-- For more information, see
-- <https://docs.aws.amazon.com/cloudcontrolapi/latest/userguide/resource-identifier.html Identifying resources>
-- in the /Amazon Web Services Cloud Control API User Guide/.
--
-- 'properties', 'resourceDescription_properties' - A list of the resource properties and their current values.
newResourceDescription ::
  ResourceDescription
newResourceDescription :: ResourceDescription
newResourceDescription =
  ResourceDescription'
    { $sel:identifier:ResourceDescription' :: Maybe Text
identifier = forall a. Maybe a
Prelude.Nothing,
      $sel:properties:ResourceDescription' :: Maybe (Sensitive Text)
properties = forall a. Maybe a
Prelude.Nothing
    }

-- | The primary identifier for the resource.
--
-- For more information, see
-- <https://docs.aws.amazon.com/cloudcontrolapi/latest/userguide/resource-identifier.html Identifying resources>
-- in the /Amazon Web Services Cloud Control API User Guide/.
resourceDescription_identifier :: Lens.Lens' ResourceDescription (Prelude.Maybe Prelude.Text)
resourceDescription_identifier :: Lens' ResourceDescription (Maybe Text)
resourceDescription_identifier = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResourceDescription' {Maybe Text
identifier :: Maybe Text
$sel:identifier:ResourceDescription' :: ResourceDescription -> Maybe Text
identifier} -> Maybe Text
identifier) (\s :: ResourceDescription
s@ResourceDescription' {} Maybe Text
a -> ResourceDescription
s {$sel:identifier:ResourceDescription' :: Maybe Text
identifier = Maybe Text
a} :: ResourceDescription)

-- | A list of the resource properties and their current values.
resourceDescription_properties :: Lens.Lens' ResourceDescription (Prelude.Maybe Prelude.Text)
resourceDescription_properties :: Lens' ResourceDescription (Maybe Text)
resourceDescription_properties = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResourceDescription' {Maybe (Sensitive Text)
properties :: Maybe (Sensitive Text)
$sel:properties:ResourceDescription' :: ResourceDescription -> Maybe (Sensitive Text)
properties} -> Maybe (Sensitive Text)
properties) (\s :: ResourceDescription
s@ResourceDescription' {} Maybe (Sensitive Text)
a -> ResourceDescription
s {$sel:properties:ResourceDescription' :: Maybe (Sensitive Text)
properties = Maybe (Sensitive Text)
a} :: ResourceDescription) 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. Iso' (Sensitive a) a
Data._Sensitive

instance Data.FromJSON ResourceDescription where
  parseJSON :: Value -> Parser ResourceDescription
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ResourceDescription"
      ( \Object
x ->
          Maybe Text -> Maybe (Sensitive Text) -> ResourceDescription
ResourceDescription'
            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
"Identifier")
            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")
      )

instance Prelude.Hashable ResourceDescription where
  hashWithSalt :: Int -> ResourceDescription -> Int
hashWithSalt Int
_salt ResourceDescription' {Maybe Text
Maybe (Sensitive Text)
properties :: Maybe (Sensitive Text)
identifier :: Maybe Text
$sel:properties:ResourceDescription' :: ResourceDescription -> Maybe (Sensitive Text)
$sel:identifier:ResourceDescription' :: ResourceDescription -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
identifier
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (Sensitive Text)
properties

instance Prelude.NFData ResourceDescription where
  rnf :: ResourceDescription -> ()
rnf ResourceDescription' {Maybe Text
Maybe (Sensitive Text)
properties :: Maybe (Sensitive Text)
identifier :: Maybe Text
$sel:properties:ResourceDescription' :: ResourceDescription -> Maybe (Sensitive Text)
$sel:identifier:ResourceDescription' :: ResourceDescription -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
identifier
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (Sensitive Text)
properties