{-# 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.AwsRedshiftClusterVpcSecurityGroup
-- 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.AwsRedshiftClusterVpcSecurityGroup where

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

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

-- |
-- Create a value of 'AwsRedshiftClusterVpcSecurityGroup' 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', 'awsRedshiftClusterVpcSecurityGroup_status' - The status of the VPC security group.
--
-- 'vpcSecurityGroupId', 'awsRedshiftClusterVpcSecurityGroup_vpcSecurityGroupId' - The identifier of the VPC security group.
newAwsRedshiftClusterVpcSecurityGroup ::
  AwsRedshiftClusterVpcSecurityGroup
newAwsRedshiftClusterVpcSecurityGroup :: AwsRedshiftClusterVpcSecurityGroup
newAwsRedshiftClusterVpcSecurityGroup =
  AwsRedshiftClusterVpcSecurityGroup' :: Maybe Text -> Maybe Text -> AwsRedshiftClusterVpcSecurityGroup
AwsRedshiftClusterVpcSecurityGroup'
    { $sel:status:AwsRedshiftClusterVpcSecurityGroup' :: Maybe Text
status =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:vpcSecurityGroupId:AwsRedshiftClusterVpcSecurityGroup' :: Maybe Text
vpcSecurityGroupId = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

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

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

instance
  Core.FromJSON
    AwsRedshiftClusterVpcSecurityGroup
  where
  parseJSON :: Value -> Parser AwsRedshiftClusterVpcSecurityGroup
parseJSON =
    String
-> (Object -> Parser AwsRedshiftClusterVpcSecurityGroup)
-> Value
-> Parser AwsRedshiftClusterVpcSecurityGroup
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AwsRedshiftClusterVpcSecurityGroup"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> AwsRedshiftClusterVpcSecurityGroup
AwsRedshiftClusterVpcSecurityGroup'
            (Maybe Text -> Maybe Text -> AwsRedshiftClusterVpcSecurityGroup)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> AwsRedshiftClusterVpcSecurityGroup)
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 -> AwsRedshiftClusterVpcSecurityGroup)
-> Parser (Maybe Text) -> Parser AwsRedshiftClusterVpcSecurityGroup
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
    AwsRedshiftClusterVpcSecurityGroup

instance
  Prelude.NFData
    AwsRedshiftClusterVpcSecurityGroup

instance
  Core.ToJSON
    AwsRedshiftClusterVpcSecurityGroup
  where
  toJSON :: AwsRedshiftClusterVpcSecurityGroup -> Value
toJSON AwsRedshiftClusterVpcSecurityGroup' {Maybe Text
vpcSecurityGroupId :: Maybe Text
status :: Maybe Text
$sel:vpcSecurityGroupId:AwsRedshiftClusterVpcSecurityGroup' :: AwsRedshiftClusterVpcSecurityGroup -> Maybe Text
$sel:status:AwsRedshiftClusterVpcSecurityGroup' :: AwsRedshiftClusterVpcSecurityGroup -> 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
          ]
      )