{-# 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.AppStream.Types.DomainJoinInfo
-- 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.AppStream.Types.DomainJoinInfo where

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

-- | Describes the configuration information required to join fleets and
-- image builders to Microsoft Active Directory domains.
--
-- /See:/ 'newDomainJoinInfo' smart constructor.
data DomainJoinInfo = DomainJoinInfo'
  { -- | The distinguished name of the organizational unit for computer accounts.
    DomainJoinInfo -> Maybe Text
organizationalUnitDistinguishedName :: Prelude.Maybe Prelude.Text,
    -- | The fully qualified name of the directory (for example,
    -- corp.example.com).
    DomainJoinInfo -> Maybe Text
directoryName :: Prelude.Maybe Prelude.Text
  }
  deriving (DomainJoinInfo -> DomainJoinInfo -> Bool
(DomainJoinInfo -> DomainJoinInfo -> Bool)
-> (DomainJoinInfo -> DomainJoinInfo -> Bool) -> Eq DomainJoinInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DomainJoinInfo -> DomainJoinInfo -> Bool
$c/= :: DomainJoinInfo -> DomainJoinInfo -> Bool
== :: DomainJoinInfo -> DomainJoinInfo -> Bool
$c== :: DomainJoinInfo -> DomainJoinInfo -> Bool
Prelude.Eq, ReadPrec [DomainJoinInfo]
ReadPrec DomainJoinInfo
Int -> ReadS DomainJoinInfo
ReadS [DomainJoinInfo]
(Int -> ReadS DomainJoinInfo)
-> ReadS [DomainJoinInfo]
-> ReadPrec DomainJoinInfo
-> ReadPrec [DomainJoinInfo]
-> Read DomainJoinInfo
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DomainJoinInfo]
$creadListPrec :: ReadPrec [DomainJoinInfo]
readPrec :: ReadPrec DomainJoinInfo
$creadPrec :: ReadPrec DomainJoinInfo
readList :: ReadS [DomainJoinInfo]
$creadList :: ReadS [DomainJoinInfo]
readsPrec :: Int -> ReadS DomainJoinInfo
$creadsPrec :: Int -> ReadS DomainJoinInfo
Prelude.Read, Int -> DomainJoinInfo -> ShowS
[DomainJoinInfo] -> ShowS
DomainJoinInfo -> String
(Int -> DomainJoinInfo -> ShowS)
-> (DomainJoinInfo -> String)
-> ([DomainJoinInfo] -> ShowS)
-> Show DomainJoinInfo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DomainJoinInfo] -> ShowS
$cshowList :: [DomainJoinInfo] -> ShowS
show :: DomainJoinInfo -> String
$cshow :: DomainJoinInfo -> String
showsPrec :: Int -> DomainJoinInfo -> ShowS
$cshowsPrec :: Int -> DomainJoinInfo -> ShowS
Prelude.Show, (forall x. DomainJoinInfo -> Rep DomainJoinInfo x)
-> (forall x. Rep DomainJoinInfo x -> DomainJoinInfo)
-> Generic DomainJoinInfo
forall x. Rep DomainJoinInfo x -> DomainJoinInfo
forall x. DomainJoinInfo -> Rep DomainJoinInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DomainJoinInfo x -> DomainJoinInfo
$cfrom :: forall x. DomainJoinInfo -> Rep DomainJoinInfo x
Prelude.Generic)

-- |
-- Create a value of 'DomainJoinInfo' 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:
--
-- 'organizationalUnitDistinguishedName', 'domainJoinInfo_organizationalUnitDistinguishedName' - The distinguished name of the organizational unit for computer accounts.
--
-- 'directoryName', 'domainJoinInfo_directoryName' - The fully qualified name of the directory (for example,
-- corp.example.com).
newDomainJoinInfo ::
  DomainJoinInfo
newDomainJoinInfo :: DomainJoinInfo
newDomainJoinInfo =
  DomainJoinInfo' :: Maybe Text -> Maybe Text -> DomainJoinInfo
