{-# 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.Lambda.Types.VpcConfigResponse
-- 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.Lambda.Types.VpcConfigResponse 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

-- | The VPC security groups and subnets that are attached to a Lambda
-- function.
--
-- /See:/ 'newVpcConfigResponse' smart constructor.
data VpcConfigResponse = VpcConfigResponse'
  { -- | A list of VPC security group IDs.
    VpcConfigResponse -> Maybe [Text]
securityGroupIds :: Prelude.Maybe [Prelude.Text],
    -- | A list of VPC subnet IDs.
    VpcConfigResponse -> Maybe [Text]
subnetIds :: Prelude.Maybe [Prelude.Text],
    -- | The ID of the VPC.
    VpcConfigResponse -> Maybe Text
vpcId :: Prelude.Maybe Prelude.Text
  }
  deriving (VpcConfigResponse -> VpcConfigResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VpcConfigResponse -> VpcConfigResponse -> Bool
$c/= :: VpcConfigResponse -> VpcConfigResponse -> Bool
== :: VpcConfigResponse -> VpcConfigResponse -> Bool
$c== :: VpcConfigResponse -> VpcConfigResponse -> Bool
Prelude.Eq, ReadPrec [VpcConfigResponse]
ReadPrec VpcConfigResponse
Int -> ReadS VpcConfigResponse
ReadS [VpcConfigResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [VpcConfigResponse]
$creadListPrec :: ReadPrec [VpcConfigResponse]
readPrec :: ReadPrec VpcConfigResponse
$creadPrec :: ReadPrec VpcConfigResponse
readList :: ReadS [VpcConfigResponse]
$creadList :: ReadS [VpcConfigResponse]
readsPrec :: Int -> ReadS VpcConfigResponse
$creadsPrec :: Int -> ReadS VpcConfigResponse
Prelude.Read, Int -> VpcConfigResponse -> ShowS
[VpcConfigResponse] -> ShowS
VpcConfigResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VpcConfigResponse] -> ShowS
$cshowList :: [VpcConfigResponse] -> ShowS
show :: VpcConfigResponse -> String
$cshow :: VpcConfigResponse -> String
showsPrec :: Int -> VpcConfigResponse -> ShowS
$cshowsPrec :: Int -> VpcConfigResponse -> ShowS
Prelude.Show, forall x. Rep VpcConfigResponse x -> VpcConfigResponse
forall x. VpcConfigResponse -> Rep VpcConfigResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep VpcConfigResponse x -> VpcConfigResponse
$cfrom :: forall x. VpcConfigResponse -> Rep VpcConfigResponse x
Prelude.Generic)

-- |
-- Create a value of 'VpcConfigResponse' 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:
--
-- 'securityGroupIds', 'vpcConfigResponse_securityGroupIds' - A list of VPC security group IDs.
--
-- 'subnetIds', 'vpcConfigResponse_subnetIds' - A list of VPC subnet IDs.
--
-- 'vpcId', 'vpcConfigResponse_vpcId' - The ID of the VPC.
newVpcConfigResponse ::
  VpcConfigResponse
newVpcConfigResponse :: VpcConfigResponse
newVpcConfigResponse =
  VpcConfigResponse'
    { $sel:securityGroupIds:VpcConfigResponse' :: Maybe [Text]
securityGroupIds =
        forall a. Maybe a
Prelude.Nothing,
      $sel:subnetIds:VpcConfigResponse' :: Maybe [Text]
subnetIds = forall a. Maybe a
Prelude.Nothing,
      $sel:vpcId:VpcConfigResponse' :: Maybe Text
vpcId = forall a. Maybe a
Prelude.Nothing
    }

-- | A list of VPC security group IDs.
vpcConfigResponse_securityGroupIds :: Lens.Lens' VpcConfigResponse (Prelude.Maybe [Prelude.Text])
vpcConfigResponse_securityGroupIds :: Lens' VpcConfigResponse (Maybe [Text])
vpcConfigResponse_securityGroupIds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpcConfigResponse' {Maybe [Text]
securityGroupIds :: Maybe [Text]
$sel:securityGroupIds:VpcConfigResponse' :: VpcConfigResponse -> Maybe [Text]
securityGroupIds} -> Maybe [Text]
securityGroupIds) (\s :: VpcConfigResponse
s@VpcConfigResponse' {} Maybe [Text]
a -> VpcConfigResponse
s {$sel:securityGroupIds:VpcConfigResponse' :: Maybe [Text]
securityGroupIds = Maybe [Text]
a} :: VpcConfigResponse) 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

