{-# 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.DirectoryService.Types.DirectoryConnectSettings
-- 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.DirectoryService.Types.DirectoryConnectSettings where

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

-- | Contains information for the ConnectDirectory operation when an AD
-- Connector directory is being created.
--
-- /See:/ 'newDirectoryConnectSettings' smart constructor.
data DirectoryConnectSettings = DirectoryConnectSettings'
  { -- | The identifier of the VPC in which the AD Connector is created.
    DirectoryConnectSettings -> Text
vpcId :: Prelude.Text,
    -- | A list of subnet identifiers in the VPC in which the AD Connector is
    -- created.
    DirectoryConnectSettings -> [Text]
subnetIds :: [Prelude.Text],
    -- | A list of one or more IP addresses of DNS servers or domain controllers
    -- in your self-managed directory.
    DirectoryConnectSettings -> [Text]
customerDnsIps :: [Prelude.Text],
    -- | The user name of an account in your self-managed directory that is used
    -- to connect to the directory. This account must have the following
    -- permissions:
    --
    -- -   Read users and groups
    --
    -- -   Create computer objects
    --
    -- -   Join computers to the domain
    DirectoryConnectSettings -> Text
customerUserName :: Prelude.Text
  }
  deriving (DirectoryConnectSettings -> DirectoryConnectSettings -> Bool
(DirectoryConnectSettings -> DirectoryConnectSettings -> Bool)
-> (DirectoryConnectSettings -> DirectoryConnectSettings -> Bool)
-> Eq DirectoryConnectSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DirectoryConnectSettings -> DirectoryConnectSettings -> Bool
$c/= :: DirectoryConnectSettings -> DirectoryConnectSettings -> Bool
== :: DirectoryConnectSettings -> DirectoryConnectSettings -> Bool
$c== :: DirectoryConnectSettings -> DirectoryConnectSettings -> Bool
Prelude.Eq, ReadPrec [DirectoryConnectSettings]
ReadPrec DirectoryConnectSettings
Int -> ReadS DirectoryConnectSettings
ReadS [DirectoryConnectSettings]
(Int -> ReadS DirectoryConnectSettings)
-> ReadS [DirectoryConnectSettings]
-> ReadPrec DirectoryConnectSettings
-> ReadPrec [DirectoryConnectSettings]
-> Read DirectoryConnectSettings
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DirectoryConnectSettings]
$creadListPrec :: ReadPrec [DirectoryConnectSettings]
readPrec :: ReadPrec DirectoryConnectSettings
$creadPrec :: ReadPrec DirectoryConnectSettings
readList :: ReadS [DirectoryConnectSettings]
$creadList :: ReadS [DirectoryConnectSettings]
readsPrec :: Int -> ReadS DirectoryConnectSettings
$creadsPrec :: Int -> ReadS DirectoryConnectSettings
Prelude.Read, Int -> DirectoryConnectSettings -> ShowS
[DirectoryConnectSettings] -> ShowS
DirectoryConnectSettings -> String
(Int -> DirectoryConnectSettings -> ShowS)
-> (DirectoryConnectSettings -> String)
-> ([DirectoryConnectSettings] -> ShowS)
-> Show DirectoryConnectSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DirectoryConnectSettings] -> ShowS
$cshowList :: [DirectoryConnectSettings] -> ShowS
show :: DirectoryConnectSettings -> String
$cshow :: DirectoryConnectSettings -> String
showsPrec :: Int -> DirectoryConnectSettings -> ShowS
$cshowsPrec :: Int -> DirectoryConnectSettings -> ShowS
Prelude.Show, (forall x.
 DirectoryConnectSettings -> Rep DirectoryConnectSettings x)
-> (forall x.
    Rep DirectoryConnectSettings x -> DirectoryConnectSettings)
-> Generic DirectoryConnectSettings
forall x.
Rep DirectoryConnectSettings x -> DirectoryConnectSettings
forall x.
DirectoryConnectSettings -> Rep DirectoryConnectSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DirectoryConnectSettings x -> DirectoryConnectSettings
$cfrom :: forall x.
DirectoryConnectSettings -> Rep DirectoryConnectSettings x
Prelude.Generic)

