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

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

-- | Describes the members of a VPC security group.
--
-- /See:/ 'newVpcSecurityGroupMembership' smart constructor.
data VpcSecurityGroupMembership = VpcSecurityGroupMembership'
  { -- | The status of the VPC security group.
    VpcSecurityGroupMembership -> Maybe Text
status :: Prelude.Maybe Prelude.Text,
    -- | The identifier of the VPC security group.
    VpcSecurityGroupMembership -> Maybe Text
vpcSecurityGroupId :: Prelude.Maybe Prelude.Text
  }
  deriving (VpcSecurityGroupMembership -> VpcSecurityGroupMembership -> Bool
(VpcSecurityGroupMembership -> VpcSecurityGroupMembership -> Bool)
-> (VpcSecurityGroupMembership
    -> VpcSecurityGroupMembership -> Bool)
-> Eq VpcSecurityGroupMembership
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]
(Int -> ReadS VpcSecurityGroupMembership)
-> ReadS [VpcSecurityGroupMembership]
-> ReadPrec VpcSecurityGroupMembership
-> ReadPrec [VpcSecurityGroupMembership]
-> Read 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
(Int -> VpcSecurityGroupMembership -> ShowS)
-> (VpcSecurityGroupMembership -> String)
-> ([VpcSecurityGroupMembership] -> ShowS)
-> Show VpcSecurityGroupMembership
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.
 VpcSecurityGroupMembership -> Rep VpcSecurityGroupMembership x)
-> (forall x.
    Rep VpcSecurityGroupMembership x -> VpcSecurityGroupMembership)
-> Generic VpcSecurityGroupMembership
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 status of the VPC security group.
--
-- 'vpcSecurityGroupId', 'vpcSecurityGroupMembership_vpcSecurityGroupId' - The identifier of the VPC security group.
newVpcSecurityGroupMembership ::
  VpcSecurityGroupMembership
newVpcSecurityGroupMembership :: VpcSecurityGroupMembership
newVpcSecurityGroupMembership =
  VpcSecurityGroupMembership' :: Maybe Text -> Maybe Text -> VpcSecurityGroupMembership
VpcSecurityGroupMembership'
    { $sel:status:VpcSecurityGroupMembership' :: Maybe Text
status =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:vpcSecurityGroupId:VpcSecurityGroupMembership' :: Maybe Text
vpcSecurityGroupId = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The status of the VPC security group.
vpcSecurityGroupMembership_status :: Lens.Lens' VpcSecurityGroupMembership (Prelude.Maybe Prelude.Text)
vpcSecurityGroupMembership_status :: (Maybe Text -> f (Maybe Text))
-> VpcSecurityGroupMembership -> f VpcSecurityGroupMembership
vpcSecurityGroupMembership_status = (VpcSecurityGroupMembership -> Maybe Text)
-> (VpcSecurityGroupMembership
    -> Maybe Text -> VpcSecurityGroupMembership)
-> Lens
     VpcSecurityGroupMembership
     VpcSecurityGroupMembership
     (Maybe Text)
     (Maybe Text)
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 identifier of the VPC security group.
vpcSecurityGroupMembership_vpcSecurityGroupId :: Lens.Lens' VpcSecurityGroupMembership (Prelude.Maybe Prelude.Text)
vpcSecurityGroupMembership_vpcSecurityGroupId :: (Maybe Text -> f (Maybe Text))
-> VpcSecurityGroupMembership -> f VpcSecurityGroupMembership
vpcSecurityGroupMembership_vpcSecurityGroupId = (VpcSecurityGroupMembership -> Maybe Text)
-> (VpcSecurityGroupMembership
    -> Maybe Text -> VpcSecurityGroupMembership)
-> Lens
     VpcSecurityGroupMembership
     VpcSecurityGroupMembership
     (Maybe Text)
     (Maybe Text)
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 Core.FromXML VpcSecurityGroupMembership where
  parseXML :: [Node] -> Either String VpcSecurityGroupMembership
parseXML [Node]
x =
    Maybe Text -> Maybe Text -> VpcSecurityGroupMembership
VpcSecurityGroupMembership'
      (Maybe Text -> Maybe Text -> VpcSecurityGroupMembership)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> VpcSecurityGroupMembership)
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 -> VpcSecurityGroupMembership)
-> Either String (Maybe Text)
-> Either String VpcSecurityGroupMembership
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
"VpcSecurityGroupId")

instance Prelude.Hashable VpcSecurityGroupMembership

instance Prelude.NFData VpcSecurityGroupMembership