-- | A list of VPC subnet IDs.
vpcConfigResponse_subnetIds :: Lens.Lens' VpcConfigResponse (Prelude.Maybe [Prelude.Text])
vpcConfigResponse_subnetIds :: Lens' VpcConfigResponse (Maybe [Text])
vpcConfigResponse_subnetIds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpcConfigResponse' {Maybe [Text]
subnetIds :: Maybe [Text]
$sel:subnetIds:VpcConfigResponse' :: VpcConfigResponse -> Maybe [Text]
subnetIds} -> Maybe [Text]
subnetIds) (\s :: VpcConfigResponse
s@VpcConfigResponse' {} Maybe [Text]
a -> VpcConfigResponse
s {$sel:subnetIds:VpcConfigResponse' :: Maybe [Text]
subnetIds = Maybe [Text]
a} :: VpcConfigResponse) 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 ID of the VPC.
vpcConfigResponse_vpcId :: Lens.Lens' VpcConfigResponse (Prelude.Maybe Prelude.Text)
vpcConfigResponse_vpcId :: Lens' VpcConfigResponse (Maybe Text)
vpcConfigResponse_vpcId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpcConfigResponse' {Maybe Text
vpcId :: Maybe Text
$sel:vpcId:VpcConfigResponse' :: VpcConfigResponse -> Maybe Text
vpcId} -> Maybe Text
vpcId) (\s :: VpcConfigResponse
s@VpcConfigResponse' {} Maybe Text
a -> VpcConfigResponse
s {$sel:vpcId:VpcConfigResponse' :: Maybe Text
vpcId = Maybe Text
a} :: VpcConfigResponse)

instance Data.FromJSON VpcConfigResponse where
  parseJSON :: Value -> Parser VpcConfigResponse
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"VpcConfigResponse"
      ( \Object
x ->
          Maybe [Text] -> Maybe [Text] -> Maybe Text -> VpcConfigResponse
VpcConfigResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x
                            forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"SecurityGroupIds"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"SubnetIds" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"VpcId")
      )

instance Prelude.Hashable VpcConfigResponse where
  hashWithSalt :: Int -> VpcConfigResponse -> Int
hashWithSalt Int
_salt VpcConfigResponse' {Maybe [Text]
Maybe Text
vpcId :: Maybe Text
subnetIds :: Maybe [Text]
securityGroupIds :: Maybe [Text]
$sel:vpcId:VpcConfigResponse' :: VpcConfigResponse -> Maybe Text
$sel:subnetIds:VpcConfigResponse' :: VpcConfigResponse -> Maybe [Text]
$sel:securityGroupIds:VpcConfigResponse' :: VpcConfigResponse -> Maybe [Text]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
securityGroupIds
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
subnetIds
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
vpcId

instance Prelude.NFData VpcConfigResponse where
  rnf :: VpcConfigResponse -> ()
rnf VpcConfigResponse' {Maybe [Text]
Maybe Text
vpcId :: Maybe Text
subnetIds :: Maybe [Text]
securityGroupIds :: Maybe [Text]
$sel:vpcId:VpcConfigResponse' :: VpcConfigResponse -> Maybe Text
$sel:subnetIds:VpcConfigResponse' :: VpcConfigResponse -> Maybe [Text]
$sel:securityGroupIds:VpcConfigResponse' :: VpcConfigResponse -> Maybe [Text]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
securityGroupIds
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
subnetIds
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
vpcId