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

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

-- | The configuration for a Microsoft Active Directory (Microsoft AD) studio
-- resource.
--
-- /See:/ 'newActiveDirectoryConfiguration' smart constructor.
data ActiveDirectoryConfiguration = ActiveDirectoryConfiguration'
  { -- | 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,
    -- | A collection of custom attributes for an Active Directory computer.
    ActiveDirectoryConfiguration
-> Maybe [ActiveDirectoryComputerAttribute]
computerAttributes :: Prelude.Maybe [ActiveDirectoryComputerAttribute],
    -- | 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
(ActiveDirectoryConfiguration
 -> ActiveDirectoryConfiguration -> Bool)
-> (ActiveDirectoryConfiguration
    -> ActiveDirectoryConfiguration -> Bool)
-> Eq ActiveDirectoryConfiguration
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, ReadPrec [ActiveDirectoryConfiguration]
ReadPrec ActiveDirectoryConfiguration
Int -> ReadS ActiveDirectoryConfiguration
ReadS [ActiveDirectoryConfiguration]
(Int -> ReadS ActiveDirectoryConfiguration)
-> ReadS [ActiveDirectoryConfiguration]
-> ReadPrec ActiveDirectoryConfiguration
-> ReadPrec [ActiveDirectoryConfiguration]
-> Read ActiveDirectoryConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ActiveDirectoryConfiguration]
$creadListPrec :: ReadPrec [ActiveDirectoryConfiguration]
readPrec :: ReadPrec ActiveDirectoryConfiguration
$creadPrec :: ReadPrec ActiveDirectoryConfiguration
readList :: ReadS [ActiveDirectoryConfiguration]
$creadList :: ReadS [ActiveDirectoryConfiguration]
readsPrec :: Int -> ReadS ActiveDirectoryConfiguration
$creadsPrec :: Int -> ReadS ActiveDirectoryConfiguration
Prelude.Read, Int -> ActiveDirectoryConfiguration -> ShowS
[ActiveDirectoryConfiguration] -> ShowS
ActiveDirectoryConfiguration -> String
(Int -> ActiveDirectoryConfiguration -> ShowS)
-> (ActiveDirectoryConfiguration -> String)
-> ([ActiveDirectoryConfiguration] -> ShowS)
-> Show ActiveDirectoryConfiguration
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.
 ActiveDirectoryConfiguration -> Rep ActiveDirectoryConfiguration x)
-> (forall x.
    Rep ActiveDirectoryConfiguration x -> ActiveDirectoryConfiguration)
-> Generic ActiveDirectoryConfiguration
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:
--
-- 'directoryId', 'activeDirectoryConfiguration_directoryId' - The directory ID of the Directory Service for Microsoft Active Directory
-- to access using this studio component.
--
-- 'computerAttributes', 'activeDirectoryConfiguration_computerAttributes' - A collection of custom attributes for an Active Directory computer.
--
-- 'organizationalUnitDistinguishedName', 'activeDirectoryConfiguration_organizationalUnitDistinguishedName' - The distinguished name (DN) and organizational unit (OU) of an Active
-- Directory computer.
newActiveDirectoryConfiguration ::
  ActiveDirectoryConfiguration
newActiveDirectoryConfiguration :: ActiveDirectoryConfiguration
newActiveDirectoryConfiguration =
  ActiveDirectoryConfiguration' :: Maybe Text
-> Maybe [ActiveDirectoryComputerAttribute]
-> Maybe Text
-> ActiveDirectoryConfiguration
ActiveDirectoryConfiguration'
    { $sel:directoryId:ActiveDirectoryConfiguration' :: Maybe Text
directoryId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:computerAttributes:ActiveDirectoryConfiguration' :: Maybe [ActiveDirectoryComputerAttribute]
computerAttributes = Maybe [ActiveDirectoryComputerAttribute]
forall a. Maybe a
Prelude.Nothing,
      $sel:organizationalUnitDistinguishedName:ActiveDirectoryConfiguration' :: Maybe Text
organizationalUnitDistinguishedName =
        Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | 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 :: (Maybe Text -> f (Maybe Text))
-> ActiveDirectoryConfiguration -> f ActiveDirectoryConfiguration
activeDirectoryConfiguration_directoryId = (ActiveDirectoryConfiguration -> Maybe Text)
-> (ActiveDirectoryConfiguration
    -> Maybe Text -> ActiveDirectoryConfiguration)
-> Lens
     ActiveDirectoryConfiguration
     ActiveDirectoryConfiguration
     (Maybe Text)
     (Maybe Text)
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)

