{-# 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.MwAA.Types.UpdateNetworkConfigurationInput
-- 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.MwAA.Types.UpdateNetworkConfigurationInput where

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

-- | The VPC networking components used to secure and enable network traffic
-- between the AWS resources for your environment. To learn more, see
-- <https://docs.aws.amazon.com/mwaa/latest/userguide/networking-about.html About networking on Amazon MWAA>.
--
-- /See:/ 'newUpdateNetworkConfigurationInput' smart constructor.
data UpdateNetworkConfigurationInput = UpdateNetworkConfigurationInput'
  { -- | A list of 1 or more security group IDs. Accepts up to 5 security group
    -- IDs. A security group must be attached to the same VPC as the subnets.
    -- To learn more, see
    -- <https://docs.aws.amazon.com/mwaa/latest/userguide/vpc-security.html Security in your VPC on Amazon MWAA>.
    UpdateNetworkConfigurationInput -> NonEmpty Text
securityGroupIds :: Prelude.NonEmpty Prelude.Text
  }
  deriving (UpdateNetworkConfigurationInput
-> UpdateNetworkConfigurationInput -> Bool
(UpdateNetworkConfigurationInput
 -> UpdateNetworkConfigurationInput -> Bool)
-> (UpdateNetworkConfigurationInput
    -> UpdateNetworkConfigurationInput -> Bool)
-> Eq UpdateNetworkConfigurationInput
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateNetworkConfigurationInput
-> UpdateNetworkConfigurationInput -> Bool
$c/= :: UpdateNetworkConfigurationInput
-> UpdateNetworkConfigurationInput -> Bool
== :: UpdateNetworkConfigurationInput
-> UpdateNetworkConfigurationInput -> Bool
$c== :: UpdateNetworkConfigurationInput
-> UpdateNetworkConfigurationInput -> Bool
Prelude.Eq, ReadPrec [UpdateNetworkConfigurationInput]
ReadPrec UpdateNetworkConfigurationInput
Int -> ReadS UpdateNetworkConfigurationInput
ReadS [UpdateNetworkConfigurationInput]
(Int -> ReadS UpdateNetworkConfigurationInput)
-> ReadS [UpdateNetworkConfigurationInput]
-> ReadPrec UpdateNetworkConfigurationInput
-> ReadPrec [UpdateNetworkConfigurationInput]
-> Read UpdateNetworkConfigurationInput
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateNetworkConfigurationInput]
$creadListPrec :: ReadPrec [UpdateNetworkConfigurationInput]
readPrec :: ReadPrec UpdateNetworkConfigurationInput
$creadPrec :: ReadPrec UpdateNetworkConfigurationInput
readList :: ReadS [UpdateNetworkConfigurationInput]
$creadList :: ReadS [UpdateNetworkConfigurationInput]
readsPrec :: Int -> ReadS UpdateNetworkConfigurationInput
$creadsPrec :: Int -> ReadS UpdateNetworkConfigurationInput
Prelude.Read, Int -> UpdateNetworkConfigurationInput -> ShowS
[UpdateNetworkConfigurationInput] -> ShowS
UpdateNetworkConfigurationInput -> String
(Int -> UpdateNetworkConfigurationInput -> ShowS)
-> (UpdateNetworkConfigurationInput -> String)
-> ([UpdateNetworkConfigurationInput] -> ShowS)
-> Show UpdateNetworkConfigurationInput
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateNetworkConfigurationInput] -> ShowS
$cshowList :: [UpdateNetworkConfigurationInput] -> ShowS
show :: UpdateNetworkConfigurationInput -> String
$cshow :: UpdateNetworkConfigurationInput -> String
showsPrec :: Int -> UpdateNetworkConfigurationInput -> ShowS
$cshowsPrec :: Int -> UpdateNetworkConfigurationInput -> ShowS
Prelude.Show, (forall x.
 UpdateNetworkConfigurationInput
 -> Rep UpdateNetworkConfigurationInput x)
-> (forall x.
    Rep UpdateNetworkConfigurationInput x
    -> UpdateNetworkConfigurationInput)