-- |
-- Create a value of 'DirectoryConnectSettings' 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:
--
-- 'vpcId', 'directoryConnectSettings_vpcId' - The identifier of the VPC in which the AD Connector is created.
--
-- 'subnetIds', 'directoryConnectSettings_subnetIds' - A list of subnet identifiers in the VPC in which the AD Connector is
-- created.
--
-- 'customerDnsIps', 'directoryConnectSettings_customerDnsIps' - A list of one or more IP addresses of DNS servers or domain controllers
-- in your self-managed directory.
--
-- 'customerUserName', 'directoryConnectSettings_customerUserName' - The user name of an account in your self-managed directory that is used
-- to connect to the directory. This account must have the following
-- permissions:
--
-- -   Read users and groups
--
-- -   Create computer objects
--
-- -   Join computers to the domain
newDirectoryConnectSettings ::
  -- | 'vpcId'
  Prelude.Text ->
  -- | 'customerUserName'
  Prelude.Text ->
  DirectoryConnectSettings
newDirectoryConnectSettings :: Text -> Text -> DirectoryConnectSettings
newDirectoryConnectSettings
  Text
pVpcId_
  Text
pCustomerUserName_ =
    DirectoryConnectSettings' :: Text -> [Text] -> [Text] -> Text -> DirectoryConnectSettings
DirectoryConnectSettings'
      { $sel:vpcId:DirectoryConnectSettings' :: Text
vpcId = Text
pVpcId_,
        $sel:subnetIds:DirectoryConnectSettings' :: [Text]
subnetIds = [Text]
forall a. Monoid a => a
Prelude.mempty,
        $sel:customerDnsIps:DirectoryConnectSettings' :: [Text]
customerDnsIps = [Text]
forall a. Monoid a => a
Prelude.mempty,
        $sel:customerUserName:DirectoryConnectSettings' :: Text
customerUserName = Text
pCustomerUserName_
      }

-- | The identifier of the VPC in which the AD Connector is created.
directoryConnectSettings_vpcId :: Lens.Lens' DirectoryConnectSettings Prelude.Text
directoryConnectSettings_vpcId :: (Text -> f Text)
-> DirectoryConnectSettings -> f DirectoryConnectSettings
directoryConnectSettings_vpcId = (DirectoryConnectSettings -> Text)
-> (DirectoryConnectSettings -> Text -> DirectoryConnectSettings)
-> Lens DirectoryConnectSettings DirectoryConnectSettings Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DirectoryConnectSettings' {Text
vpcId :: Text
$sel:vpcId:DirectoryConnectSettings' :: DirectoryConnectSettings -> Text
vpcId} -> Text
vpcId) (\s :: DirectoryConnectSettings
s@DirectoryConnectSettings' {} Text
a -> DirectoryConnectSettings
s {$sel:vpcId:DirectoryConnectSettings' :: Text
vpcId = Text
a} :: DirectoryConnectSettings)

-- | A list of subnet identifiers in the VPC in which the AD Connector is
-- created.
directoryConnectSettings_subnetIds :: Lens.Lens' DirectoryConnectSettings [Prelude.Text]
directoryConnectSettings_subnetIds :: ([Text] -> f [Text])
-> DirectoryConnectSettings -> f DirectoryConnectSettings
directoryConnectSettings_subnetIds = (DirectoryConnectSettings -> [Text])
-> (DirectoryConnectSettings -> [Text] -> DirectoryConnectSettings)
-> Lens
     DirectoryConnectSettings DirectoryConnectSettings [Text] [Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DirectoryConnectSettings' {[Text]
subnetIds :: [Text]
$sel:subnetIds:DirectoryConnectSettings' :: DirectoryConnectSettings -> [Text]
subnetIds} -> [Text]
subnetIds) (\s :: DirectoryConnectSettings
s@DirectoryConnectSettings' {} [Text]
a -> DirectoryConnectSettings
s {$sel:subnetIds:DirectoryConnectSettings' :: [Text]
subnetIds = [Text]
a} :: DirectoryConnectSettings) (([Text] -> f [Text])
 -> DirectoryConnectSettings -> f DirectoryConnectSettings)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> DirectoryConnectSettings
