{-# 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.KafkaConnect.Types.VpcDescription
-- 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.KafkaConnect.Types.VpcDescription where

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

-- | The description of the VPC in which the connector resides.
--
-- /See:/ 'newVpcDescription' smart constructor.
data VpcDescription = VpcDescription'
  { -- | The security groups for the connector.
    VpcDescription -> Maybe [Text]
securityGroups :: Prelude.Maybe [Prelude.Text],
    -- | The subnets for the connector.
    VpcDescription -> Maybe [Text]
subnets :: Prelude.Maybe [Prelude.Text]
  }
  deriving (VpcDescription -> VpcDescription -> Bool
(VpcDescription -> VpcDescription -> Bool)
-> (VpcDescription -> VpcDescription -> Bool) -> Eq VpcDescription
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VpcDescription -> VpcDescription -> Bool
$c/= :: VpcDescription -> VpcDescription -> Bool
== :: VpcDescription -> VpcDescription -> Bool
$c== :: VpcDescription -> VpcDescription -> Bool
Prelude.Eq, ReadPrec [VpcDescription]
ReadPrec VpcDescription
Int -> ReadS VpcDescription
ReadS [VpcDescription]
(Int -> ReadS VpcDescription)
-> ReadS [VpcDescription]
-> ReadPrec VpcDescription
-> ReadPrec [VpcDescription]
-> Read VpcDescription
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [VpcDescription]
$creadListPrec :: ReadPrec [VpcDescription]
readPrec :: ReadPrec VpcDescription
$creadPrec :: ReadPrec VpcDescription
readList :: ReadS [VpcDescription]
$creadList :: ReadS [VpcDescription]
readsPrec :: Int -> ReadS VpcDescription
$creadsPrec :: Int -> ReadS VpcDescription
Prelude.Read, Int -> VpcDescription -> ShowS
[VpcDescription] -> ShowS
VpcDescription -> String
(Int -> VpcDescription -> ShowS)
-> (VpcDescription -> String)
-> ([VpcDescription] -> ShowS)
-> Show VpcDescription
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VpcDescription] -> ShowS
$cshowList :: [VpcDescription] -> ShowS
show :: VpcDescription -> String
$cshow :: VpcDescription -> String
showsPrec :: Int -> VpcDescription -> ShowS
$cshowsPrec :: Int -> VpcDescription -> ShowS
Prelude.Show, (forall x. VpcDescription -> Rep VpcDescription x)
-> (forall x. Rep VpcDescription x -> VpcDescription)
-> Generic VpcDescription
forall x. Rep VpcDescription x -> VpcDescription
forall x. VpcDescription -> Rep VpcDescription x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep VpcDescription x -> VpcDescription
$cfrom :: forall x. VpcDescription -> Rep VpcDescription x
Prelude.Generic)

-- |
-- Create a value of 'VpcDescription' 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:
--
-- 'securityGroups', 'vpcDescription_securityGroups' - The security groups for the connector.
--
-- 'subnets', 'vpcDescription_subnets' - The subnets for the connector.
newVpcDescription ::
  VpcDescription
newVpcDescription :: VpcDescription
newVpcDescription =
  VpcDescription' :: Maybe [Text] -> Maybe [Text] -> VpcDescription
VpcDescription'
    { $sel:securityGroups:VpcDescription' :: Maybe [Text]
securityGroups = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:subnets:VpcDescription' :: Maybe [Text]
subnets = Maybe [Text]
forall a. Maybe a
Prelude.Nothing
    }

-- | The security groups for the connector.
vpcDescription_securityGroups :: Lens.Lens' VpcDescription (Prelude.Maybe [Prelude.Text])
vpcDescription_securityGroups :: (Maybe [Text] -> f (Maybe [Text]))
-> VpcDescription -> f VpcDescription
vpcDescription_securityGroups = (VpcDescription -> Maybe [Text])
-> (VpcDescription -> Maybe [Text] -> VpcDescription)
-> Lens VpcDescription VpcDescription (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpcDescription' {Maybe [Text]
securityGroups :: Maybe [Text]
$sel:securityGroups:VpcDescription' :: VpcDescription -> Maybe [Text]
securityGroups} -> Maybe [Text]
securityGroups) (\s :: VpcDescription
s@VpcDescription' {} Maybe [Text]
a -> VpcDescription
s {$sel:securityGroups:VpcDescription' :: Maybe [Text]
securityGroups = Maybe [Text]
a} :: VpcDescription) ((Maybe [Text] -> f (Maybe [Text]))
 -> VpcDescription -> f VpcDescription)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> VpcDescription
-> f VpcDescription
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The subnets for the connector.
vpcDescription_subnets :: Lens.Lens' VpcDescription (Prelude.Maybe [Prelude.Text])
vpcDescription_subnets :: (Maybe [Text] -> f (Maybe [Text]))
-> VpcDescription -> f VpcDescription
vpcDescription_subnets = (VpcDescription -> Maybe [Text])
-> (VpcDescription -> Maybe [Text] -> VpcDescription)
-> Lens VpcDescription VpcDescription (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpcDescription' {Maybe [Text]
subnets :: Maybe [Text]
$sel:subnets:VpcDescription' :: VpcDescription -> Maybe [Text]
subnets} -> Maybe [Text]
subnets) (\s :: VpcDescription
s@VpcDescription' {} Maybe [Text]
a -> VpcDescription
s {$sel:subnets:VpcDescription' :: Maybe [Text]
subnets = Maybe [Text]
a} :: VpcDescription) ((Maybe [Text] -> f (Maybe [Text]))
 -> VpcDescription -> f VpcDescription)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> VpcDescription
-> f VpcDescription
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON VpcDescription where
  parseJSON :: Value -> Parser VpcDescription
parseJSON =
    String
-> (Object -> Parser VpcDescription)
-> Value
-> Parser VpcDescription
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"VpcDescription"
      ( \Object
x ->
          Maybe [Text] -> Maybe [Text] -> VpcDescription
VpcDescription'
            (Maybe [Text] -> Maybe [Text] -> VpcDescription)
-> Parser (Maybe [Text]) -> Parser (Maybe [Text] -> VpcDescription)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"securityGroups" Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty)
            Parser (Maybe [Text] -> VpcDescription)
-> Parser (Maybe [Text]) -> Parser VpcDescription
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"subnets" Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable VpcDescription

instance Prelude.NFData VpcDescription