-- | A collection of custom attributes for an Active Directory computer.
activeDirectoryConfiguration_computerAttributes :: Lens.Lens' ActiveDirectoryConfiguration (Prelude.Maybe [ActiveDirectoryComputerAttribute])
activeDirectoryConfiguration_computerAttributes :: (Maybe [ActiveDirectoryComputerAttribute]
 -> f (Maybe [ActiveDirectoryComputerAttribute]))
-> ActiveDirectoryConfiguration -> f ActiveDirectoryConfiguration
activeDirectoryConfiguration_computerAttributes = (ActiveDirectoryConfiguration
 -> Maybe [ActiveDirectoryComputerAttribute])
-> (ActiveDirectoryConfiguration
    -> Maybe [ActiveDirectoryComputerAttribute]
    -> ActiveDirectoryConfiguration)
-> Lens
     ActiveDirectoryConfiguration
     ActiveDirectoryConfiguration
     (Maybe [ActiveDirectoryComputerAttribute])
     (Maybe [ActiveDirectoryComputerAttribute])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActiveDirectoryConfiguration' {Maybe [ActiveDirectoryComputerAttribute]
computerAttributes :: Maybe [ActiveDirectoryComputerAttribute]
$sel:computerAttributes:ActiveDirectoryConfiguration' :: ActiveDirectoryConfiguration
-> Maybe [ActiveDirectoryComputerAttribute]
computerAttributes} -> Maybe [ActiveDirectoryComputerAttribute]
computerAttributes) (\s :: ActiveDirectoryConfiguration
s@ActiveDirectoryConfiguration' {} Maybe [ActiveDirectoryComputerAttribute]
a -> ActiveDirectoryConfiguration
s {$sel:computerAttributes:ActiveDirectoryConfiguration' :: Maybe [ActiveDirectoryComputerAttribute]
computerAttributes = Maybe [ActiveDirectoryComputerAttribute]
a} :: ActiveDirectoryConfiguration) ((Maybe [ActiveDirectoryComputerAttribute]
  -> f (Maybe [ActiveDirectoryComputerAttribute]))
 -> ActiveDirectoryConfiguration -> f ActiveDirectoryConfiguration)
-> ((Maybe [ActiveDirectoryComputerAttribute]
     -> f (Maybe [ActiveDirectoryComputerAttribute]))
    -> Maybe [ActiveDirectoryComputerAttribute]
    -> f (Maybe [ActiveDirectoryComputerAttribute]))
-> (Maybe [ActiveDirectoryComputerAttribute]
    -> f (Maybe [ActiveDirectoryComputerAttribute]))
-> ActiveDirectoryConfiguration
-> f ActiveDirectoryConfiguration
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ActiveDirectoryComputerAttribute]
  [ActiveDirectoryComputerAttribute]
  [ActiveDirectoryComputerAttribute]
  [ActiveDirectoryComputerAttribute]
-> Iso
     (Maybe [ActiveDirectoryComputerAttribute])
     (Maybe [ActiveDirectoryComputerAttribute])
     (Maybe [ActiveDirectoryComputerAttribute])
     (Maybe [ActiveDirectoryComputerAttribute])
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 AnIso
  [ActiveDirectoryComputerAttribute]
  [ActiveDirectoryComputerAttribute]
  [ActiveDirectoryComputerAttribute]
  [ActiveDirectoryComputerAttribute]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The distinguished name (DN) and organizational unit (OU) of an Active
