{-# 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.KinesisAnalyticsV2.Types.VpcConfigurationDescription
-- 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.KinesisAnalyticsV2.Types.VpcConfigurationDescription where

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

-- | Describes the parameters of a VPC used by the application.
--
-- /See:/ 'newVpcConfigurationDescription' smart constructor.
data VpcConfigurationDescription = VpcConfigurationDescription'
  { -- | The ID of the VPC configuration.
    VpcConfigurationDescription -> Text
vpcConfigurationId :: Prelude.Text,
    -- | The ID of the associated VPC.
    VpcConfigurationDescription -> Text
vpcId :: Prelude.Text,
    -- | The array of
    -- <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_Subnet.html Subnet>
    -- IDs used by the VPC configuration.
    VpcConfigurationDescription -> NonEmpty Text
subnetIds :: Prelude.NonEmpty Prelude.Text,
    -- | The array of
    -- <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_SecurityGroup.html SecurityGroup>
    -- IDs used by the VPC configuration.
    VpcConfigurationDescription -> NonEmpty Text
securityGroupIds :: Prelude.NonEmpty Prelude.Text
  }
  deriving (VpcConfigurationDescription -> VpcConfigurationDescription -> Bool
(VpcConfigurationDescription
 -> VpcConfigurationDescription -> Bool)
-> (VpcConfigurationDescription
    -> VpcConfigurationDescription -> Bool)
-> Eq VpcConfigurationDescription
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VpcConfigurationDescription -> VpcConfigurationDescription -> Bool
$c/= :: VpcConfigurationDescription -> VpcConfigurationDescription -> Bool
== :: VpcConfigurationDescription -> VpcConfigurationDescription -> Bool
$c== :: VpcConfigurationDescription -> VpcConfigurationDescription -> Bool
Prelude.Eq, ReadPrec [VpcConfigurationDescription]
ReadPrec VpcConfigurationDescription
Int -> ReadS VpcConfigurationDescription
ReadS [VpcConfigurationDescription]
(Int -> ReadS VpcConfigurationDescription)
-> ReadS [VpcConfigurationDescription]
-> ReadPrec VpcConfigurationDescription
-> ReadPrec [VpcConfigurationDescription]
-> Read VpcConfigurationDescription
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [VpcConfigurationDescription]
$creadListPrec :: ReadPrec [VpcConfigurationDescription]
readPrec :: ReadPrec VpcConfigurationDescription
$creadPrec :: ReadPrec VpcConfigurationDescription
readList :: ReadS [VpcConfigurationDescription]
$creadList :: ReadS [VpcConfigurationDescription]
readsPrec :: Int -> ReadS VpcConfigurationDescription
$creadsPrec :: Int -> ReadS VpcConfigurationDescription
Prelude.Read, Int -> VpcConfigurationDescription -> ShowS
[VpcConfigurationDescription] -> ShowS
VpcConfigurationDescription -> String
(Int -> VpcConfigurationDescription -> ShowS)
-> (VpcConfigurationDescription -> String)
-> ([VpcConfigurationDescription] -> ShowS)
-> Show VpcConfigurationDescription
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VpcConfigurationDescription] -> ShowS
$cshowList :: [VpcConfigurationDescription] -> ShowS
show :: VpcConfigurationDescription -> String
$cshow :: VpcConfigurationDescription -> String
showsPrec :: Int -> VpcConfigurationDescription -> ShowS
$cshowsPrec :: Int -> VpcConfigurationDescription -> ShowS
Prelude.Show, (forall x.
 VpcConfigurationDescription -> Rep VpcConfigurationDescription x)
-> (forall x.
    Rep VpcConfigurationDescription x -> VpcConfigurationDescription)
-> Generic VpcConfigurationDescription
forall x.
Rep VpcConfigurationDescription x -> VpcConfigurationDescription
forall x.
VpcConfigurationDescription -> Rep VpcConfigurationDescription x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep VpcConfigurationDescription x -> VpcConfigurationDescription
$cfrom :: forall x.
VpcConfigurationDescription -> Rep VpcConfigurationDescription x
Prelude.Generic)

-- |
-- Create a value of 'VpcConfigurationDescription' 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:
--
-- 'vpcConfigurationId', 'vpcConfigurationDescription_vpcConfigurationId' - The ID of the VPC configuration.
--
-- 'vpcId', 'vpcConfigurationDescription_vpcId' - The ID of the associated VPC.
--
-- 'subnetIds', 'vpcConfigurationDescription_subnetIds' - The array of
-- <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_Subnet.html Subnet>
-- IDs used by the VPC configuration.
--
-- 'securityGroupIds', 'vpcConfigurationDescription_securityGroupIds' - The array of
-- <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_SecurityGroup.html SecurityGroup>
-- IDs used by the VPC configuration.
newVpcConfigurationDescription ::
  -- | 'vpcConfigurationId'
  Prelude.Text ->
  -- | 'vpcId'
  Prelude.Text ->
  -- | 'subnetIds'
  Prelude.NonEmpty Prelude.Text ->
  -- | 'securityGroupIds'
  Prelude.NonEmpty Prelude.Text ->
  VpcConfigurationDescription
