{-# 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.SnowDeviceManagement.Types.SecurityGroupIdentifier
-- 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.SnowDeviceManagement.Types.SecurityGroupIdentifier where

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

-- | Information about the device\'s security group.
--
-- /See:/ 'newSecurityGroupIdentifier' smart constructor.
data SecurityGroupIdentifier = SecurityGroupIdentifier'
  { -- | The security group ID.
    SecurityGroupIdentifier -> Maybe Text
groupId :: Prelude.Maybe Prelude.Text,
    -- | The security group name.
    SecurityGroupIdentifier -> Maybe Text
groupName :: Prelude.Maybe Prelude.Text
  }
  deriving (SecurityGroupIdentifier -> SecurityGroupIdentifier -> Bool
(SecurityGroupIdentifier -> SecurityGroupIdentifier -> Bool)
-> (SecurityGroupIdentifier -> SecurityGroupIdentifier -> Bool)
-> Eq SecurityGroupIdentifier
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SecurityGroupIdentifier -> SecurityGroupIdentifier -> Bool
$c/= :: SecurityGroupIdentifier -> SecurityGroupIdentifier -> Bool
== :: SecurityGroupIdentifier -> SecurityGroupIdentifier -> Bool
$c== :: SecurityGroupIdentifier -> SecurityGroupIdentifier -> Bool
Prelude.Eq, ReadPrec [SecurityGroupIdentifier]
ReadPrec SecurityGroupIdentifier
Int -> ReadS SecurityGroupIdentifier
ReadS [SecurityGroupIdentifier]
(Int -> ReadS SecurityGroupIdentifier)
-> ReadS [SecurityGroupIdentifier]
-> ReadPrec SecurityGroupIdentifier
-> ReadPrec [SecurityGroupIdentifier]
-> Read SecurityGroupIdentifier
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SecurityGroupIdentifier]
$creadListPrec :: ReadPrec [SecurityGroupIdentifier]
readPrec :: ReadPrec SecurityGroupIdentifier
$creadPrec :: ReadPrec SecurityGroupIdentifier
readList :: ReadS [SecurityGroupIdentifier]
$creadList :: ReadS [SecurityGroupIdentifier]
readsPrec :: Int -> ReadS SecurityGroupIdentifier
$creadsPrec :: Int -> ReadS SecurityGroupIdentifier
Prelude.Read, Int -> SecurityGroupIdentifier -> ShowS
[SecurityGroupIdentifier] -> ShowS
SecurityGroupIdentifier -> String
(Int -> SecurityGroupIdentifier -> ShowS)
-> (SecurityGroupIdentifier -> String)
-> ([SecurityGroupIdentifier] -> ShowS)
-> Show SecurityGroupIdentifier
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SecurityGroupIdentifier] -> ShowS
$cshowList :: [SecurityGroupIdentifier] -> ShowS
show :: SecurityGroupIdentifier -> String
$cshow :: SecurityGroupIdentifier -> String
showsPrec :: Int -> SecurityGroupIdentifier -> ShowS
$cshowsPrec :: Int -> SecurityGroupIdentifier -> ShowS
Prelude.Show, (forall x.
 SecurityGroupIdentifier -> Rep SecurityGroupIdentifier x)
-> (forall x.
    Rep SecurityGroupIdentifier x -> SecurityGroupIdentifier)
-> Generic SecurityGroupIdentifier
forall x. Rep SecurityGroupIdentifier x -> SecurityGroupIdentifier
forall x. SecurityGroupIdentifier -> Rep SecurityGroupIdentifier x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SecurityGroupIdentifier x -> SecurityGroupIdentifier
$cfrom :: forall x. SecurityGroupIdentifier -> Rep SecurityGroupIdentifier x
Prelude.Generic)

-- |
-- Create a value of 'SecurityGroupIdentifier' 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:
--
-- 'groupId', 'securityGroupIdentifier_groupId' - The security group ID.
--
-- 'groupName', 'securityGroupIdentifier_groupName' - The security group name.
newSecurityGroupIdentifier ::
  SecurityGroupIdentifier
newSecurityGroupIdentifier :: SecurityGroupIdentifier
newSecurityGroupIdentifier =
  SecurityGroupIdentifier' :: Maybe Text -> Maybe Text -> SecurityGroupIdentifier
SecurityGroupIdentifier'
    { $sel:groupId:SecurityGroupIdentifier' :: Maybe Text
groupId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:groupName:SecurityGroupIdentifier' :: Maybe Text
groupName = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The security group ID.
securityGroupIdentifier_groupId :: Lens.Lens' SecurityGroupIdentifier (Prelude.Maybe Prelude.Text)
securityGroupIdentifier_groupId :: (Maybe Text -> f (Maybe Text))
-> SecurityGroupIdentifier -> f SecurityGroupIdentifier
securityGroupIdentifier_groupId = (SecurityGroupIdentifier -> Maybe Text)
-> (SecurityGroupIdentifier
    -> Maybe Text -> SecurityGroupIdentifier)
-> Lens
     SecurityGroupIdentifier
     SecurityGroupIdentifier
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SecurityGroupIdentifier' {Maybe Text
groupId :: Maybe Text
$sel:groupId:SecurityGroupIdentifier' :: SecurityGroupIdentifier -> Maybe Text
groupId} -> Maybe Text
groupId) (\s :: SecurityGroupIdentifier
s@SecurityGroupIdentifier' {} Maybe Text
a -> SecurityGroupIdentifier
s {$sel:groupId:SecurityGroupIdentifier' :: Maybe Text
groupId = Maybe Text
a} :: SecurityGroupIdentifier)

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

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

instance Prelude.NFData SecurityGroupIdentifier