{-# 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-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.ListGroupResourcesItem where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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'
  { -- | 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,
    ListGroupResourcesItem -> Maybe ResourceIdentifier
identifier :: Prelude.Maybe ResourceIdentifier
  }
  deriving (ListGroupResourcesItem -> ListGroupResourcesItem -> Bool
(ListGroupResourcesItem -> ListGroupResourcesItem -> Bool)
-> (ListGroupResourcesItem -> ListGroupResourcesItem -> Bool)
-> Eq ListGroupResourcesItem
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]
(Int -> ReadS ListGroupResourcesItem)
-> ReadS [ListGroupResourcesItem]
-> ReadPrec ListGroupResourcesItem
-> ReadPrec [ListGroupResourcesItem]
-> Read 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
(Int -> ListGroupResourcesItem -> ShowS)
-> (ListGroupResourcesItem -> String)
-> ([ListGroupResourcesItem] -> ShowS)
-> Show ListGroupResourcesItem
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. ListGroupResourcesItem -> Rep ListGroupResourcesItem x)
-> (forall x.
    Rep ListGroupResourcesItem x -> ListGroupResourcesItem)
-> Generic ListGroupResourcesItem
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:
--
-- '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@.
--
-- 'identifier', 'listGroupResourcesItem_identifier' - Undocumented member.
newListGroupResourcesItem ::
  ListGroupResourcesItem
newListGroupResourcesItem :: ListGroupResourcesItem
newListGroupResourcesItem =
  ListGroupResourcesItem' :: Maybe ResourceStatus
-> Maybe ResourceIdentifier -> ListGroupResourcesItem
ListGroupResourcesItem'
    { $sel:status:ListGroupResourcesItem' :: Maybe ResourceStatus
status = Maybe ResourceStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:identifier:ListGroupResourcesItem' :: Maybe ResourceIdentifier
identifier = Maybe ResourceIdentifier
forall a. Maybe a
Prelude.Nothing
    }

-- | 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 :: (Maybe ResourceStatus -> f (Maybe ResourceStatus))
-> ListGroupResourcesItem -> f ListGroupResourcesItem
listGroupResourcesItem_status = (ListGroupResourcesItem -> Maybe ResourceStatus)
-> (ListGroupResourcesItem
    -> Maybe ResourceStatus -> ListGroupResourcesItem)
-> Lens
     ListGroupResourcesItem
     ListGroupResourcesItem
     (Maybe ResourceStatus)
     (Maybe ResourceStatus)
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)

-- | Undocumented member.
listGroupResourcesItem_identifier :: Lens.Lens' ListGroupResourcesItem (Prelude.Maybe ResourceIdentifier)
listGroupResourcesItem_identifier :: (Maybe ResourceIdentifier -> f (Maybe ResourceIdentifier))
-> ListGroupResourcesItem -> f ListGroupResourcesItem
listGroupResourcesItem_identifier = (ListGroupResourcesItem -> Maybe ResourceIdentifier)
-> (ListGroupResourcesItem
    -> Maybe ResourceIdentifier -> ListGroupResourcesItem)
-> Lens
     ListGroupResourcesItem
     ListGroupResourcesItem
     (Maybe ResourceIdentifier)
     (Maybe ResourceIdentifier)
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)

instance Core.FromJSON ListGroupResourcesItem where
  parseJSON :: Value -> Parser ListGroupResourcesItem
parseJSON =
    String
-> (Object -> Parser ListGroupResourcesItem)
-> Value
-> Parser ListGroupResourcesItem
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ListGroupResourcesItem"
      ( \Object
x ->
          Maybe ResourceStatus
-> Maybe ResourceIdentifier -> ListGroupResourcesItem
ListGroupResourcesItem'
            (Maybe ResourceStatus
 -> Maybe ResourceIdentifier -> ListGroupResourcesItem)
-> Parser (Maybe ResourceStatus)
-> Parser (Maybe ResourceIdentifier -> ListGroupResourcesItem)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe ResourceStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Status")
            Parser (Maybe ResourceIdentifier -> ListGroupResourcesItem)
-> Parser (Maybe ResourceIdentifier)
-> Parser ListGroupResourcesItem
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ResourceIdentifier)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Identifier")
      )

instance Prelude.Hashable ListGroupResourcesItem

instance Prelude.NFData ListGroupResourcesItem