{-# 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.Nimble.Types.ActiveDirectoryConfiguration
-- 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.Nimble.Types.ActiveDirectoryConfiguration where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Nimble.Types.ActiveDirectoryComputerAttribute
import qualified Amazonka.Prelude as Prelude

-- | The configuration for a Directory Service for Microsoft Active Directory
-- studio resource.
--
-- /See:/ 'newActiveDirectoryConfiguration' smart constructor.
data ActiveDirectoryConfiguration = ActiveDirectoryConfiguration'
  { -- | A collection of custom attributes for an Active Directory computer.
    ActiveDirectoryConfiguration
-> Maybe (Sensitive [ActiveDirectoryComputerAttribute])
computerAttributes :: Prelude.Maybe (Data.Sensitive [ActiveDirectoryComputerAttribute]),
    -- | The directory ID of the Directory Service for Microsoft Active Directory
    -- to access using this studio component.
    ActiveDirectoryConfiguration -> Maybe Text
directoryId :: Prelude.Maybe Prelude.Text,
    -- | The distinguished name (DN) and organizational unit (OU) of an Active
    -- Directory computer.
    ActiveDirectoryConfiguration -> Maybe Text
organizationalUnitDistinguishedName :: Prelude.Maybe Prelude.Text
  }
  deriving (ActiveDirectoryConfiguration
-> ActiveDirectoryConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ActiveDirectoryConfiguration
-> ActiveDirectoryConfiguration -> Bool
$c/= :: ActiveDirectoryConfiguration
-> ActiveDirectoryConfiguration -> Bool
== :: ActiveDirectoryConfiguration
-> ActiveDirectoryConfiguration -> Bool
$c== :: ActiveDirectoryConfiguration
-> ActiveDirectoryConfiguration -> Bool
Prelude.Eq, Int -> ActiveDirectoryConfiguration -> ShowS
[ActiveDirectoryConfiguration] -> ShowS
ActiveDirectoryConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ActiveDirectoryConfiguration] -> ShowS
$cshowList :: [ActiveDirectoryConfiguration] -> ShowS
show :: ActiveDirectoryConfiguration -> String
$cshow :: ActiveDirectoryConfiguration -> String
showsPrec :: Int -> ActiveDirectoryConfiguration -> ShowS
$cshowsPrec :: Int -> ActiveDirectoryConfiguration -> ShowS
Prelude.Show, forall x.
Rep ActiveDirectoryConfiguration x -> ActiveDirectoryConfiguration
forall x.
ActiveDirectoryConfiguration -> Rep ActiveDirectoryConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ActiveDirectoryConfiguration x -> ActiveDirectoryConfiguration
$cfrom :: forall x.
ActiveDirectoryConfiguration -> Rep ActiveDirectoryConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'ActiveDirectoryConfiguration' 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:
--
-- 'computerAttributes', 'activeDirectoryConfiguration_computerAttributes' - A collection of custom attributes for an Active Directory computer.
--
-- 'directoryId', 'activeDirectoryConfiguration_directoryId' - The directory ID of the Directory Service for Microsoft Active Directory
-- to access using this studio component.
--
-- 'organizationalUnitDistinguishedName', 'activeDirectoryConfiguration_organizationalUnitDistinguishedName' - The distinguished name (DN) and organizational unit (OU) of an Active
-- Directory computer.
newActiveDirectoryConfiguration ::
  ActiveDirectoryConfiguration
newActiveDirectoryConfiguration :: ActiveDirectoryConfiguration
newActiveDirectoryConfiguration =
  ActiveDirectoryConfiguration'
    { $sel:computerAttributes:ActiveDirectoryConfiguration' :: Maybe (Sensitive [ActiveDirectoryComputerAttribute])
computerAttributes =
        forall a. Maybe a
Prelude.Nothing,
      $sel:directoryId:ActiveDirectoryConfiguration' :: Maybe Text
directoryId = forall a. Maybe a
Prelude.Nothing,
      $sel:organizationalUnitDistinguishedName:ActiveDirectoryConfiguration' :: Maybe Text
organizationalUnitDistinguishedName =
        forall a. Maybe a
Prelude.Nothing
    }

-- | A collection of custom attributes for an Active Directory computer.
activeDirectoryConfiguration_computerAttributes :: Lens.Lens' ActiveDirectoryConfiguration (Prelude.Maybe [ActiveDirectoryComputerAttribute])
activeDirectoryConfiguration_computerAttributes :: Lens'
  ActiveDirectoryConfiguration
  (Maybe [ActiveDirectoryComputerAttribute])
activeDirectoryConfiguration_computerAttributes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActiveDirectoryConfiguration' {Maybe (Sensitive [ActiveDirectoryComputerAttribute])
computerAttributes :: Maybe (Sensitive [ActiveDirectoryComputerAttribute])
$sel:computerAttributes:ActiveDirectoryConfiguration' :: ActiveDirectoryConfiguration
-> Maybe (Sensitive [ActiveDirectoryComputerAttribute])
computerAttributes} -> Maybe (Sensitive [ActiveDirectoryComputerAttribute])
computerAttributes) (\s :: ActiveDirectoryConfiguration
s@ActiveDirectoryConfiguration' {} Maybe (Sensitive [ActiveDirectoryComputerAttribute])
a -> ActiveDirectoryConfiguration
s {$sel:computerAttributes:ActiveDirectoryConfiguration' :: Maybe (Sensitive [ActiveDirectoryComputerAttribute])
computerAttributes = Maybe (Sensitive [ActiveDirectoryComputerAttribute])
a} :: ActiveDirectoryConfiguration) 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 a. Iso' (Sensitive a) a
Data._Sensitive 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 directory ID of the Directory Service for Microsoft Active Directory
-- to access using this studio component.
activeDirectoryConfiguration_directoryId :: Lens.Lens' ActiveDirectoryConfiguration (Prelude.Maybe Prelude.Text)
activeDirectoryConfiguration_directoryId :: Lens' ActiveDirectoryConfiguration (Maybe Text)
activeDirectoryConfiguration_directoryId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActiveDirectoryConfiguration' {Maybe Text
directoryId :: Maybe Text
$sel:directoryId:ActiveDirectoryConfiguration' :: ActiveDirectoryConfiguration -> Maybe Text
directoryId} -> Maybe Text
directoryId) (\s :: ActiveDirectoryConfiguration
s@ActiveDirectoryConfiguration' {} Maybe Text
a -> ActiveDirectoryConfiguration
s {$sel:directoryId:ActiveDirectoryConfiguration' :: Maybe Text
directoryId = Maybe Text
a} :: ActiveDirectoryConfiguration)

