{-# 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-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.ResourceGroups.Types.PendingResource where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(PendingResource -> PendingResource -> Bool)
-> (PendingResource -> PendingResource -> Bool)
-> Eq PendingResource
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]
(Int -> ReadS PendingResource)
-> ReadS [PendingResource]
-> ReadPrec PendingResource
-> ReadPrec [PendingResource]
-> Read 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
(Int -> PendingResource -> ShowS)
-> (PendingResource -> String)
-> ([PendingResource] -> ShowS)
-> Show PendingResource
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. PendingResource -> Rep PendingResource x)
-> (forall x. Rep PendingResource x -> PendingResource)
-> Generic PendingResource
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' :: Maybe Text -> PendingResource
PendingResource' {$sel:resourceArn:PendingResource' :: Maybe Text
resourceArn = Maybe Text
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 :: (Maybe Text -> f (Maybe Text))
-> PendingResource -> f PendingResource
pendingResource_resourceArn = (PendingResource -> Maybe Text)
-> (PendingResource -> Maybe Text -> PendingResource)
-> Lens PendingResource PendingResource (Maybe Text) (Maybe Text)
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 Core.FromJSON PendingResource where
  parseJSON :: Value -> Parser PendingResource
parseJSON =
    String
-> (Object -> Parser PendingResource)
-> Value
-> Parser PendingResource
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"PendingResource"
      ( \Object
x ->
          Maybe Text -> PendingResource
PendingResource'
            (Maybe Text -> PendingResource)
-> Parser (Maybe Text) -> Parser PendingResource
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")
      )

instance Prelude.Hashable PendingResource

instance Prelude.NFData PendingResource