{-# 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.ELB.Types.SourceSecurityGroup
-- 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.ELB.Types.SourceSecurityGroup where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.ELB.Internal
import qualified Amazonka.Prelude as Prelude

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

-- |
-- Create a value of 'SourceSecurityGroup' 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:
--
-- 'groupName', 'sourceSecurityGroup_groupName' - The name of the security group.
--
-- 'ownerAlias', 'sourceSecurityGroup_ownerAlias' - The owner of the security group.
newSourceSecurityGroup ::
  SourceSecurityGroup
newSourceSecurityGroup :: SourceSecurityGroup
newSourceSecurityGroup =
  SourceSecurityGroup'
    { $sel:groupName:SourceSecurityGroup' :: Maybe Text
groupName = forall a. Maybe a
Prelude.Nothing,
      $sel:ownerAlias:SourceSecurityGroup' :: Maybe Text
ownerAlias = forall a. Maybe a
Prelude.Nothing
    }

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

-- | The owner of the security group.
sourceSecurityGroup_ownerAlias :: Lens.Lens' SourceSecurityGroup (Prelude.Maybe Prelude.Text)
sourceSecurityGroup_ownerAlias :: Lens' SourceSecurityGroup (Maybe Text)
sourceSecurityGroup_ownerAlias = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SourceSecurityGroup' {Maybe Text
ownerAlias :: Maybe Text
$sel:ownerAlias:SourceSecurityGroup' :: SourceSecurityGroup -> Maybe Text
ownerAlias} -> Maybe Text
ownerAlias) (\s :: SourceSecurityGroup
s@SourceSecurityGroup' {} Maybe Text
a -> SourceSecurityGroup
s {$sel:ownerAlias:SourceSecurityGroup' :: Maybe Text
ownerAlias = Maybe Text
a} :: SourceSecurityGroup)

instance Data.FromXML SourceSecurityGroup where
  parseXML :: [Node] -> Either String SourceSecurityGroup
parseXML [Node]
x =
    Maybe Text -> Maybe Text -> SourceSecurityGroup
SourceSecurityGroup'
      forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"GroupName")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"OwnerAlias")

instance Prelude.Hashable SourceSecurityGroup where
  hashWithSalt :: Int -> SourceSecurityGroup -> Int
hashWithSalt Int
_salt SourceSecurityGroup' {Maybe Text
ownerAlias :: Maybe Text
groupName :: Maybe Text
$sel:ownerAlias:SourceSecurityGroup' :: SourceSecurityGroup -> Maybe Text
$sel:groupName:SourceSecurityGroup' :: SourceSecurityGroup -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
groupName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
ownerAlias

instance Prelude.NFData SourceSecurityGroup where
  rnf :: SourceSecurityGroup -> ()
rnf SourceSecurityGroup' {Maybe Text
ownerAlias :: Maybe Text
groupName :: Maybe Text
$sel:ownerAlias:SourceSecurityGroup' :: SourceSecurityGroup -> Maybe Text
$sel:groupName:SourceSecurityGroup' :: SourceSecurityGroup -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
groupName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
ownerAlias