-> Generic UpdateNetworkConfigurationInput
forall x.
Rep UpdateNetworkConfigurationInput x
-> UpdateNetworkConfigurationInput
forall x.
UpdateNetworkConfigurationInput
-> Rep UpdateNetworkConfigurationInput x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateNetworkConfigurationInput x
-> UpdateNetworkConfigurationInput
$cfrom :: forall x.
UpdateNetworkConfigurationInput
-> Rep UpdateNetworkConfigurationInput x
Prelude.Generic)

-- |
-- Create a value of 'UpdateNetworkConfigurationInput' 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', 'updateNetworkConfigurationInput_securityGroupIds' - A list of 1 or more security group IDs. Accepts up to 5 security group
-- IDs. A security group must be attached to the same VPC as the subnets.
-- To learn more, see
-- <https://docs.aws.amazon.com/mwaa/latest/userguide/vpc-security.html Security in your VPC on Amazon MWAA>.
newUpdateNetworkConfigurationInput ::
  -- | 'securityGroupIds'
  Prelude.NonEmpty Prelude.Text ->
  UpdateNetworkConfigurationInput
newUpdateNetworkConfigurationInput :: NonEmpty Text -> UpdateNetworkConfigurationInput
newUpdateNetworkConfigurationInput NonEmpty Text
pSecurityGroupIds_ =
  UpdateNetworkConfigurationInput' :: NonEmpty Text -> UpdateNetworkConfigurationInput
UpdateNetworkConfigurationInput'
    { $sel:securityGroupIds:UpdateNetworkConfigurationInput' :: 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_
    }

-- | A list of 1 or more security group IDs. Accepts up to 5 security group
-- IDs. A security group must be attached to the same VPC as the subnets.
-- To learn more, see
-- <https://docs.aws.amazon.com/mwaa/latest/userguide/vpc-security.html Security in your VPC on Amazon MWAA>.
updateNetworkConfigurationInput_securityGroupIds :: Lens.Lens' UpdateNetworkConfigurationInput (Prelude.NonEmpty Prelude.Text)
updateNetworkConfigurationInput_securityGroupIds :: (NonEmpty Text -> f (NonEmpty Text))
-> UpdateNetworkConfigurationInput
-> f UpdateNetworkConfigurationInput
updateNetworkConfigurationInput_securityGroupIds = (UpdateNetworkConfigurationInput -> NonEmpty Text)
-> (UpdateNetworkConfigurationInput
    -> NonEmpty Text -> UpdateNetworkConfigurationInput)
-> Lens
     UpdateNetworkConfigurationInput
     UpdateNetworkConfigurationInput
     (NonEmpty Text)
     (NonEmpty Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateNetworkConfigurationInput' {NonEmpty Text
securityGroupIds :: NonEmpty Text
$sel:securityGroupIds:UpdateNetworkConfigurationInput' :: UpdateNetworkConfigurationInput -> NonEmpty Text
securityGroupIds} -> NonEmpty Text
securityGroupIds) (\s :: UpdateNetworkConfigurationInput
s@UpdateNetworkConfigurationInput' {} NonEmpty Text
a -> UpdateNetworkConfigurationInput
s {$sel:securityGroupIds:UpdateNetworkConfigurationInput' :: NonEmpty Text
securityGroupIds = NonEmpty Text
a} :: UpdateNetworkConfigurationInput) ((NonEmpty Text -> f (NonEmpty Text))
 -> UpdateNetworkConfigurationInput
 -> f UpdateNetworkConfigurationInput)
-> ((NonEmpty Text -> f (NonEmpty Text))
    -> NonEmpty Text -> f (NonEmpty Text))
-> (NonEmpty Text -> f (NonEmpty Text))
-> UpdateNetworkConfigurationInput
-> f UpdateNetworkConfigurationInput
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
  Prelude.Hashable
    UpdateNetworkConfigurationInput

instance
  Prelude.NFData
    UpdateNetworkConfigurationInput

instance Core.ToJSON UpdateNetworkConfigurationInput where
  toJSON :: UpdateNetworkConfigurationInput -> Value
toJSON UpdateNetworkConfigurationInput' {NonEmpty Text
securityGroupIds :: NonEmpty Text
$sel:securityGroupIds:UpdateNetworkConfigurationInput' :: UpdateNetworkConfigurationInput -> NonEmpty Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"SecurityGroupIds" Text -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty Text
securityGroupIds)
          ]
      )