{-# 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.Neptune.Types.DBSecurityGroupMembership
-- 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.Neptune.Types.DBSecurityGroupMembership where

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

-- | Specifies membership in a designated DB security group.
--
-- /See:/ 'newDBSecurityGroupMembership' smart constructor.
data DBSecurityGroupMembership = DBSecurityGroupMembership'
  { -- | The status of the DB security group.
    DBSecurityGroupMembership -> Maybe Text
status :: Prelude.Maybe Prelude.Text,
    -- | The name of the DB security group.
    DBSecurityGroupMembership -> Maybe Text
dbSecurityGroupName :: Prelude.Maybe Prelude.Text
  }
  deriving (DBSecurityGroupMembership -> DBSecurityGroupMembership -> Bool
(DBSecurityGroupMembership -> DBSecurityGroupMembership -> Bool)
-> (DBSecurityGroupMembership -> DBSecurityGroupMembership -> Bool)
-> Eq DBSecurityGroupMembership
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DBSecurityGroupMembership -> DBSecurityGroupMembership -> Bool
$c/= :: DBSecurityGroupMembership -> DBSecurityGroupMembership -> Bool
== :: DBSecurityGroupMembership -> DBSecurityGroupMembership -> Bool
$c== :: DBSecurityGroupMembership -> DBSecurityGroupMembership -> Bool
Prelude.Eq, ReadPrec [DBSecurityGroupMembership]
ReadPrec DBSecurityGroupMembership
Int -> ReadS DBSecurityGroupMembership
ReadS [DBSecurityGroupMembership]
(Int -> ReadS DBSecurityGroupMembership)
-> ReadS [DBSecurityGroupMembership]
-> ReadPrec DBSecurityGroupMembership
-> ReadPrec [DBSecurityGroupMembership]
-> Read DBSecurityGroupMembership
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DBSecurityGroupMembership]
$creadListPrec :: ReadPrec [DBSecurityGroupMembership]
readPrec :: ReadPrec DBSecurityGroupMembership
$creadPrec :: ReadPrec DBSecurityGroupMembership
readList :: ReadS [DBSecurityGroupMembership]
$creadList :: ReadS [DBSecurityGroupMembership]
readsPrec :: Int -> ReadS DBSecurityGroupMembership
$creadsPrec :: Int -> ReadS DBSecurityGroupMembership
Prelude.Read, Int -> DBSecurityGroupMembership -> ShowS
[DBSecurityGroupMembership] -> ShowS
DBSecurityGroupMembership -> String
(Int -> DBSecurityGroupMembership -> ShowS)
-> (DBSecurityGroupMembership -> String)
-> ([DBSecurityGroupMembership] -> ShowS)
-> Show DBSecurityGroupMembership
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DBSecurityGroupMembership] -> ShowS
$cshowList :: [DBSecurityGroupMembership] -> ShowS
show :: DBSecurityGroupMembership -> String
$cshow :: DBSecurityGroupMembership -> String
showsPrec :: Int -> DBSecurityGroupMembership -> ShowS
$cshowsPrec :: Int -> DBSecurityGroupMembership -> ShowS
Prelude.Show, (forall x.
 DBSecurityGroupMembership -> Rep DBSecurityGroupMembership x)
-> (forall x.
    Rep DBSecurityGroupMembership x -> DBSecurityGroupMembership)
-> Generic DBSecurityGroupMembership
forall x.
Rep DBSecurityGroupMembership x -> DBSecurityGroupMembership
forall x.
DBSecurityGroupMembership -> Rep DBSecurityGroupMembership x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DBSecurityGroupMembership x -> DBSecurityGroupMembership
$cfrom :: forall x.
DBSecurityGroupMembership -> Rep DBSecurityGroupMembership x
Prelude.Generic)

