{-# 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.SecurityHub.Types.AwsRdsDbInstanceVpcSecurityGroup
-- 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.SecurityHub.Types.AwsRdsDbInstanceVpcSecurityGroup where

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

-- | A VPC security groups that the DB instance belongs to.
--
-- /See:/ 'newAwsRdsDbInstanceVpcSecurityGroup' smart constructor.
data AwsRdsDbInstanceVpcSecurityGroup = AwsRdsDbInstanceVpcSecurityGroup'
  { -- | The status of the VPC security group.
    AwsRdsDbInstanceVpcSecurityGroup -> Maybe Text
status :: Prelude.Maybe Prelude.Text,
    -- | The name of the VPC security group.
    AwsRdsDbInstanceVpcSecurityGroup -> Maybe Text
vpcSecurityGroupId :: Prelude.Maybe Prelude.Text
  }
  deriving (AwsRdsDbInstanceVpcSecurityGroup
-> AwsRdsDbInstanceVpcSecurityGroup -> Bool
(AwsRdsDbInstanceVpcSecurityGroup
 -> AwsRdsDbInstanceVpcSecurityGroup -> Bool)
-> (AwsRdsDbInstanceVpcSecurityGroup
    -> AwsRdsDbInstanceVpcSecurityGroup -> Bool)
-> Eq AwsRdsDbInstanceVpcSecurityGroup
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AwsRdsDbInstanceVpcSecurityGroup
-> AwsRdsDbInstanceVpcSecurityGroup -> Bool
$c/= :: AwsRdsDbInstanceVpcSecurityGroup
-> AwsRdsDbInstanceVpcSecurityGroup -> Bool
== :: AwsRdsDbInstanceVpcSecurityGroup
-> AwsRdsDbInstanceVpcSecurityGroup -> Bool
$c== :: AwsRdsDbInstanceVpcSecurityGroup
-> AwsRdsDbInstanceVpcSecurityGroup -> Bool
Prelude.Eq, ReadPrec [AwsRdsDbInstanceVpcSecurityGroup]
ReadPrec AwsRdsDbInstanceVpcSecurityGroup
Int -> ReadS AwsRdsDbInstanceVpcSecurityGroup
ReadS [AwsRdsDbInstanceVpcSecurityGroup]
(Int -> ReadS AwsRdsDbInstanceVpcSecurityGroup)
-> ReadS [AwsRdsDbInstanceVpcSecurityGroup]
-> ReadPrec AwsRdsDbInstanceVpcSecurityGroup
-> ReadPrec [AwsRdsDbInstanceVpcSecurityGroup]
-> Read AwsRdsDbInstanceVpcSecurityGroup
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AwsRdsDbInstanceVpcSecurityGroup]
$creadListPrec :: ReadPrec [AwsRdsDbInstanceVpcSecurityGroup]
readPrec :: ReadPrec AwsRdsDbInstanceVpcSecurityGroup
$creadPrec :: ReadPrec AwsRdsDbInstanceVpcSecurityGroup
readList :: ReadS [AwsRdsDbInstanceVpcSecurityGroup]
$creadList :: ReadS [AwsRdsDbInstanceVpcSecurityGroup]
readsPrec :: Int -> ReadS AwsRdsDbInstanceVpcSecurityGroup
$creadsPrec :: Int -> ReadS AwsRdsDbInstanceVpcSecurityGroup
Prelude.Read, Int -> AwsRdsDbInstanceVpcSecurityGroup -> ShowS
[AwsRdsDbInstanceVpcSecurityGroup] -> ShowS
AwsRdsDbInstanceVpcSecurityGroup -> String
(Int -> AwsRdsDbInstanceVpcSecurityGroup -> ShowS)
-> (AwsRdsDbInstanceVpcSecurityGroup -> String)
-> ([AwsRdsDbInstanceVpcSecurityGroup] -> ShowS)
-> Show AwsRdsDbInstanceVpcSecurityGroup
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AwsRdsDbInstanceVpcSecurityGroup] -> ShowS
$cshowList :: [AwsRdsDbInstanceVpcSecurityGroup] -> ShowS
show :: AwsRdsDbInstanceVpcSecurityGroup -> String
$cshow :: AwsRdsDbInstanceVpcSecurityGroup -> String
showsPrec :: Int -> AwsRdsDbInstanceVpcSecurityGroup -> ShowS
$cshowsPrec :: Int -> AwsRdsDbInstanceVpcSecurityGroup -> ShowS
Prelude.Show, (forall x.
 AwsRdsDbInstanceVpcSecurityGroup
 -> Rep AwsRdsDbInstanceVpcSecurityGroup x)