-- Directory computer.
activeDirectoryConfiguration_organizationalUnitDistinguishedName :: Lens.Lens' ActiveDirectoryConfiguration (Prelude.Maybe Prelude.Text)
activeDirectoryConfiguration_organizationalUnitDistinguishedName :: (Maybe Text -> f (Maybe Text))
-> ActiveDirectoryConfiguration -> f ActiveDirectoryConfiguration
activeDirectoryConfiguration_organizationalUnitDistinguishedName = (ActiveDirectoryConfiguration -> Maybe Text)
-> (ActiveDirectoryConfiguration
    -> Maybe Text -> ActiveDirectoryConfiguration)
-> Lens
     ActiveDirectoryConfiguration
     ActiveDirectoryConfiguration
     (Maybe Text)
     (Maybe Text)
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 Core.FromJSON ActiveDirectoryConfiguration where
  parseJSON :: Value -> Parser ActiveDirectoryConfiguration
parseJSON =
    String
-> (Object -> Parser ActiveDirectoryConfiguration)
-> Value
-> Parser ActiveDirectoryConfiguration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ActiveDirectoryConfiguration"
      ( \Object
x ->
          Maybe Text
-> Maybe [ActiveDirectoryComputerAttribute]
-> Maybe Text
-> ActiveDirectoryConfiguration
ActiveDirectoryConfiguration'
            (Maybe Text
 -> Maybe [ActiveDirectoryComputerAttribute]
 -> Maybe Text
 -> ActiveDirectoryConfiguration)
-> Parser (Maybe Text)
-> Parser
     (Maybe [ActiveDirectoryComputerAttribute]
      -> Maybe Text -> ActiveDirectoryConfiguration)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"directoryId")
            Parser
  (Maybe [ActiveDirectoryComputerAttribute]
   -> Maybe Text -> ActiveDirectoryConfiguration)
-> Parser (Maybe [ActiveDirectoryComputerAttribute])
-> Parser (Maybe Text -> ActiveDirectoryConfiguration)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object
-> Text
-> Parser (Maybe (Maybe [ActiveDirectoryComputerAttribute]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"computerAttributes"
                            Parser (Maybe (Maybe [ActiveDirectoryComputerAttribute]))
-> Maybe [ActiveDirectoryComputerAttribute]
-> Parser (Maybe [ActiveDirectoryComputerAttribute])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [ActiveDirectoryComputerAttribute]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser (Maybe Text -> ActiveDirectoryConfiguration)
-> Parser (Maybe Text) -> Parser ActiveDirectoryConfiguration
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"organizationalUnitDistinguishedName")
      )

instance
  Prelude.Hashable
    ActiveDirectoryConfiguration

instance Prelude.NFData ActiveDirectoryConfiguration

instance Core.ToJSON ActiveDirectoryConfiguration where
  toJSON :: ActiveDirectoryConfiguration -> Value
toJSON ActiveDirectoryConfiguration' {Maybe [ActiveDirectoryComputerAttribute]
Maybe Text
organizationalUnitDistinguishedName :: Maybe Text
computerAttributes :: Maybe [ActiveDirectoryComputerAttribute]
directoryId :: Maybe Text
$sel:organizationalUnitDistinguishedName:ActiveDirectoryConfiguration' :: ActiveDirectoryConfiguration -> Maybe Text
$sel:computerAttributes:ActiveDirectoryConfiguration' :: ActiveDirectoryConfiguration
-> Maybe [ActiveDirectoryComputerAttribute]
$sel:directoryId:ActiveDirectoryConfiguration' :: ActiveDirectoryConfiguration -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"directoryId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
directoryId,
            (Text
"computerAttributes" Text -> [ActiveDirectoryComputerAttribute] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              ([ActiveDirectoryComputerAttribute] -> Pair)
-> Maybe [ActiveDirectoryComputerAttribute] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [ActiveDirectoryComputerAttribute]
computerAttributes,
            (Text
"organizationalUnitDistinguishedName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
organizationalUnitDistinguishedName
          ]
      )