{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.KinesisAnalyticsV2.Types.VpcConfigurationUpdate 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

-- | 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_SecurityGroup.html SecurityGroup>
    -- IDs used by the VPC configuration.
    VpcConfigurationUpdate -> Maybe (NonEmpty Text)
securityGroupIdUpdates :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text),
    -- | 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 an update to the ID of the VPC configuration.
    VpcConfigurationUpdate -> Text
vpcConfigurationId :: Prelude.Text
  }
  deriving (VpcConfigurationUpdate -> VpcConfigurationUpdate -> Bool
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]
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
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. 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:
--
-- '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.
--
-- '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.
--
-- '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'
    { $sel:securityGroupIdUpdates:VpcConfigurationUpdate' :: Maybe (NonEmpty Text)
securityGroupIdUpdates =
        forall a. Maybe a
Prelude.Nothing,
      $sel:subnetIdUpdates:VpcConfigurationUpdate' :: Maybe (NonEmpty Text)
subnetIdUpdates = 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_SecurityGroup.html SecurityGroup>
-- IDs used by the VPC configuration.
vpcConfigurationUpdate_securityGroupIdUpdates :: Lens.Lens' VpcConfigurationUpdate (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
vpcConfigurationUpdate_securityGroupIdUpdates :: Lens' VpcConfigurationUpdate (Maybe (NonEmpty Text))
vpcConfigurationUpdate_securityGroupIdUpdates = 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) 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

-- | 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 :: Lens' VpcConfigurationUpdate (Maybe (NonEmpty Text))
vpcConfigurationUpdate_subnetIdUpdates = 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) 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

-- | Describes an update to the ID of the VPC configuration.
vpcConfigurationUpdate_vpcConfigurationId :: Lens.Lens' VpcConfigurationUpdate Prelude.Text
vpcConfigurationUpdate_vpcConfigurationId :: Lens' VpcConfigurationUpdate Text
vpcConfigurationUpdate_vpcConfigurationId = 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 where
  hashWithSalt :: Int -> VpcConfigurationUpdate -> Int
hashWithSalt Int
_salt VpcConfigurationUpdate' {Maybe (NonEmpty Text)
Text
vpcConfigurationId :: Text
subnetIdUpdates :: Maybe (NonEmpty Text)
securityGroupIdUpdates :: Maybe (NonEmpty Text)
$sel:vpcConfigurationId:VpcConfigurationUpdate' :: VpcConfigurationUpdate -> Text
$sel:subnetIdUpdates:VpcConfigurationUpdate' :: VpcConfigurationUpdate -> Maybe (NonEmpty Text)
$sel:securityGroupIdUpdates:VpcConfigurationUpdate' :: VpcConfigurationUpdate -> Maybe (NonEmpty Text)
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty Text)
securityGroupIdUpdates
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty Text)
subnetIdUpdates
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
vpcConfigurationId

instance Prelude.NFData VpcConfigurationUpdate where
  rnf :: VpcConfigurationUpdate -> ()
rnf VpcConfigurationUpdate' {Maybe (NonEmpty Text)
Text
vpcConfigurationId :: Text
subnetIdUpdates :: Maybe (NonEmpty Text)
securityGroupIdUpdates :: Maybe (NonEmpty Text)
$sel:vpcConfigurationId:VpcConfigurationUpdate' :: VpcConfigurationUpdate -> Text
$sel:subnetIdUpdates:VpcConfigurationUpdate' :: VpcConfigurationUpdate -> Maybe (NonEmpty Text)
$sel:securityGroupIdUpdates:VpcConfigurationUpdate' :: VpcConfigurationUpdate -> Maybe (NonEmpty Text)
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty Text)
securityGroupIdUpdates
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty Text)
subnetIdUpdates
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
vpcConfigurationId

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