{-# 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.ResourceGroups.Types.PendingResource
-- 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.ResourceGroups.Types.PendingResource 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 structure that identifies a resource that is currently pending
-- addition to the group as a member. Adding a resource to a resource group
-- happens asynchronously as a background task and this one isn\'t
-- completed yet.
--
-- /See:/ 'newPendingResource' smart constructor.
data PendingResource = PendingResource'
  { -- | The Amazon resource name (ARN) of the resource that\'s in a pending
    -- state.
    PendingResource -> Maybe Text
resourceArn :: Prelude.Maybe Prelude.Text
  }
  deriving (PendingResource -> PendingResource -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PendingResource -> PendingResource -> Bool
$c/= :: PendingResource -> PendingResource -> Bool
== :: PendingResource -> PendingResource -> Bool
$c== :: PendingResource -> PendingResource -> Bool
Prelude.Eq, ReadPrec [PendingResource]
ReadPrec PendingResource
Int -> ReadS PendingResource
ReadS [PendingResource]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PendingResource]
$creadListPrec :: ReadPrec [PendingResource]
readPrec :: ReadPrec PendingResource
$creadPrec :: ReadPrec PendingResource
readList :: ReadS [PendingResource]
$creadList :: ReadS [PendingResource]
readsPrec :: Int -> ReadS PendingResource
$creadsPrec :: Int -> ReadS PendingResource
Prelude.Read, Int -> PendingResource -> ShowS
[PendingResource] -> ShowS
PendingResource -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PendingResource] -> ShowS
$cshowList :: [PendingResource] -> ShowS
show :: PendingResource -> String
$cshow :: PendingResource -> String
showsPrec :: Int -> PendingResource -> ShowS
$cshowsPrec :: Int -> PendingResource -> ShowS
Prelude.Show, forall x. Rep PendingResource x -> PendingResource
forall x. PendingResource -> Rep PendingResource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PendingResource x -> PendingResource
$cfrom :: forall x. PendingResource -> Rep PendingResource x
Prelude.Generic)

-- |
-- Create a value of 'PendingResource' 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', 'pendingResource_resourceArn' - The Amazon resource name (ARN) of the resource that\'s in a pending
-- state.
newPendingResource ::
  PendingResource
newPendingResource :: PendingResource
newPendingResource =
  PendingResource' {$sel:resourceArn:PendingResource' :: Maybe Text
resourceArn = forall a. Maybe a
Prelude.Nothing}

-- | The Amazon resource name (ARN) of the resource that\'s in a pending
-- state.
pendingResource_resourceArn :: Lens.Lens' PendingResource (Prelude.Maybe Prelude.Text)
pendingResource_resourceArn :: Lens' PendingResource (Maybe Text)
pendingResource_resourceArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PendingResource' {Maybe Text
resourceArn :: Maybe Text
$sel:resourceArn:PendingResource' :: PendingResource -> Maybe Text
resourceArn} -> Maybe Text
resourceArn) (\s :: PendingResource
s@PendingResource' {} Maybe Text
a -> PendingResource
s {$sel:resourceArn:PendingResource' :: Maybe Text
resourceArn = Maybe Text
a} :: PendingResource)

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

instance Prelude.Hashable PendingResource where
  hashWithSalt :: Int -> PendingResource -> Int
hashWithSalt Int
_salt PendingResource' {Maybe Text
resourceArn :: Maybe Text
$sel:resourceArn:PendingResource' :: PendingResource -> Maybe Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
resourceArn

instance Prelude.NFData PendingResource where
  rnf :: PendingResource -> ()
rnf PendingResource' {Maybe Text
resourceArn :: Maybe Text
$sel:resourceArn:PendingResource' :: PendingResource -> Maybe Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
resourceArn