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

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

-- | Information about a source security group.
--
-- /See:/ 'newSourceSecurityGroup' smart constructor.
data SourceSecurityGroup = SourceSecurityGroup'
  { -- | The owner of the security group.
    SourceSecurityGroup -> Maybe Text
ownerAlias :: Prelude.Maybe Prelude.Text,
    -- | The name of the security group.
    SourceSecurityGroup -> Maybe Text
groupName :: Prelude.Maybe Prelude.Text
  }
  deriving (SourceSecurityGroup -> SourceSecurityGroup -> Bool
(SourceSecurityGroup -> SourceSecurityGroup -> Bool)
-> (SourceSecurityGroup -> SourceSecurityGroup -> Bool)
-> Eq SourceSecurityGroup
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]
(Int -> ReadS SourceSecurityGroup)
-> ReadS [SourceSecurityGroup]
-> ReadPrec SourceSecurityGroup
-> ReadPrec [SourceSecurityGroup]
-> Read 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
(Int -> SourceSecurityGroup -> ShowS)
-> (SourceSecurityGroup -> String)
-> ([SourceSecurityGroup] -> ShowS)
-> Show SourceSecurityGroup
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. SourceSecurityGroup -> Rep SourceSecurityGroup x)
-> (forall x. Rep SourceSecurityGroup x -> SourceSecurityGroup)
-> Generic SourceSecurityGroup
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:
--
-- 'ownerAlias', 'sourceSecurityGroup_ownerAlias' - The owner of the security group.
--
-- 'groupName', 'sourceSecurityGroup_groupName' - The name of the security group.
newSourceSecurityGroup ::
  SourceSecurityGroup
newSourceSecurityGroup :: SourceSecurityGroup
newSourceSecurityGroup =
  SourceSecurityGroup' :: Maybe Text -> Maybe Text -> SourceSecurityGroup
SourceSecurityGroup'
    { $sel:ownerAlias:SourceSecurityGroup' :: Maybe Text
ownerAlias = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:groupName:SourceSecurityGroup' :: Maybe Text
groupName = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The owner of the security group.
sourceSecurityGroup_ownerAlias :: Lens.Lens' SourceSecurityGroup (Prelude.Maybe Prelude.Text)
sourceSecurityGroup_ownerAlias :: (Maybe Text -> f (Maybe Text))
-> SourceSecurityGroup -> f SourceSecurityGroup
sourceSecurityGroup_ownerAlias = (SourceSecurityGroup -> Maybe Text)
-> (SourceSecurityGroup -> Maybe Text -> SourceSecurityGroup)
-> Lens
     SourceSecurityGroup SourceSecurityGroup (Maybe Text) (Maybe Text)
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)

-- | The name of the security group.
sourceSecurityGroup_groupName :: Lens.Lens' SourceSecurityGroup (Prelude.Maybe Prelude.Text)
sourceSecurityGroup_groupName :: (Maybe Text -> f (Maybe Text))
-> SourceSecurityGroup -> f SourceSecurityGroup
sourceSecurityGroup_groupName = (SourceSecurityGroup -> Maybe Text)
-> (SourceSecurityGroup -> Maybe Text -> SourceSecurityGroup)
-> Lens
     SourceSecurityGroup SourceSecurityGroup (Maybe Text) (Maybe Text)
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)

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

instance Prelude.Hashable SourceSecurityGroup

instance Prelude.NFData SourceSecurityGroup