newVpcConfigurationDescription :: Text
-> Text
-> NonEmpty Text
-> NonEmpty Text
-> VpcConfigurationDescription
newVpcConfigurationDescription
  Text
pVpcConfigurationId_
  Text
pVpcId_
  NonEmpty Text
pSubnetIds_
  NonEmpty Text
pSecurityGroupIds_ =
    VpcConfigurationDescription' :: Text
-> Text
-> NonEmpty Text
-> NonEmpty Text
-> VpcConfigurationDescription
VpcConfigurationDescription'
      { $sel:vpcConfigurationId:VpcConfigurationDescription' :: Text
vpcConfigurationId =
          Text
pVpcConfigurationId_,
        $sel:vpcId:VpcConfigurationDescription' :: Text
vpcId = Text
pVpcId_,
        $sel:subnetIds:VpcConfigurationDescription' :: NonEmpty Text
subnetIds = Tagged (NonEmpty Text) (Identity (NonEmpty Text))
-> Tagged (NonEmpty Text) (Identity (NonEmpty Text))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged (NonEmpty Text) (Identity (NonEmpty Text))
 -> Tagged (NonEmpty Text) (Identity (NonEmpty Text)))
-> NonEmpty Text -> NonEmpty Text
forall t b. AReview t b -> b -> t
Lens.# NonEmpty Text
pSubnetIds_,
        $sel:securityGroupIds:VpcConfigurationDescription' :: NonEmpty Text
securityGroupIds =
          Tagged (NonEmpty Text) (Identity (NonEmpty Text))
-> Tagged (NonEmpty Text) (Identity (NonEmpty Text))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged (NonEmpty Text) (Identity (NonEmpty Text))
 -> Tagged (NonEmpty Text) (Identity (NonEmpty Text)))
-> NonEmpty Text -> NonEmpty Text
forall t b. AReview t b -> b -> t
Lens.# NonEmpty Text
pSecurityGroupIds_
      }

-- | The ID of the VPC configuration.
vpcConfigurationDescription_vpcConfigurationId :: Lens.Lens' VpcConfigurationDescription Prelude.Text
vpcConfigurationDescription_vpcConfigurationId :: (Text -> f Text)
-> VpcConfigurationDescription -> f VpcConfigurationDescription
vpcConfigurationDescription_vpcConfigurationId = (VpcConfigurationDescription -> Text)
-> (VpcConfigurationDescription
    -> Text -> VpcConfigurationDescription)
-> Lens
     VpcConfigurationDescription VpcConfigurationDescription Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpcConfigurationDescription' {Text
vpcConfigurationId :: Text
$sel:vpcConfigurationId:VpcConfigurationDescription' :: VpcConfigurationDescription -> Text
vpcConfigurationId} -> Text
vpcConfigurationId) (\s :: VpcConfigurationDescription
s@VpcConfigurationDescription' {} Text
a -> VpcConfigurationDescription
s {$sel:vpcConfigurationId:VpcConfigurationDescription' :: Text
vpcConfigurationId = Text
a} :: VpcConfigurationDescription)

-- | The ID of the associated VPC.
vpcConfigurationDescription_vpcId :: Lens.Lens' VpcConfigurationDescription Prelude.Text
vpcConfigurationDescription_vpcId :: (Text -> f Text)
-> VpcConfigurationDescription -> f VpcConfigurationDescription
vpcConfigurationDescription_vpcId = (VpcConfigurationDescription -> Text)
-> (VpcConfigurationDescription
    -> Text -> VpcConfigurationDescription)
-> Lens
     VpcConfigurationDescription VpcConfigurationDescription Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpcConfigurationDescription' {Text
vpcId :: Text
$sel:vpcId:VpcConfigurationDescription' :: VpcConfigurationDescription -> Text
vpcId} -> Text
vpcId) (\s :: VpcConfigurationDescription
s@VpcConfigurationDescription' {} Text
a -> VpcConfigurationDescription
s {$sel:vpcId:VpcConfigurationDescription' :: Text
vpcId = Text
a} :: VpcConfigurationDescription)

-- | The array of
-- <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_Subnet.html Subnet>
-- IDs used by the VPC configuration.
vpcConfigurationDescription_subnetIds :: Lens.Lens' VpcConfigurationDescription (Prelude.NonEmpty Prelude.Text)
vpcConfigurationDescription_subnetIds :: (NonEmpty Text -> f (NonEmpty Text))
-> VpcConfigurationDescription -> f VpcConfigurationDescription
vpcConfigurationDescription_subnetIds = (VpcConfigurationDescription -> NonEmpty Text)
-> (VpcConfigurationDescription
    -> NonEmpty Text -> VpcConfigurationDescription)
