{-# 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.RDS.Types.DomainMembership
-- 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.RDS.Types.DomainMembership where

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

-- | An Active Directory Domain membership record associated with the DB
-- instance or cluster.
--
-- /See:/ 'newDomainMembership' smart constructor.
data DomainMembership = DomainMembership'
  { -- | The status of the Active Directory Domain membership for the DB instance
    -- or cluster. Values include joined, pending-join, failed, and so on.
    DomainMembership -> Maybe Text
status :: Prelude.Maybe Prelude.Text,
    -- | The fully qualified domain name of the Active Directory Domain.
    DomainMembership -> Maybe Text
fqdn :: Prelude.Maybe Prelude.Text,
    -- | The identifier of the Active Directory Domain.
    DomainMembership -> Maybe Text
domain :: Prelude.Maybe Prelude.Text,
    -- | The name of the IAM role to be used when making API calls to the
    -- Directory Service.
    DomainMembership -> Maybe Text
iAMRoleName :: Prelude.Maybe Prelude.Text
  }
  deriving (DomainMembership -> DomainMembership -> Bool
(DomainMembership -> DomainMembership -> Bool)
-> (DomainMembership -> DomainMembership -> Bool)
-> Eq DomainMembership
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DomainMembership -> DomainMembership -> Bool
$c/= :: DomainMembership -> DomainMembership -> Bool
== :: DomainMembership -> DomainMembership -> Bool
$c== :: DomainMembership -> DomainMembership -> Bool
Prelude.Eq, ReadPrec [DomainMembership]
ReadPrec DomainMembership
Int -> ReadS DomainMembership
ReadS [DomainMembership]
(Int -> ReadS DomainMembership)
-> ReadS [DomainMembership]
-> ReadPrec DomainMembership
-> ReadPrec [DomainMembership]
-> Read DomainMembership
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DomainMembership]
$creadListPrec :: ReadPrec [DomainMembership]
readPrec :: ReadPrec DomainMembership
$creadPrec :: ReadPrec DomainMembership
readList :: ReadS [DomainMembership]
$creadList :: ReadS [DomainMembership]
readsPrec :: Int -> ReadS DomainMembership
$creadsPrec :: Int -> ReadS DomainMembership
Prelude.Read, Int -> DomainMembership -> ShowS
[DomainMembership] -> ShowS
DomainMembership -> String
(Int -> DomainMembership -> ShowS)
-> (DomainMembership -> String)
-> ([DomainMembership] -> ShowS)
-> Show DomainMembership
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DomainMembership] -> ShowS
$cshowList :: [DomainMembership] -> ShowS
show :: DomainMembership -> String
$cshow :: DomainMembership -> String
showsPrec :: Int -> DomainMembership -> ShowS
$cshowsPrec :: Int -> DomainMembership -> ShowS
Prelude.Show, (forall x. DomainMembership -> Rep DomainMembership x)
-> (forall x. Rep DomainMembership x -> DomainMembership)
-> Generic DomainMembership
forall x. Rep DomainMembership x -> DomainMembership
forall x. DomainMembership -> Rep DomainMembership x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DomainMembership x -> DomainMembership
$cfrom :: forall x. DomainMembership -> Rep DomainMembership x
Prelude.Generic)

-- |
-- Create a value of 'DomainMembership' 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:
--
-- 'status', 'domainMembership_status' - The status of the Active Directory Domain membership for the DB instance
-- or cluster. Values include joined, pending-join, failed, and so on.
--
-- 'fqdn', 'domainMembership_fqdn' - The fully qualified domain name of the Active Directory Domain.
--
-- 'domain', 'domainMembership_domain' - The identifier of the Active Directory Domain.
--
-- 'iAMRoleName', 'domainMembership_iAMRoleName' - The name of the IAM role to be used when making API calls to the
-- Directory Service.
newDomainMembership ::
  DomainMembership
newDomainMembership :: DomainMembership
newDomainMembership =
  DomainMembership' :: Maybe Text
