{-# 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.IoT.Types.GroupNameAndArn
-- 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.IoT.Types.GroupNameAndArn where

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

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

-- |
-- Create a value of 'GroupNameAndArn' 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', 'groupNameAndArn_groupArn' - The group ARN.
--
-- 'groupName', 'groupNameAndArn_groupName' - The group name.
newGroupNameAndArn ::
  GroupNameAndArn
newGroupNameAndArn :: GroupNameAndArn
newGroupNameAndArn =
  GroupNameAndArn' :: Maybe Text -> Maybe Text -> GroupNameAndArn
GroupNameAndArn'
    { $sel:groupArn:GroupNameAndArn' :: Maybe Text
groupArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:groupName:GroupNameAndArn' :: Maybe Text
groupName = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

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

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

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

instance Prelude.NFData GroupNameAndArn