-- | The distinguished name (DN) and organizational unit (OU) of an Active
-- Directory computer.
activeDirectoryConfiguration_organizationalUnitDistinguishedName :: Lens.Lens' ActiveDirectoryConfiguration (Prelude.Maybe Prelude.Text)
activeDirectoryConfiguration_organizationalUnitDistinguishedName :: Lens' ActiveDirectoryConfiguration (Maybe Text)
activeDirectoryConfiguration_organizationalUnitDistinguishedName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActiveDirectoryConfiguration' {Maybe Text
organizationalUnitDistinguishedName :: Maybe Text
$sel:organizationalUnitDistinguishedName:ActiveDirectoryConfiguration' :: ActiveDirectoryConfiguration -> Maybe Text
organizationalUnitDistinguishedName} -> Maybe Text
organizationalUnitDistinguishedName) (\s :: ActiveDirectoryConfiguration
s@ActiveDirectoryConfiguration' {} Maybe Text
a -> ActiveDirectoryConfiguration
s {$sel:organizationalUnitDistinguishedName:ActiveDirectoryConfiguration' :: Maybe Text
organizationalUnitDistinguishedName = Maybe Text
a} :: ActiveDirectoryConfiguration)

instance Data.FromJSON ActiveDirectoryConfiguration where
  parseJSON :: Value -> Parser ActiveDirectoryConfiguration
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ActiveDirectoryConfiguration"
      ( \Object
x ->
          Maybe (Sensitive [ActiveDirectoryComputerAttribute])
-> Maybe Text -> Maybe Text -> ActiveDirectoryConfiguration
ActiveDirectoryConfiguration'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x
                            forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"computerAttributes"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"directoryId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"organizationalUnitDistinguishedName")
      )

