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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The unique identifiers for a resource group.
--
-- /See:/ 'newGroupIdentifier' smart constructor.
data GroupIdentifier = GroupIdentifier'
  { -- | The ARN of the resource group.
    GroupIdentifier -> Maybe Text
groupArn :: Prelude.Maybe Prelude.Text,
    -- | The name of the resource group.
    GroupIdentifier -> Maybe Text
groupName :: Prelude.Maybe Prelude.Text
  }
  deriving (GroupIdentifier -> GroupIdentifier -> Bool
(GroupIdentifier -> GroupIdentifier -> Bool)
-> (GroupIdentifier -> GroupIdentifier -> Bool)
-> Eq GroupIdentifier
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GroupIdentifier -> GroupIdentifier -> Bool
$c/= :: GroupIdentifier -> GroupIdentifier -> Bool
== :: GroupIdentifier -> GroupIdentifier -> Bool
$c== :: GroupIdentifier -> GroupIdentifier -> Bool
Prelude.Eq, ReadPrec [GroupIdentifier]
ReadPrec GroupIdentifier
Int -> ReadS GroupIdentifier
ReadS [GroupIdentifier]
(Int -> ReadS GroupIdentifier)
-> ReadS [GroupIdentifier]
-> ReadPrec GroupIdentifier
-> ReadPrec [GroupIdentifier]
-> Read GroupIdentifier
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GroupIdentifier]
$creadListPrec :: ReadPrec [GroupIdentifier]
readPrec :: ReadPrec GroupIdentifier
$creadPrec :: ReadPrec GroupIdentifier
readList :: ReadS [GroupIdentifier]
$creadList :: ReadS [GroupIdentifier]
readsPrec :: Int -> ReadS GroupIdentifier
$creadsPrec :: Int -> ReadS GroupIdentifier
Prelude.Read, Int -> GroupIdentifier -> ShowS
[GroupIdentifier] -> ShowS
GroupIdentifier -> String
(Int -> GroupIdentifier -> ShowS)
-> (GroupIdentifier -> String)
-> ([GroupIdentifier] -> ShowS)
-> Show GroupIdentifier
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GroupIdentifier] -> ShowS
$cshowList :: [GroupIdentifier] -> ShowS
show :: GroupIdentifier -> String
$cshow :: GroupIdentifier -> String
showsPrec :: Int -> GroupIdentifier -> ShowS
$cshowsPrec :: Int -> GroupIdentifier -> ShowS
Prelude.Show, (forall x. GroupIdentifier -> Rep GroupIdentifier x)
-> (forall x. Rep GroupIdentifier x -> GroupIdentifier)
-> Generic GroupIdentifier
forall x. Rep GroupIdentifier x -> GroupIdentifier
forall x. GroupIdentifier -> Rep GroupIdentifier x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GroupIdentifier x -> GroupIdentifier
$cfrom :: forall x. GroupIdentifier -> Rep GroupIdentifier x
Prelude.Generic)

-- |
-- Create a value of 'GroupIdentifier' 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:
--
-- 'groupArn', 'groupIdentifier_groupArn' - The ARN of the resource group.
--
-- 'groupName', 'groupIdentifier_groupName' - The name of the resource group.
newGroupIdentifier ::
  GroupIdentifier
newGroupIdentifier :: GroupIdentifier
newGroupIdentifier =
  GroupIdentifier' :: Maybe Text -> Maybe Text -> GroupIdentifier
GroupIdentifier'
    { $sel:groupArn:GroupIdentifier' :: Maybe Text
groupArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:groupName:GroupIdentifier' :: Maybe Text
groupName = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The ARN of the resource group.
groupIdentifier_groupArn :: Lens.Lens' GroupIdentifier (Prelude.Maybe Prelude.Text)
groupIdentifier_groupArn :: (Maybe Text -> f (Maybe Text))
-> GroupIdentifier -> f GroupIdentifier
groupIdentifier_groupArn = (GroupIdentifier -> Maybe Text)
-> (GroupIdentifier -> Maybe Text -> GroupIdentifier)
-> Lens GroupIdentifier GroupIdentifier (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GroupIdentifier' {Maybe Text
groupArn :: Maybe Text
$sel:groupArn:GroupIdentifier' :: GroupIdentifier -> Maybe Text
groupArn} -> Maybe Text
groupArn) (\s :: GroupIdentifier
s@GroupIdentifier' {} Maybe Text
a -> GroupIdentifier
s {$sel:groupArn:GroupIdentifier' :: Maybe Text
groupArn = Maybe Text
a} :: GroupIdentifier)

-- | The name of the resource group.
groupIdentifier_groupName :: Lens.Lens' GroupIdentifier (Prelude.Maybe Prelude.Text)
groupIdentifier_groupName :: (Maybe Text -> f (Maybe Text))
-> GroupIdentifier -> f GroupIdentifier
groupIdentifier_groupName = (GroupIdentifier -> Maybe Text)
-> (GroupIdentifier -> Maybe Text -> GroupIdentifier)
-> Lens GroupIdentifier GroupIdentifier (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GroupIdentifier' {Maybe Text
groupName :: Maybe Text
$sel:groupName:GroupIdentifier' :: GroupIdentifier -> Maybe Text
groupName} -> Maybe Text
groupName) (\s :: GroupIdentifier
s@GroupIdentifier' {} Maybe Text
a -> GroupIdentifier
s {$sel:groupName:GroupIdentifier' :: Maybe Text
groupName = Maybe Text
a} :: GroupIdentifier)

instance Core.FromJSON GroupIdentifier where
  parseJSON :: Value -> Parser GroupIdentifier
parseJSON =
    String
-> (Object -> Parser GroupIdentifier)
-> Value
-> Parser GroupIdentifier
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"GroupIdentifier"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> GroupIdentifier
GroupIdentifier'
            (Maybe Text -> Maybe Text -> GroupIdentifier)
-> Parser (Maybe Text) -> Parser (Maybe Text -> GroupIdentifier)
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
"GroupArn")
            Parser (Maybe Text -> GroupIdentifier)
-> Parser (Maybe Text) -> Parser GroupIdentifier
forall (f :: * -> *) a b. Applicative f => 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
"GroupName")
      )

instance Prelude.Hashable GroupIdentifier

instance Prelude.NFData GroupIdentifier