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

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

-- |
-- Create a value of 'Vpc' 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', 'vpc_securityGroups' - The security groups for the connector.
--
-- 'subnets', 'vpc_subnets' - The subnets for the connector.
newVpc ::
  Vpc
newVpc :: Vpc
newVpc =
  Vpc'
    { $sel:securityGroups:Vpc' :: Maybe [Text]
securityGroups = forall a. Maybe a
Prelude.Nothing,
      $sel:subnets:Vpc' :: [Text]
subnets = forall a. Monoid a => a
Prelude.mempty
    }

-- | The security groups for the connector.
vpc_securityGroups :: Lens.Lens' Vpc (Prelude.Maybe [Prelude.Text])
vpc_securityGroups :: Lens' Vpc (Maybe [Text])
vpc_securityGroups = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Vpc' {Maybe [Text]
securityGroups :: Maybe [Text]
$sel:securityGroups:Vpc' :: Vpc -> Maybe [Text]
securityGroups} -> Maybe [Text]
securityGroups) (\s :: Vpc
s@Vpc' {} Maybe [Text]
a -> Vpc
s {$sel:securityGroups:Vpc' :: Maybe [Text]
securityGroups = Maybe [Text]
a} :: Vpc) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The subnets for the connector.
vpc_subnets :: Lens.Lens' Vpc [Prelude.Text]
vpc_subnets :: Lens' Vpc [Text]
vpc_subnets = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Vpc' {[Text]
subnets :: [Text]
$sel:subnets:Vpc' :: Vpc -> [Text]
subnets} -> [Text]
subnets) (\s :: Vpc
s@Vpc' {} [Text]
a -> Vpc
s {$sel:subnets:Vpc' :: [Text]
subnets = [Text]
a} :: Vpc) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Prelude.Hashable Vpc where
  hashWithSalt :: Int -> Vpc -> Int
hashWithSalt Int
_salt Vpc' {[Text]
Maybe [Text]
subnets :: [Text]
securityGroups :: Maybe [Text]
$sel:subnets:Vpc' :: Vpc -> [Text]
$sel:securityGroups:Vpc' :: Vpc -> Maybe [Text]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
securityGroups
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [Text]
subnets

instance Prelude.NFData Vpc where
  rnf :: Vpc -> ()
rnf Vpc' {[Text]
Maybe [Text]
subnets :: [Text]
securityGroups :: Maybe [Text]
$sel:subnets:Vpc' :: Vpc -> [Text]
$sel:securityGroups:Vpc' :: Vpc -> Maybe [Text]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
securityGroups
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [Text]
subnets

instance Data.ToJSON Vpc where
  toJSON :: Vpc -> Value
toJSON Vpc' {[Text]
Maybe [Text]
subnets :: [Text]
securityGroups :: Maybe [Text]
$sel:subnets:Vpc' :: Vpc -> [Text]
$sel:securityGroups:Vpc' :: Vpc -> Maybe [Text]
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"securityGroups" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
securityGroups,
            forall a. a -> Maybe a
Prelude.Just (Key
"subnets" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= [Text]
subnets)
          ]
      )