{-# 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.ListGroupResourcesItem
-- 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.ListGroupResourcesItem 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
import Amazonka.ResourceGroups.Types.ResourceIdentifier
import Amazonka.ResourceGroups.Types.ResourceStatus

-- | A structure returned by the ListGroupResources operation that contains
-- identity and group membership status information for one of the
-- resources in the group.
--
-- /See:/ 'newListGroupResourcesItem' smart constructor.
data ListGroupResourcesItem = ListGroupResourcesItem'
  { ListGroupResourcesItem -> Maybe ResourceIdentifier
identifier :: Prelude.Maybe ResourceIdentifier,
    -- | A structure that contains the status of this resource\'s membership in
    -- the group.
    --
    -- This field is present in the response only if the group is of type
    -- @AWS::EC2::HostManagement@.
    ListGroupResourcesItem -> Maybe ResourceStatus
status :: Prelude.Maybe ResourceStatus
  }
  deriving (ListGroupResourcesItem -> ListGroupResourcesItem -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListGroupResourcesItem -> ListGroupResourcesItem -> Bool
$c/= :: ListGroupResourcesItem -> ListGroupResourcesItem -> Bool
== :: ListGroupResourcesItem -> ListGroupResourcesItem -> Bool
$c== :: ListGroupResourcesItem -> ListGroupResourcesItem -> Bool
Prelude.Eq, ReadPrec [ListGroupResourcesItem]
ReadPrec ListGroupResourcesItem
Int -> ReadS ListGroupResourcesItem
ReadS [ListGroupResourcesItem]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListGroupResourcesItem]
$creadListPrec :: ReadPrec [ListGroupResourcesItem]
readPrec :: ReadPrec ListGroupResourcesItem
$creadPrec :: ReadPrec ListGroupResourcesItem
readList :: ReadS [ListGroupResourcesItem]
$creadList :: ReadS [ListGroupResourcesItem]
readsPrec :: Int -> ReadS ListGroupResourcesItem
$creadsPrec :: Int -> ReadS ListGroupResourcesItem
Prelude.Read, Int -> ListGroupResourcesItem -> ShowS
[ListGroupResourcesItem] -> ShowS
ListGroupResourcesItem -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListGroupResourcesItem] -> ShowS
$cshowList :: [ListGroupResourcesItem] -> ShowS
show :: ListGroupResourcesItem -> String
$cshow :: ListGroupResourcesItem -> String
showsPrec :: Int -> ListGroupResourcesItem -> ShowS
$cshowsPrec :: Int -> ListGroupResourcesItem -> ShowS
Prelude.Show, forall x. Rep ListGroupResourcesItem x -> ListGroupResourcesItem
forall x. ListGroupResourcesItem -> Rep ListGroupResourcesItem x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListGroupResourcesItem x -> ListGroupResourcesItem
$cfrom :: forall x. ListGroupResourcesItem -> Rep ListGroupResourcesItem x
Prelude.Generic)

-- |
-- Create a value of 'ListGroupResourcesItem' 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', 'listGroupResourcesItem_identifier' - Undocumented member.
--
-- 'status', 'listGroupResourcesItem_status' - A structure that contains the status of this resource\'s membership in
-- the group.
--
-- This field is present in the response only if the group is of type
-- @AWS::EC2::HostManagement@.
newListGroupResourcesItem ::
  ListGroupResourcesItem
newListGroupResourcesItem :: ListGroupResourcesItem
newListGroupResourcesItem =
  ListGroupResourcesItem'
    { $sel:identifier:ListGroupResourcesItem' :: Maybe ResourceIdentifier
identifier =
        forall a. Maybe a
Prelude.Nothing,
      $sel:status:ListGroupResourcesItem' :: Maybe ResourceStatus
status = forall a. Maybe a
Prelude.Nothing
    }

-- | Undocumented member.
listGroupResourcesItem_identifier :: Lens.Lens' ListGroupResourcesItem (Prelude.Maybe ResourceIdentifier)
listGroupResourcesItem_identifier :: Lens' ListGroupResourcesItem (Maybe ResourceIdentifier)
listGroupResourcesItem_identifier = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListGroupResourcesItem' {Maybe ResourceIdentifier
identifier :: Maybe ResourceIdentifier
$sel:identifier:ListGroupResourcesItem' :: ListGroupResourcesItem -> Maybe ResourceIdentifier
identifier} -> Maybe ResourceIdentifier
identifier) (\s :: ListGroupResourcesItem
s@ListGroupResourcesItem' {} Maybe ResourceIdentifier
a -> ListGroupResourcesItem
s {$sel:identifier:ListGroupResourcesItem' :: Maybe ResourceIdentifier
identifier = Maybe ResourceIdentifier
a} :: ListGroupResourcesItem)

-- | A structure that contains the status of this resource\'s membership in
-- the group.
--
-- This field is present in the response only if the group is of type
-- @AWS::EC2::HostManagement@.
listGroupResourcesItem_status :: Lens.Lens' ListGroupResourcesItem (Prelude.Maybe ResourceStatus)
listGroupResourcesItem_status :: Lens' ListGroupResourcesItem (Maybe ResourceStatus)
listGroupResourcesItem_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListGroupResourcesItem' {Maybe ResourceStatus
status :: Maybe ResourceStatus
$sel:status:ListGroupResourcesItem' :: ListGroupResourcesItem -> Maybe ResourceStatus
status} -> Maybe ResourceStatus
status) (\s :: ListGroupResourcesItem
s@ListGroupResourcesItem' {} Maybe ResourceStatus
a -> ListGroupResourcesItem
s {$sel:status:ListGroupResourcesItem' :: Maybe ResourceStatus
status = Maybe ResourceStatus
a} :: ListGroupResourcesItem)

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

instance Prelude.Hashable ListGroupResourcesItem where
  hashWithSalt :: Int -> ListGroupResourcesItem -> Int
hashWithSalt Int
_salt ListGroupResourcesItem' {Maybe ResourceIdentifier
Maybe ResourceStatus
status :: Maybe ResourceStatus
identifier :: Maybe ResourceIdentifier
$sel:status:ListGroupResourcesItem' :: ListGroupResourcesItem -> Maybe ResourceStatus
$sel:identifier:ListGroupResourcesItem' :: ListGroupResourcesItem -> Maybe ResourceIdentifier
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ResourceIdentifier
identifier
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ResourceStatus
status

instance Prelude.NFData ListGroupResourcesItem where
  rnf :: ListGroupResourcesItem -> ()
rnf ListGroupResourcesItem' {Maybe ResourceIdentifier
Maybe ResourceStatus
status :: Maybe ResourceStatus
identifier :: Maybe ResourceIdentifier
$sel:status:ListGroupResourcesItem' :: ListGroupResourcesItem -> Maybe ResourceStatus
$sel:identifier:ListGroupResourcesItem' :: ListGroupResourcesItem -> Maybe ResourceIdentifier
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe ResourceIdentifier
identifier
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ResourceStatus
status