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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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 groups 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
(VpcConfigResponse -> VpcConfigResponse -> Bool)
-> (VpcConfigResponse -> VpcConfigResponse -> Bool)
-> Eq VpcConfigResponse
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]
(Int -> ReadS VpcConfigResponse)
-> ReadS [VpcConfigResponse]
-> ReadPrec VpcConfigResponse
-> ReadPrec [VpcConfigResponse]
-> Read 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
(Int -> VpcConfigResponse -> ShowS)
-> (VpcConfigResponse -> String)
-> ([VpcConfigResponse] -> ShowS)
-> Show VpcConfigResponse
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. VpcConfigResponse -> Rep VpcConfigResponse x)
-> (forall x. Rep VpcConfigResponse x -> VpcConfigResponse)
-> Generic VpcConfigResponse
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 groups IDs.
--
-- 'subnetIds', 'vpcConfigResponse_subnetIds' - A list of VPC subnet IDs.
--
-- 'vpcId', 'vpcConfigResponse_vpcId' - The ID of the VPC.
newVpcConfigResponse ::
  VpcConfigResponse
newVpcConfigResponse :: VpcConfigResponse
newVpcConfigResponse =
  VpcConfigResponse' :: Maybe [Text] -> Maybe [Text] -> Maybe Text -> VpcConfigResponse
VpcConfigResponse'
    { $sel:securityGroupIds:VpcConfigResponse' :: Maybe [Text]
securityGroupIds =
        Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:subnetIds:VpcConfigResponse' :: Maybe [Text]
subnetIds = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:vpcId:VpcConfigResponse' :: Maybe Text
vpcId = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | A list of VPC security groups IDs.
vpcConfigResponse_securityGroupIds :: Lens.Lens' VpcConfigResponse (Prelude.Maybe [Prelude.Text])
vpcConfigResponse_securityGroupIds :: (Maybe [Text] -> f (Maybe [Text]))
-> VpcConfigResponse -> f VpcConfigResponse
vpcConfigResponse_securityGroupIds = (VpcConfigResponse -> Maybe [Text])
-> (VpcConfigResponse -> Maybe [Text] -> VpcConfigResponse)
-> Lens
     VpcConfigResponse VpcConfigResponse (Maybe [Text]) (Maybe [Text])
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) ((Maybe [Text] -> f (Maybe [Text]))
 -> VpcConfigResponse -> f VpcConfigResponse)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> VpcConfigResponse
-> f VpcConfigResponse
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

-- | A list of VPC subnet IDs.
vpcConfigResponse_subnetIds :: Lens.Lens' VpcConfigResponse (Prelude.Maybe [Prelude.Text])
vpcConfigResponse_subnetIds :: (Maybe [Text] -> f (Maybe [Text]))
-> VpcConfigResponse -> f VpcConfigResponse
vpcConfigResponse_subnetIds = (VpcConfigResponse -> Maybe [Text])
-> (VpcConfigResponse -> Maybe [Text] -> VpcConfigResponse)
-> Lens
     VpcConfigResponse VpcConfigResponse (Maybe [Text]) (Maybe [Text])
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) ((Maybe [Text] -> f (Maybe [Text]))
 -> VpcConfigResponse -> f VpcConfigResponse)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> VpcConfigResponse
-> f VpcConfigResponse
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 ID of the VPC.
vpcConfigResponse_vpcId :: Lens.Lens' VpcConfigResponse (Prelude.Maybe Prelude.Text)
vpcConfigResponse_vpcId :: (Maybe Text -> f (Maybe Text))
-> VpcConfigResponse -> f VpcConfigResponse
vpcConfigResponse_vpcId = (VpcConfigResponse -> Maybe Text)
-> (VpcConfigResponse -> Maybe Text -> VpcConfigResponse)
-> Lens
     VpcConfigResponse VpcConfigResponse (Maybe Text) (Maybe Text)
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 Core.FromJSON VpcConfigResponse where
  parseJSON :: Value -> Parser VpcConfigResponse
parseJSON =
    String
-> (Object -> Parser VpcConfigResponse)
-> Value
-> Parser VpcConfigResponse
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"VpcConfigResponse"
      ( \Object
x ->
          Maybe [Text] -> Maybe [Text] -> Maybe Text -> VpcConfigResponse
VpcConfigResponse'
            (Maybe [Text] -> Maybe [Text] -> Maybe Text -> VpcConfigResponse)
-> Parser (Maybe [Text])
-> Parser (Maybe [Text] -> Maybe Text -> VpcConfigResponse)
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
"SecurityGroupIds"
                            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] -> Maybe Text -> VpcConfigResponse)
-> Parser (Maybe [Text])
-> Parser (Maybe Text -> VpcConfigResponse)
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
"SubnetIds" 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 -> VpcConfigResponse)
-> Parser (Maybe Text) -> Parser VpcConfigResponse
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
"VpcId")
      )

instance Prelude.Hashable VpcConfigResponse

instance Prelude.NFData VpcConfigResponse