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

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

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

-- |
-- Create a value of 'VpcConfigurationUpdate' 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:
--
-- 'subnetIdUpdates', 'vpcConfigurationUpdate_subnetIdUpdates' - Describes updates to the array of
-- <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_Subnet.html Subnet>
-- IDs used by the VPC configuration.
--
-- 'securityGroupIdUpdates', 'vpcConfigurationUpdate_securityGroupIdUpdates' - Describes updates to the array of
-- <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_SecurityGroup.html SecurityGroup>
-- IDs used by the VPC configuration.
--
-- 'vpcConfigurationId', 'vpcConfigurationUpdate_vpcConfigurationId' - Describes an update to the ID of the VPC configuration.
newVpcConfigurationUpdate ::
  -- | 'vpcConfigurationId'
  Prelude.Text ->
  VpcConfigurationUpdate
newVpcConfigurationUpdate :: Text -> VpcConfigurationUpdate
newVpcConfigurationUpdate Text
pVpcConfigurationId_ =
  VpcConfigurationUpdate' :: Maybe (NonEmpty Text)
-> Maybe (NonEmpty Text) -> Text -> VpcConfigurationUpdate
VpcConfigurationUpdate'
    { $sel:subnetIdUpdates:VpcConfigurationUpdate' :: Maybe (NonEmpty Text)
subnetIdUpdates =
        Maybe (NonEmpty Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:securityGroupIdUpdates:VpcConfigurationUpdate' :: Maybe (NonEmpty Text)
securityGroupIdUpdates = Maybe (NonEmpty Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:vpcConfigurationId:VpcConfigurationUpdate' :: Text
vpcConfigurationId = Text
pVpcConfigurationId_
    }

-- | Describes updates to the array of
-- <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_Subnet.html Subnet>
-- IDs used by the VPC configuration.
vpcConfigurationUpdate_subnetIdUpdates :: Lens.Lens' VpcConfigurationUpdate (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
vpcConfigurationUpdate_subnetIdUpdates :: (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> VpcConfigurationUpdate -> f VpcConfigurationUpdate
vpcConfigurationUpdate_subnetIdUpdates = (VpcConfigurationUpdate -> Maybe (NonEmpty Text))
-> (VpcConfigurationUpdate
    -> Maybe (NonEmpty Text) -> VpcConfigurationUpdate)
-> Lens
     VpcConfigurationUpdate
     VpcConfigurationUpdate
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpcConfigurationUpdate' {Maybe (NonEmpty Text)
subnetIdUpdates :: Maybe (NonEmpty Text)
$sel:subnetIdUpdates:VpcConfigurationUpdate' :: VpcConfigurationUpdate -> Maybe (NonEmpty Text)
subnetIdUpdates} -> Maybe (NonEmpty Text)
subnetIdUpdates) (\s :: VpcConfigurationUpdate
s@VpcConfigurationUpdate' {} Maybe (NonEmpty Text)
a -> VpcConfigurationUpdate
s {$sel:subnetIdUpdates:VpcConfigurationUpdate' :: Maybe (NonEmpty Text)
subnetIdUpdates = Maybe (NonEmpty Text)
a} :: VpcConfigurationUpdate) ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
 -> VpcConfigurationUpdate -> f VpcConfigurationUpdate)
-> ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
    -> Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> VpcConfigurationUpdate
-> f VpcConfigurationUpdate
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
-> Iso
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty 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
  (NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Describes updates to the array of
-- <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_SecurityGroup.html SecurityGroup>
-- IDs used by the VPC configuration.
vpcConfigurationUpdate_securityGroupIdUpdates :: Lens.Lens' VpcConfigurationUpdate (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
vpcConfigurationUpdate_securityGroupIdUpdates :: (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> VpcConfigurationUpdate -> f VpcConfigurationUpdate
vpcConfigurationUpdate_securityGroupIdUpdates = (VpcConfigurationUpdate -> Maybe (NonEmpty Text))
-> (VpcConfigurationUpdate
    -> Maybe (NonEmpty Text) -> VpcConfigurationUpdate)
-> Lens
     VpcConfigurationUpdate
     VpcConfigurationUpdate
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpcConfigurationUpdate' {Maybe (NonEmpty Text)
securityGroupIdUpdates :: Maybe (NonEmpty Text)
$sel:securityGroupIdUpdates:VpcConfigurationUpdate' :: VpcConfigurationUpdate -> Maybe (NonEmpty Text)
securityGroupIdUpdates} -> Maybe (NonEmpty Text)
securityGroupIdUpdates) (\s :: VpcConfigurationUpdate
s@VpcConfigurationUpdate' {} Maybe (NonEmpty Text)
a -> VpcConfigurationUpdate
s {$sel:securityGroupIdUpdates:VpcConfigurationUpdate' :: Maybe (NonEmpty Text)
securityGroupIdUpdates = Maybe (NonEmpty Text)
a} :: VpcConfigurationUpdate) ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
 -> VpcConfigurationUpdate -> f VpcConfigurationUpdate)
-> ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
    -> Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> VpcConfigurationUpdate
-> f VpcConfigurationUpdate
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
-> Iso
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty 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
  (NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Describes an update to the ID of the VPC configuration.
vpcConfigurationUpdate_vpcConfigurationId :: Lens.Lens' VpcConfigurationUpdate Prelude.Text
vpcConfigurationUpdate_vpcConfigurationId :: (Text -> f Text)
-> VpcConfigurationUpdate -> f VpcConfigurationUpdate
vpcConfigurationUpdate_vpcConfigurationId = (VpcConfigurationUpdate -> Text)
-> (VpcConfigurationUpdate -> Text -> VpcConfigurationUpdate)
-> Lens VpcConfigurationUpdate VpcConfigurationUpdate Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpcConfigurationUpdate' {Text
vpcConfigurationId :: Text
$sel:vpcConfigurationId:VpcConfigurationUpdate' :: VpcConfigurationUpdate -> Text
vpcConfigurationId} -> Text
vpcConfigurationId) (\s :: VpcConfigurationUpdate
s@VpcConfigurationUpdate' {} Text
a -> VpcConfigurationUpdate
s {$sel:vpcConfigurationId:VpcConfigurationUpdate' :: Text
vpcConfigurationId = Text
a} :: VpcConfigurationUpdate)

instance Prelude.Hashable VpcConfigurationUpdate

instance Prelude.NFData VpcConfigurationUpdate

instance Core.ToJSON VpcConfigurationUpdate where
  toJSON :: VpcConfigurationUpdate -> Value
toJSON VpcConfigurationUpdate' {Maybe (NonEmpty Text)
Text
vpcConfigurationId :: Text
securityGroupIdUpdates :: Maybe (NonEmpty Text)
subnetIdUpdates :: Maybe (NonEmpty Text)
$sel:vpcConfigurationId:VpcConfigurationUpdate' :: VpcConfigurationUpdate -> Text
$sel:securityGroupIdUpdates:VpcConfigurationUpdate' :: VpcConfigurationUpdate -> Maybe (NonEmpty Text)
$sel:subnetIdUpdates:VpcConfigurationUpdate' :: VpcConfigurationUpdate -> Maybe (NonEmpty Text)
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"SubnetIdUpdates" Text -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (NonEmpty Text -> Pair) -> Maybe (NonEmpty Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty Text)
subnetIdUpdates,
            (Text
"SecurityGroupIdUpdates" Text -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (NonEmpty Text -> Pair) -> Maybe (NonEmpty Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty Text)
securityGroupIdUpdates,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"VpcConfigurationId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
vpcConfigurationId)
          ]
      )