DomainJoinInfo'
    { $sel:organizationalUnitDistinguishedName:DomainJoinInfo' :: Maybe Text
organizationalUnitDistinguishedName =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:directoryName:DomainJoinInfo' :: Maybe Text
directoryName = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The distinguished name of the organizational unit for computer accounts.
domainJoinInfo_organizationalUnitDistinguishedName :: Lens.Lens' DomainJoinInfo (Prelude.Maybe Prelude.Text)
domainJoinInfo_organizationalUnitDistinguishedName :: (Maybe Text -> f (Maybe Text))
-> DomainJoinInfo -> f DomainJoinInfo
domainJoinInfo_organizationalUnitDistinguishedName = (DomainJoinInfo -> Maybe Text)
-> (DomainJoinInfo -> Maybe Text -> DomainJoinInfo)
-> Lens DomainJoinInfo DomainJoinInfo (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DomainJoinInfo' {Maybe Text
organizationalUnitDistinguishedName :: Maybe Text
$sel:organizationalUnitDistinguishedName:DomainJoinInfo' :: DomainJoinInfo -> Maybe Text
organizationalUnitDistinguishedName} -> Maybe Text
organizationalUnitDistinguishedName) (\s :: DomainJoinInfo
s@DomainJoinInfo' {} Maybe Text
a -> DomainJoinInfo
s {$sel:organizationalUnitDistinguishedName:DomainJoinInfo' :: Maybe Text
organizationalUnitDistinguishedName = Maybe Text
a} :: DomainJoinInfo)

-- | The fully qualified name of the directory (for example,
-- corp.example.com).
domainJoinInfo_directoryName :: Lens.Lens' DomainJoinInfo (Prelude.Maybe Prelude.Text)
domainJoinInfo_directoryName :: (Maybe Text -> f (Maybe Text))
-> DomainJoinInfo -> f DomainJoinInfo
domainJoinInfo_directoryName = (DomainJoinInfo -> Maybe Text)
-> (DomainJoinInfo -> Maybe Text -> DomainJoinInfo)
-> Lens DomainJoinInfo DomainJoinInfo (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DomainJoinInfo' {Maybe Text
directoryName :: Maybe Text
$sel:directoryName:DomainJoinInfo' :: DomainJoinInfo -> Maybe Text
directoryName} -> Maybe Text
directoryName) (\s :: DomainJoinInfo
s@DomainJoinInfo' {} Maybe Text
a -> DomainJoinInfo
s {$sel:directoryName:DomainJoinInfo' :: Maybe Text
directoryName = Maybe Text
a} :: DomainJoinInfo)

instance Core.FromJSON DomainJoinInfo where
  parseJSON :: Value -> Parser DomainJoinInfo
parseJSON =
    String
-> (Object -> Parser DomainJoinInfo)
-> Value
-> Parser DomainJoinInfo
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"DomainJoinInfo"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> DomainJoinInfo
DomainJoinInfo'
            (Maybe Text -> Maybe Text -> DomainJoinInfo)
-> Parser (Maybe Text) -> Parser (Maybe Text -> DomainJoinInfo)
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
"OrganizationalUnitDistinguishedName")
            Parser (Maybe Text -> DomainJoinInfo)
-> Parser (Maybe Text) -> Parser DomainJoinInfo
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
"DirectoryName")
      )

instance Prelude.Hashable DomainJoinInfo

instance Prelude.NFData DomainJoinInfo

instance Core.ToJSON DomainJoinInfo where
  toJSON :: DomainJoinInfo -> Value
toJSON DomainJoinInfo' {Maybe Text
directoryName :: Maybe Text
organizationalUnitDistinguishedName :: Maybe Text
$sel:directoryName:DomainJoinInfo' :: DomainJoinInfo -> Maybe Text
$sel:organizationalUnitDistinguishedName:DomainJoinInfo' :: DomainJoinInfo -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (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,
            (Text
"DirectoryName" 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
directoryName
          ]
      )