-> Lens
     VpcConfigurationDescription
     VpcConfigurationDescription
     (NonEmpty Text)
     (NonEmpty Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpcConfigurationDescription' {NonEmpty Text
subnetIds :: NonEmpty Text
$sel:subnetIds:VpcConfigurationDescription' :: VpcConfigurationDescription -> NonEmpty Text
subnetIds} -> NonEmpty Text
subnetIds) (\s :: VpcConfigurationDescription
s@VpcConfigurationDescription' {} NonEmpty Text
a -> VpcConfigurationDescription
s {$sel:subnetIds:VpcConfigurationDescription' :: NonEmpty Text
subnetIds = NonEmpty Text
a} :: VpcConfigurationDescription) ((NonEmpty Text -> f (NonEmpty Text))
 -> VpcConfigurationDescription -> f VpcConfigurationDescription)
-> ((NonEmpty Text -> f (NonEmpty Text))
    -> NonEmpty Text -> f (NonEmpty Text))
-> (NonEmpty Text -> f (NonEmpty Text))
-> VpcConfigurationDescription
-> f VpcConfigurationDescription
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty Text -> f (NonEmpty Text))
-> NonEmpty Text -> f (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The array of
-- <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_SecurityGroup.html SecurityGroup>
-- IDs used by the VPC configuration.
vpcConfigurationDescription_securityGroupIds :: Lens.Lens' VpcConfigurationDescription (Prelude.NonEmpty Prelude.Text)
vpcConfigurationDescription_securityGroupIds :: (NonEmpty Text -> f (NonEmpty Text))
-> VpcConfigurationDescription -> f VpcConfigurationDescription
vpcConfigurationDescription_securityGroupIds = (VpcConfigurationDescription -> NonEmpty Text)
-> (VpcConfigurationDescription
    -> NonEmpty Text -> VpcConfigurationDescription)
-> Lens
     VpcConfigurationDescription
     VpcConfigurationDescription
     (NonEmpty Text)
     (NonEmpty Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpcConfigurationDescription' {NonEmpty Text
securityGroupIds :: NonEmpty Text
$sel:securityGroupIds:VpcConfigurationDescription' :: VpcConfigurationDescription -> NonEmpty Text
securityGroupIds} -> NonEmpty Text
securityGroupIds) (\s :: VpcConfigurationDescription
s@VpcConfigurationDescription' {} NonEmpty Text
a -> VpcConfigurationDescription
s {$sel:securityGroupIds:VpcConfigurationDescription' :: NonEmpty Text
securityGroupIds = NonEmpty Text
a} :: VpcConfigurationDescription) ((NonEmpty Text -> f (NonEmpty Text))
 -> VpcConfigurationDescription -> f VpcConfigurationDescription)
-> ((NonEmpty Text -> f (NonEmpty Text))
    -> NonEmpty Text -> f (NonEmpty Text))
-> (NonEmpty Text -> f (NonEmpty Text))
-> VpcConfigurationDescription
-> f VpcConfigurationDescription
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty Text -> f (NonEmpty Text))
-> NonEmpty Text -> f (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON VpcConfigurationDescription where
  parseJSON :: Value -> Parser VpcConfigurationDescription
parseJSON =
    String
-> (Object -> Parser VpcConfigurationDescription)
-> Value
-> Parser VpcConfigurationDescription
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"VpcConfigurationDescription"
      ( \Object
x ->
          Text
-> Text
-> NonEmpty Text
-> NonEmpty Text
-> VpcConfigurationDescription
VpcConfigurationDescription'
            (Text
 -> Text
 -> NonEmpty Text
 -> NonEmpty Text
 -> VpcConfigurationDescription)
-> Parser Text
-> Parser
     (Text
      -> NonEmpty Text -> NonEmpty Text -> VpcConfigurationDescription)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"VpcConfigurationId")
            Parser
  (Text
   -> NonEmpty Text -> NonEmpty Text -> VpcConfigurationDescription)
-> Parser Text
-> Parser
     (NonEmpty Text -> NonEmpty Text -> VpcConfigurationDescription)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"VpcId")
            Parser
  (NonEmpty Text -> NonEmpty Text -> VpcConfigurationDescription)
-> Parser (NonEmpty Text)
-> Parser (NonEmpty Text -> VpcConfigurationDescription)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (NonEmpty Text)
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"SubnetIds")
            Parser (NonEmpty Text -> VpcConfigurationDescription)
-> Parser (NonEmpty Text) -> Parser VpcConfigurationDescription
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (NonEmpty Text)
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"SecurityGroupIds")
      )

instance Prelude.Hashable VpcConfigurationDescription

instance Prelude.NFData VpcConfigurationDescription