-> Maybe Text -> Maybe Text -> Maybe Text -> DomainMembership
DomainMembership'
    { $sel:status:DomainMembership' :: Maybe Text
status = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:fqdn:DomainMembership' :: Maybe Text
fqdn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:domain:DomainMembership' :: Maybe Text
domain = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:iAMRoleName:DomainMembership' :: Maybe Text
iAMRoleName = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The status of the Active Directory Domain membership for the DB instance
-- or cluster. Values include joined, pending-join, failed, and so on.
domainMembership_status :: Lens.Lens' DomainMembership (Prelude.Maybe Prelude.Text)
domainMembership_status :: (Maybe Text -> f (Maybe Text))
-> DomainMembership -> f DomainMembership
domainMembership_status = (DomainMembership -> Maybe Text)
-> (DomainMembership -> Maybe Text -> DomainMembership)
-> Lens DomainMembership DomainMembership (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DomainMembership' {Maybe Text
status :: Maybe Text
$sel:status:DomainMembership' :: DomainMembership -> Maybe Text
status} -> Maybe Text
status) (\s :: DomainMembership
s@DomainMembership' {} Maybe Text
a -> DomainMembership
s {$sel:status:DomainMembership' :: Maybe Text
status = Maybe Text
a} :: DomainMembership)

-- | The fully qualified domain name of the Active Directory Domain.
domainMembership_fqdn :: Lens.Lens' DomainMembership (Prelude.Maybe Prelude.Text)
domainMembership_fqdn :: (Maybe Text -> f (Maybe Text))
-> DomainMembership -> f DomainMembership
domainMembership_fqdn = (DomainMembership -> Maybe Text)
-> (DomainMembership -> Maybe Text -> DomainMembership)
-> Lens DomainMembership DomainMembership (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DomainMembership' {Maybe Text
fqdn :: Maybe Text
$sel:fqdn:DomainMembership' :: DomainMembership -> Maybe Text
fqdn} -> Maybe Text
fqdn) (\s :: DomainMembership
s@DomainMembership' {} Maybe Text
a -> DomainMembership
s {$sel:fqdn:DomainMembership' :: Maybe Text
fqdn = Maybe Text
a} :: DomainMembership)

-- | The identifier of the Active Directory Domain.
domainMembership_domain :: Lens.Lens' DomainMembership (Prelude.Maybe Prelude.Text)
domainMembership_domain :: (Maybe Text -> f (Maybe Text))
-> DomainMembership -> f DomainMembership
domainMembership_domain = (DomainMembership -> Maybe Text)
-> (DomainMembership -> Maybe Text -> DomainMembership)
-> Lens DomainMembership DomainMembership (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DomainMembership' {Maybe Text
domain :: Maybe Text
$sel:domain:DomainMembership' :: DomainMembership -> Maybe Text
domain} -> Maybe Text
domain) (\s :: DomainMembership
s@DomainMembership' {} Maybe Text
a -> DomainMembership
s {$sel:domain:DomainMembership' :: Maybe Text
domain = Maybe Text
a} :: DomainMembership)

-- | The name of the IAM role to be used when making API calls to the
-- Directory Service.
domainMembership_iAMRoleName :: Lens.Lens' DomainMembership (Prelude.Maybe Prelude.Text)
domainMembership_iAMRoleName :: (Maybe Text -> f (Maybe Text))
-> DomainMembership -> f DomainMembership
domainMembership_iAMRoleName = (DomainMembership -> Maybe Text)
-> (DomainMembership -> Maybe Text -> DomainMembership)
-> Lens DomainMembership DomainMembership (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DomainMembership' {Maybe Text
iAMRoleName :: Maybe Text
$sel:iAMRoleName:DomainMembership' :: DomainMembership -> Maybe Text
iAMRoleName} -> Maybe Text
iAMRoleName) (\s :: DomainMembership
s@DomainMembership' {} Maybe Text
a -> DomainMembership
s {$sel:iAMRoleName:DomainMembership' :: Maybe Text
iAMRoleName = Maybe Text
a} :: DomainMembership)

instance Core.FromXML DomainMembership where
  parseXML :: [Node] -> Either String DomainMembership
parseXML [Node]
x =
    Maybe Text
-> Maybe Text -> Maybe Text -> Maybe Text -> DomainMembership
DomainMembership'
      (Maybe Text
 -> Maybe Text -> Maybe Text -> Maybe Text -> DomainMembership)
-> Either String (Maybe Text)
-> Either
     String (Maybe Text -> Maybe Text -> Maybe Text -> DomainMembership)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Status")
      Either
  String (Maybe Text -> Maybe Text -> Maybe Text -> DomainMembership)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Maybe Text -> DomainMembership)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"FQDN")
      Either String (Maybe Text -> Maybe Text -> DomainMembership)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> DomainMembership)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Domain")
      Either String (Maybe Text -> DomainMembership)
-> Either String (Maybe Text) -> Either String DomainMembership
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"IAMRoleName")

instance Prelude.Hashable DomainMembership

instance Prelude.NFData DomainMembership