{-# 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.RDS.Types.VpcSecurityGroupMembership
-- 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.RDS.Types.VpcSecurityGroupMembership where

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

-- | This data type is used as a response element for queries on VPC security
-- group membership.
--
-- /See:/ 'newVpcSecurityGroupMembership' smart constructor.
data VpcSecurityGroupMembership = VpcSecurityGroupMembership'
  { -- | The membership status of the VPC security group.
    --
    -- Currently, the only valid status is @active@.
    VpcSecurityGroupMembership -> Maybe Text
status :: Prelude.Maybe Prelude.Text,
    -- | The name of the VPC security group.
    VpcSecurityGroupMembership -> Maybe Text
vpcSecurityGroupId :: Prelude.Maybe Prelude.Text
  }
  deriving (VpcSecurityGroupMembership -> VpcSecurityGroupMembership -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VpcSecurityGroupMembership -> VpcSecurityGroupMembership -> Bool
$c/= :: VpcSecurityGroupMembership -> VpcSecurityGroupMembership -> Bool
== :: VpcSecurityGroupMembership -> VpcSecurityGroupMembership -> Bool
$c== :: VpcSecurityGroupMembership -> VpcSecurityGroupMembership -> Bool
Prelude.Eq, ReadPrec [VpcSecurityGroupMembership]
ReadPrec VpcSecurityGroupMembership
Int -> ReadS VpcSecurityGroupMembership
ReadS [VpcSecurityGroupMembership]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [VpcSecurityGroupMembership]
$creadListPrec :: ReadPrec [VpcSecurityGroupMembership]
readPrec :: ReadPrec VpcSecurityGroupMembership
$creadPrec :: ReadPrec VpcSecurityGroupMembership
readList :: ReadS [VpcSecurityGroupMembership]
$creadList :: ReadS [VpcSecurityGroupMembership]
readsPrec :: Int -> ReadS VpcSecurityGroupMembership
$creadsPrec :: Int -> ReadS VpcSecurityGroupMembership
Prelude.Read, Int -> VpcSecurityGroupMembership -> ShowS
[VpcSecurityGroupMembership] -> ShowS
VpcSecurityGroupMembership -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VpcSecurityGroupMembership] -> ShowS
$cshowList :: [VpcSecurityGroupMembership] -> ShowS
show :: VpcSecurityGroupMembership -> String
$cshow :: VpcSecurityGroupMembership -> String
showsPrec :: Int -> VpcSecurityGroupMembership -> ShowS
$cshowsPrec :: Int -> VpcSecurityGroupMembership -> ShowS
Prelude.Show, forall x.
Rep VpcSecurityGroupMembership x -> VpcSecurityGroupMembership
forall x.
VpcSecurityGroupMembership -> Rep VpcSecurityGroupMembership x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep VpcSecurityGroupMembership x -> VpcSecurityGroupMembership
$cfrom :: forall x.
VpcSecurityGroupMembership -> Rep VpcSecurityGroupMembership x
Prelude.Generic)

-- |
-- Create a value of 'VpcSecurityGroupMembership' 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', 'vpcSecurityGroupMembership_status' - The membership status of the VPC security group.
--
-- Currently, the only valid status is @active@.
--
-- 'vpcSecurityGroupId', 'vpcSecurityGroupMembership_vpcSecurityGroupId' - The name of the VPC security group.
newVpcSecurityGroupMembership ::
  VpcSecurityGroupMembership
newVpcSecurityGroupMembership :: VpcSecurityGroupMembership
newVpcSecurityGroupMembership =
  VpcSecurityGroupMembership'
    { $sel:status:VpcSecurityGroupMembership' :: Maybe Text
status =
        forall a. Maybe a
Prelude.Nothing,
      $sel:vpcSecurityGroupId:VpcSecurityGroupMembership' :: Maybe Text
vpcSecurityGroupId = forall a. Maybe a
Prelude.Nothing
    }

-- | The membership status of the VPC security group.
--
-- Currently, the only valid status is @active@.
vpcSecurityGroupMembership_status :: Lens.Lens' VpcSecurityGroupMembership (Prelude.Maybe Prelude.Text)
vpcSecurityGroupMembership_status :: Lens' VpcSecurityGroupMembership (Maybe Text)
vpcSecurityGroupMembership_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpcSecurityGroupMembership' {Maybe Text
status :: Maybe Text
$sel:status:VpcSecurityGroupMembership' :: VpcSecurityGroupMembership -> Maybe Text
status} -> Maybe Text
status) (\s :: VpcSecurityGroupMembership
s@VpcSecurityGroupMembership' {} Maybe Text
a -> VpcSecurityGroupMembership
s {$sel:status:VpcSecurityGroupMembership' :: Maybe Text
status = Maybe Text
a} :: VpcSecurityGroupMembership)

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

instance Data.FromXML VpcSecurityGroupMembership where
  parseXML :: [Node] -> Either String VpcSecurityGroupMembership
parseXML [Node]
x =
    Maybe Text -> Maybe Text -> VpcSecurityGroupMembership
VpcSecurityGroupMembership'
      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
"Status")
      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
"VpcSecurityGroupId")

instance Prelude.Hashable VpcSecurityGroupMembership where
  hashWithSalt :: Int -> VpcSecurityGroupMembership -> Int
hashWithSalt Int
_salt VpcSecurityGroupMembership' {Maybe Text
vpcSecurityGroupId :: Maybe Text
status :: Maybe Text
$sel:vpcSecurityGroupId:VpcSecurityGroupMembership' :: VpcSecurityGroupMembership -> Maybe Text
$sel:status:VpcSecurityGroupMembership' :: VpcSecurityGroupMembership -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
status
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
vpcSecurityGroupId

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