{-# 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.LicenseManagerUserSubscriptions.Types.UpdateSettings
-- 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.LicenseManagerUserSubscriptions.Types.UpdateSettings 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

-- | Updates the registered identity provider’s product related configuration
-- settings such as the subnets to provision VPC endpoints.
--
-- /See:/ 'newUpdateSettings' smart constructor.
data UpdateSettings = UpdateSettings'
  { -- | A security group ID that allows inbound TCP port 1688 communication
    -- between resources in your VPC and the VPC endpoints for activation
    -- servers.
    UpdateSettings -> Maybe Text
securityGroupId :: Prelude.Maybe Prelude.Text,
    -- | The ID of one or more subnets in which License Manager will create a VPC
    -- endpoint for products that require connectivity to activation servers.
    UpdateSettings -> [Text]
addSubnets :: [Prelude.Text],
    -- | The ID of one or more subnets to remove.
    UpdateSettings -> [Text]
removeSubnets :: [Prelude.Text]
  }
  deriving (UpdateSettings -> UpdateSettings -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateSettings -> UpdateSettings -> Bool
$c/= :: UpdateSettings -> UpdateSettings -> Bool
== :: UpdateSettings -> UpdateSettings -> Bool
$c== :: UpdateSettings -> UpdateSettings -> Bool
Prelude.Eq, ReadPrec [UpdateSettings]
ReadPrec UpdateSettings
Int -> ReadS UpdateSettings
ReadS [UpdateSettings]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateSettings]
$creadListPrec :: ReadPrec [UpdateSettings]
readPrec :: ReadPrec UpdateSettings
$creadPrec :: ReadPrec UpdateSettings
readList :: ReadS [UpdateSettings]
$creadList :: ReadS [UpdateSettings]
readsPrec :: Int -> ReadS UpdateSettings
$creadsPrec :: Int -> ReadS UpdateSettings
Prelude.Read, Int -> UpdateSettings -> ShowS
[UpdateSettings] -> ShowS
UpdateSettings -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateSettings] -> ShowS
$cshowList :: [UpdateSettings] -> ShowS
show :: UpdateSettings -> String
$cshow :: UpdateSettings -> String
showsPrec :: Int -> UpdateSettings -> ShowS
$cshowsPrec :: Int -> UpdateSettings -> ShowS
Prelude.Show, forall x. Rep UpdateSettings x -> UpdateSettings
forall x. UpdateSettings -> Rep UpdateSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateSettings x -> UpdateSettings
$cfrom :: forall x. UpdateSettings -> Rep UpdateSettings x
Prelude.Generic)

-- |
-- Create a value of 'UpdateSettings' 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:
--
-- 'securityGroupId', 'updateSettings_securityGroupId' - A security group ID that allows inbound TCP port 1688 communication
-- between resources in your VPC and the VPC endpoints for activation
-- servers.
--
-- 'addSubnets', 'updateSettings_addSubnets' - The ID of one or more subnets in which License Manager will create a VPC
-- endpoint for products that require connectivity to activation servers.
--
-- 'removeSubnets', 'updateSettings_removeSubnets' - The ID of one or more subnets to remove.
newUpdateSettings ::
  UpdateSettings
newUpdateSettings :: UpdateSettings
newUpdateSettings =
  UpdateSettings'
    { $sel:securityGroupId:UpdateSettings' :: Maybe Text
securityGroupId = forall a. Maybe a
Prelude.Nothing,
      $sel:addSubnets:UpdateSettings' :: [Text]
addSubnets = forall a. Monoid a => a
Prelude.mempty,
      $sel:removeSubnets:UpdateSettings' :: [Text]
removeSubnets = forall a. Monoid a => a
Prelude.mempty
    }