instance
  Prelude.Hashable
    ActiveDirectoryConfiguration
  where
  hashWithSalt :: Int -> ActiveDirectoryConfiguration -> Int
hashWithSalt Int
_salt ActiveDirectoryConfiguration' {Maybe Text
Maybe (Sensitive [ActiveDirectoryComputerAttribute])
organizationalUnitDistinguishedName :: Maybe Text
directoryId :: Maybe Text
computerAttributes :: Maybe (Sensitive [ActiveDirectoryComputerAttribute])
$sel:organizationalUnitDistinguishedName:ActiveDirectoryConfiguration' :: ActiveDirectoryConfiguration -> Maybe Text
$sel:directoryId:ActiveDirectoryConfiguration' :: ActiveDirectoryConfiguration -> Maybe Text
$sel:computerAttributes:ActiveDirectoryConfiguration' :: ActiveDirectoryConfiguration
-> Maybe (Sensitive [ActiveDirectoryComputerAttribute])
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (Sensitive [ActiveDirectoryComputerAttribute])
computerAttributes
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
directoryId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
organizationalUnitDistinguishedName

instance Prelude.NFData ActiveDirectoryConfiguration where
  rnf :: ActiveDirectoryConfiguration -> ()
rnf ActiveDirectoryConfiguration' {Maybe Text
Maybe (Sensitive [ActiveDirectoryComputerAttribute])
organizationalUnitDistinguishedName :: Maybe Text
directoryId :: Maybe Text
computerAttributes :: Maybe (Sensitive [ActiveDirectoryComputerAttribute])
$sel:organizationalUnitDistinguishedName:ActiveDirectoryConfiguration' :: ActiveDirectoryConfiguration -> Maybe Text
$sel:directoryId:ActiveDirectoryConfiguration' :: ActiveDirectoryConfiguration -> Maybe Text
$sel:computerAttributes:ActiveDirectoryConfiguration' :: ActiveDirectoryConfiguration
-> Maybe (Sensitive [ActiveDirectoryComputerAttribute])
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe (Sensitive [ActiveDirectoryComputerAttribute])
computerAttributes
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
directoryId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
organizationalUnitDistinguishedName

instance Data.ToJSON ActiveDirectoryConfiguration where
  toJSON :: ActiveDirectoryConfiguration -> Value
toJSON ActiveDirectoryConfiguration' {Maybe Text
Maybe (Sensitive [ActiveDirectoryComputerAttribute])
organizationalUnitDistinguishedName :: Maybe Text
directoryId :: Maybe Text
computerAttributes :: Maybe (Sensitive [ActiveDirectoryComputerAttribute])
$sel:organizationalUnitDistinguishedName:ActiveDirectoryConfiguration' :: ActiveDirectoryConfiguration -> Maybe Text
$sel:directoryId:ActiveDirectoryConfiguration' :: ActiveDirectoryConfiguration -> Maybe Text
$sel:computerAttributes:ActiveDirectoryConfiguration' :: ActiveDirectoryConfiguration
-> Maybe (Sensitive [ActiveDirectoryComputerAttribute])
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"computerAttributes" 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 (Sensitive [ActiveDirectoryComputerAttribute])
computerAttributes,
            (Key
"directoryId" 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
directoryId,
            (Key
"organizationalUnitDistinguishedName" 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
organizationalUnitDistinguishedName
          ]
      )