-> (forall x.
    Rep AwsRdsDbInstanceVpcSecurityGroup x
    -> AwsRdsDbInstanceVpcSecurityGroup)
-> Generic AwsRdsDbInstanceVpcSecurityGroup
forall x.
Rep AwsRdsDbInstanceVpcSecurityGroup x
-> AwsRdsDbInstanceVpcSecurityGroup
forall x.
AwsRdsDbInstanceVpcSecurityGroup
-> Rep AwsRdsDbInstanceVpcSecurityGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AwsRdsDbInstanceVpcSecurityGroup x
-> AwsRdsDbInstanceVpcSecurityGroup
$cfrom :: forall x.
AwsRdsDbInstanceVpcSecurityGroup
-> Rep AwsRdsDbInstanceVpcSecurityGroup x
Prelude.Generic)

-- |
-- Create a value of 'AwsRdsDbInstanceVpcSecurityGroup' 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', 'awsRdsDbInstanceVpcSecurityGroup_status' - The status of the VPC security group.
--
-- 'vpcSecurityGroupId', 'awsRdsDbInstanceVpcSecurityGroup_vpcSecurityGroupId' - The name of the VPC security group.
newAwsRdsDbInstanceVpcSecurityGroup ::
  AwsRdsDbInstanceVpcSecurityGroup
newAwsRdsDbInstanceVpcSecurityGroup :: AwsRdsDbInstanceVpcSecurityGroup
newAwsRdsDbInstanceVpcSecurityGroup =
  AwsRdsDbInstanceVpcSecurityGroup' :: Maybe Text -> Maybe Text -> AwsRdsDbInstanceVpcSecurityGroup
AwsRdsDbInstanceVpcSecurityGroup'
    { $sel:status:AwsRdsDbInstanceVpcSecurityGroup' :: Maybe Text
status =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:vpcSecurityGroupId:AwsRdsDbInstanceVpcSecurityGroup' :: Maybe Text
vpcSecurityGroupId = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

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

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

instance
  Core.FromJSON
    AwsRdsDbInstanceVpcSecurityGroup
  where
  parseJSON :: Value -> Parser AwsRdsDbInstanceVpcSecurityGroup
parseJSON =
    String
-> (Object -> Parser AwsRdsDbInstanceVpcSecurityGroup)
-> Value
-> Parser AwsRdsDbInstanceVpcSecurityGroup
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AwsRdsDbInstanceVpcSecurityGroup"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> AwsRdsDbInstanceVpcSecurityGroup
AwsRdsDbInstanceVpcSecurityGroup'
            (Maybe Text -> Maybe Text -> AwsRdsDbInstanceVpcSecurityGroup)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> AwsRdsDbInstanceVpcSecurityGroup)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Status")
            Parser (Maybe Text -> AwsRdsDbInstanceVpcSecurityGroup)
-> Parser (Maybe Text) -> Parser AwsRdsDbInstanceVpcSecurityGroup
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"VpcSecurityGroupId")
      )

instance
  Prelude.Hashable
    AwsRdsDbInstanceVpcSecurityGroup

instance
  Prelude.NFData
    AwsRdsDbInstanceVpcSecurityGroup

instance Core.ToJSON AwsRdsDbInstanceVpcSecurityGroup where
  toJSON :: AwsRdsDbInstanceVpcSecurityGroup -> Value
toJSON AwsRdsDbInstanceVpcSecurityGroup' {Maybe Text
vpcSecurityGroupId :: Maybe Text
status :: Maybe Text
$sel:vpcSecurityGroupId:AwsRdsDbInstanceVpcSecurityGroup' :: AwsRdsDbInstanceVpcSecurityGroup -> Maybe Text
$sel:status:AwsRdsDbInstanceVpcSecurityGroup' :: AwsRdsDbInstanceVpcSecurityGroup -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"Status" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
status,
            (Text
"VpcSecurityGroupId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
vpcSecurityGroupId
          ]
      )