-- | A security group ID that allows inbound TCP port 1688 communication
-- between resources in your VPC and the VPC endpoints for activation
-- servers.
updateSettings_securityGroupId :: Lens.Lens' UpdateSettings (Prelude.Maybe Prelude.Text)
updateSettings_securityGroupId :: Lens' UpdateSettings (Maybe Text)
updateSettings_securityGroupId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateSettings' {Maybe Text
securityGroupId :: Maybe Text
$sel:securityGroupId:UpdateSettings' :: UpdateSettings -> Maybe Text
securityGroupId} -> Maybe Text
securityGroupId) (\s :: UpdateSettings
s@UpdateSettings' {} Maybe Text
a -> UpdateSettings
s {$sel:securityGroupId:UpdateSettings' :: Maybe Text
securityGroupId = Maybe Text
a} :: UpdateSettings)

-- | The ID of one or more subnets in which License Manager will create a VPC
-- endpoint for products that require connectivity to activation servers.
updateSettings_addSubnets :: Lens.Lens' UpdateSettings [Prelude.Text]
updateSettings_addSubnets :: Lens' UpdateSettings [Text]
updateSettings_addSubnets = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateSettings' {[Text]
addSubnets :: [Text]
$sel:addSubnets:UpdateSettings' :: UpdateSettings -> [Text]
addSubnets} -> [Text]
addSubnets) (\s :: UpdateSettings
s@UpdateSettings' {} [Text]
a -> UpdateSettings
s {$sel:addSubnets:UpdateSettings' :: [Text]
addSubnets = [Text]
a} :: UpdateSettings) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The ID of one or more subnets to remove.
updateSettings_removeSubnets :: Lens.Lens' UpdateSettings [Prelude.Text]
updateSettings_removeSubnets :: Lens' UpdateSettings [Text]
updateSettings_removeSubnets = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateSettings' {[Text]
removeSubnets :: [Text]
$sel:removeSubnets:UpdateSettings' :: UpdateSettings -> [Text]
removeSubnets} -> [Text]
removeSubnets) (\s :: UpdateSettings
s@UpdateSettings' {} [Text]
a -> UpdateSettings
s {$sel:removeSubnets:UpdateSettings' :: [Text]
removeSubnets = [Text]
a} :: UpdateSettings) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Prelude.Hashable UpdateSettings where
  hashWithSalt :: Int -> UpdateSettings -> Int
hashWithSalt Int
_salt UpdateSettings' {[Text]
Maybe Text
removeSubnets :: [Text]
addSubnets :: [Text]
securityGroupId :: Maybe Text
$sel:removeSubnets:UpdateSettings' :: UpdateSettings -> [Text]
$sel:addSubnets:UpdateSettings' :: UpdateSettings -> [Text]
$sel:securityGroupId:UpdateSettings' :: UpdateSettings -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
securityGroupId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [Text]
addSubnets
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [Text]
removeSubnets

instance Prelude.NFData UpdateSettings where
  rnf :: UpdateSettings -> ()
rnf UpdateSettings' {[Text]
Maybe Text
removeSubnets :: [Text]
addSubnets :: [Text]
securityGroupId :: Maybe Text
$sel:removeSubnets:UpdateSettings' :: UpdateSettings -> [Text]
$sel:addSubnets:UpdateSettings' :: UpdateSettings -> [Text]
$sel:securityGroupId:UpdateSettings' :: UpdateSettings -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
securityGroupId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [Text]
addSubnets
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [Text]
removeSubnets

instance Data.ToJSON UpdateSettings where
  toJSON :: UpdateSettings -> Value
toJSON UpdateSettings' {[Text]
Maybe Text
removeSubnets :: [Text]
addSubnets :: [Text]
securityGroupId :: Maybe Text
$sel:removeSubnets:UpdateSettings' :: UpdateSettings -> [Text]
$sel:addSubnets:UpdateSettings' :: UpdateSettings -> [Text]
$sel:securityGroupId:UpdateSettings' :: UpdateSettings -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"SecurityGroupId" 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 Text
securityGroupId,
            forall a. a -> Maybe a
Prelude.Just (Key
"AddSubnets" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= [Text]
addSubnets),
            forall a. a -> Maybe a
Prelude.Just
              (Key
"RemoveSubnets" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= [Text]
removeSubnets)
          ]
      )