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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(Vpc -> Vpc -> Bool) -> (Vpc -> Vpc -> Bool) -> Eq Vpc
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]
(Int -> ReadS Vpc)
-> ReadS [Vpc] -> ReadPrec Vpc -> ReadPrec [Vpc] -> Read 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
(Int -> Vpc -> ShowS)
-> (Vpc -> String) -> ([Vpc] -> ShowS) -> Show Vpc
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. Vpc -> Rep Vpc x)
-> (forall x. Rep Vpc x -> Vpc) -> Generic Vpc
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' :: Maybe [Text] -> [Text] -> Vpc
Vpc'
    { $sel:securityGroups:Vpc' :: Maybe [Text]
securityGroups = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:subnets:Vpc' :: [Text]
subnets = [Text]
forall a. Monoid a => a
Prelude.mempty
    }

-- | The security groups for the connector.
vpc_securityGroups :: Lens.Lens' Vpc (Prelude.Maybe [Prelude.Text])
vpc_securityGroups :: (Maybe [Text] -> f (Maybe [Text])) -> Vpc -> f Vpc
vpc_securityGroups = (Vpc -> Maybe [Text])
-> (Vpc -> Maybe [Text] -> Vpc)
-> Lens Vpc Vpc (Maybe [Text]) (Maybe [Text])
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) ((Maybe [Text] -> f (Maybe [Text])) -> Vpc -> f Vpc)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> Vpc
-> f Vpc
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.
vpc_subnets :: Lens.Lens' Vpc [Prelude.Text]
vpc_subnets :: ([Text] -> f [Text]) -> Vpc -> f Vpc
vpc_subnets = (Vpc -> [Text])
-> (Vpc -> [Text] -> Vpc) -> Lens Vpc Vpc [Text] [Text]
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) (([Text] -> f [Text]) -> Vpc -> f Vpc)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> Vpc
-> f Vpc
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Text] -> f [Text]) -> [Text] -> f [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Prelude.Hashable Vpc

instance Prelude.NFData Vpc

instance Core.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
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"securityGroups" 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]
securityGroups,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"subnets" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [Text]
subnets)
          ]
      )