-> f DirectoryConnectSettings
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Text] -> f [Text]) -> [Text] -> f [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A list of one or more IP addresses of DNS servers or domain controllers
-- in your self-managed directory.
directoryConnectSettings_customerDnsIps :: Lens.Lens' DirectoryConnectSettings [Prelude.Text]
directoryConnectSettings_customerDnsIps :: ([Text] -> f [Text])
-> DirectoryConnectSettings -> f DirectoryConnectSettings
directoryConnectSettings_customerDnsIps = (DirectoryConnectSettings -> [Text])
-> (DirectoryConnectSettings -> [Text] -> DirectoryConnectSettings)
-> Lens
     DirectoryConnectSettings DirectoryConnectSettings [Text] [Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DirectoryConnectSettings' {[Text]
customerDnsIps :: [Text]
$sel:customerDnsIps:DirectoryConnectSettings' :: DirectoryConnectSettings -> [Text]
customerDnsIps} -> [Text]
customerDnsIps) (\s :: DirectoryConnectSettings
s@DirectoryConnectSettings' {} [Text]
a -> DirectoryConnectSettings
s {$sel:customerDnsIps:DirectoryConnectSettings' :: [Text]
customerDnsIps = [Text]
a} :: DirectoryConnectSettings) (([Text] -> f [Text])
 -> DirectoryConnectSettings -> f DirectoryConnectSettings)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> DirectoryConnectSettings
-> f DirectoryConnectSettings
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Text] -> f [Text]) -> [Text] -> f [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The user name of an account in your self-managed directory that is used
-- to connect to the directory. This account must have the following
-- permissions:
--
-- -   Read users and groups
--
-- -   Create computer objects
--
-- -   Join computers to the domain
directoryConnectSettings_customerUserName :: Lens.Lens' DirectoryConnectSettings Prelude.Text
directoryConnectSettings_customerUserName :: (Text -> f Text)
-> DirectoryConnectSettings -> f DirectoryConnectSettings
directoryConnectSettings_customerUserName = (DirectoryConnectSettings -> Text)
-> (DirectoryConnectSettings -> Text -> DirectoryConnectSettings)
-> Lens DirectoryConnectSettings DirectoryConnectSettings Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DirectoryConnectSettings' {Text
customerUserName :: Text
$sel:customerUserName:DirectoryConnectSettings' :: DirectoryConnectSettings -> Text
customerUserName} -> Text
customerUserName) (\s :: DirectoryConnectSettings
s@DirectoryConnectSettings' {} Text
a -> DirectoryConnectSettings
s {$sel:customerUserName:DirectoryConnectSettings' :: Text
customerUserName = Text
a} :: DirectoryConnectSettings)

instance Prelude.Hashable DirectoryConnectSettings

instance Prelude.NFData DirectoryConnectSettings

instance Core.ToJSON DirectoryConnectSettings where
  toJSON :: DirectoryConnectSettings -> Value
toJSON DirectoryConnectSettings' {[Text]
Text
customerUserName :: Text
customerDnsIps :: [Text]
subnetIds :: [Text]
vpcId :: Text
$sel:customerUserName:DirectoryConnectSettings' :: DirectoryConnectSettings -> Text
$sel:customerDnsIps:DirectoryConnectSettings' :: DirectoryConnectSettings -> [Text]
$sel:subnetIds:DirectoryConnectSettings' :: DirectoryConnectSettings -> [Text]
$sel:vpcId:DirectoryConnectSettings' :: DirectoryConnectSettings -> 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
"VpcId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
vpcId),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"SubnetIds" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [Text]
subnetIds),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"CustomerDnsIps" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [Text]
customerDnsIps),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"CustomerUserName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
customerUserName)
          ]
      )