-- |
-- Create a value of 'DBSecurityGroupMembership' 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:
--
-- 'status', 'dbSecurityGroupMembership_status' - The status of the DB security group.
--
-- 'dbSecurityGroupName', 'dbSecurityGroupMembership_dbSecurityGroupName' - The name of the DB security group.
newDBSecurityGroupMembership ::
  DBSecurityGroupMembership
newDBSecurityGroupMembership :: DBSecurityGroupMembership
newDBSecurityGroupMembership =
  DBSecurityGroupMembership' :: Maybe Text -> Maybe Text -> DBSecurityGroupMembership
DBSecurityGroupMembership'
    { $sel:status:DBSecurityGroupMembership' :: Maybe Text
status =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:dbSecurityGroupName:DBSecurityGroupMembership' :: Maybe Text
dbSecurityGroupName = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The status of the DB security group.
dbSecurityGroupMembership_status :: Lens.Lens' DBSecurityGroupMembership (Prelude.Maybe Prelude.Text)
dbSecurityGroupMembership_status :: (Maybe Text -> f (Maybe Text))
-> DBSecurityGroupMembership -> f DBSecurityGroupMembership
dbSecurityGroupMembership_status = (DBSecurityGroupMembership -> Maybe Text)
-> (DBSecurityGroupMembership
    -> Maybe Text -> DBSecurityGroupMembership)
-> Lens
     DBSecurityGroupMembership
     DBSecurityGroupMembership
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DBSecurityGroupMembership' {Maybe Text
status :: Maybe Text
$sel:status:DBSecurityGroupMembership' :: DBSecurityGroupMembership -> Maybe Text
status} -> Maybe Text
status) (\s :: DBSecurityGroupMembership
s@DBSecurityGroupMembership' {} Maybe Text
a -> DBSecurityGroupMembership
s {$sel:status:DBSecurityGroupMembership' :: Maybe Text
status = Maybe Text
a} :: DBSecurityGroupMembership)

-- | The name of the DB security group.
dbSecurityGroupMembership_dbSecurityGroupName :: Lens.Lens' DBSecurityGroupMembership (Prelude.Maybe Prelude.Text)
dbSecurityGroupMembership_dbSecurityGroupName :: (Maybe Text -> f (Maybe Text))
-> DBSecurityGroupMembership -> f DBSecurityGroupMembership
dbSecurityGroupMembership_dbSecurityGroupName = (DBSecurityGroupMembership -> Maybe Text)
-> (DBSecurityGroupMembership
    -> Maybe Text -> DBSecurityGroupMembership)
-> Lens
     DBSecurityGroupMembership
     DBSecurityGroupMembership
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DBSecurityGroupMembership' {Maybe Text
dbSecurityGroupName :: Maybe Text
$sel:dbSecurityGroupName:DBSecurityGroupMembership' :: DBSecurityGroupMembership -> Maybe Text
dbSecurityGroupName} -> Maybe Text
dbSecurityGroupName) (\s :: DBSecurityGroupMembership
s@DBSecurityGroupMembership' {} Maybe Text
a -> DBSecurityGroupMembership
s {$sel:dbSecurityGroupName:DBSecurityGroupMembership' :: Maybe Text
dbSecurityGroupName = Maybe Text
a} :: DBSecurityGroupMembership)

instance Core.FromXML DBSecurityGroupMembership where
  parseXML :: [Node] -> Either String DBSecurityGroupMembership
parseXML [Node]
x =
    Maybe Text -> Maybe Text -> DBSecurityGroupMembership
DBSecurityGroupMembership'
      (Maybe Text -> Maybe Text -> DBSecurityGroupMembership)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> DBSecurityGroupMembership)
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
"Status")
      Either String (Maybe Text -> DBSecurityGroupMembership)
-> Either String (Maybe Text)
-> Either String DBSecurityGroupMembership
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
"DBSecurityGroupName")

instance Prelude.Hashable DBSecurityGroupMembership

instance Prelude.NFData DBSecurityGroupMembership