{-# 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.ActiveDirectoryComputerAttribute
-- 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.ActiveDirectoryComputerAttribute where

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

-- | An LDAP attribute of an Active Directory computer account, in the form
-- of a name:value pair.
--
-- /See:/ 'newActiveDirectoryComputerAttribute' smart constructor.
data ActiveDirectoryComputerAttribute = ActiveDirectoryComputerAttribute'
  { -- | The value for the LDAP attribute.
    ActiveDirectoryComputerAttribute -> Maybe Text
value :: Prelude.Maybe Prelude.Text,
    -- | The name for the LDAP attribute.
    ActiveDirectoryComputerAttribute -> Maybe Text
name :: Prelude.Maybe Prelude.Text
  }
  deriving (ActiveDirectoryComputerAttribute
-> ActiveDirectoryComputerAttribute -> Bool
(ActiveDirectoryComputerAttribute
 -> ActiveDirectoryComputerAttribute -> Bool)
-> (ActiveDirectoryComputerAttribute
    -> ActiveDirectoryComputerAttribute -> Bool)
-> Eq ActiveDirectoryComputerAttribute
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ActiveDirectoryComputerAttribute
-> ActiveDirectoryComputerAttribute -> Bool
$c/= :: ActiveDirectoryComputerAttribute
-> ActiveDirectoryComputerAttribute -> Bool
== :: ActiveDirectoryComputerAttribute
-> ActiveDirectoryComputerAttribute -> Bool
$c== :: ActiveDirectoryComputerAttribute
-> ActiveDirectoryComputerAttribute -> Bool
Prelude.Eq, ReadPrec [ActiveDirectoryComputerAttribute]
ReadPrec ActiveDirectoryComputerAttribute
Int -> ReadS ActiveDirectoryComputerAttribute
ReadS [ActiveDirectoryComputerAttribute]
(Int -> ReadS ActiveDirectoryComputerAttribute)
-> ReadS [ActiveDirectoryComputerAttribute]
-> ReadPrec ActiveDirectoryComputerAttribute
-> ReadPrec [ActiveDirectoryComputerAttribute]
-> Read ActiveDirectoryComputerAttribute
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ActiveDirectoryComputerAttribute]
$creadListPrec :: ReadPrec [ActiveDirectoryComputerAttribute]
readPrec :: ReadPrec ActiveDirectoryComputerAttribute
$creadPrec :: ReadPrec ActiveDirectoryComputerAttribute
readList :: ReadS [ActiveDirectoryComputerAttribute]
$creadList :: ReadS [ActiveDirectoryComputerAttribute]
readsPrec :: Int -> ReadS ActiveDirectoryComputerAttribute
$creadsPrec :: Int -> ReadS ActiveDirectoryComputerAttribute
Prelude.Read, Int -> ActiveDirectoryComputerAttribute -> ShowS
[ActiveDirectoryComputerAttribute] -> ShowS
ActiveDirectoryComputerAttribute -> String
(Int -> ActiveDirectoryComputerAttribute -> ShowS)
-> (ActiveDirectoryComputerAttribute -> String)
-> ([ActiveDirectoryComputerAttribute] -> ShowS)
-> Show ActiveDirectoryComputerAttribute
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ActiveDirectoryComputerAttribute] -> ShowS
$cshowList :: [ActiveDirectoryComputerAttribute] -> ShowS
show :: ActiveDirectoryComputerAttribute -> String
$cshow :: ActiveDirectoryComputerAttribute -> String
showsPrec :: Int -> ActiveDirectoryComputerAttribute -> ShowS
$cshowsPrec :: Int -> ActiveDirectoryComputerAttribute -> ShowS
Prelude.Show, (forall x.
 ActiveDirectoryComputerAttribute
 -> Rep ActiveDirectoryComputerAttribute x)
-> (forall x.
    Rep ActiveDirectoryComputerAttribute x
    -> ActiveDirectoryComputerAttribute)
-> Generic ActiveDirectoryComputerAttribute
forall x.
Rep ActiveDirectoryComputerAttribute x
-> ActiveDirectoryComputerAttribute
forall x.
ActiveDirectoryComputerAttribute
-> Rep ActiveDirectoryComputerAttribute x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ActiveDirectoryComputerAttribute x
-> ActiveDirectoryComputerAttribute
$cfrom :: forall x.
ActiveDirectoryComputerAttribute
-> Rep ActiveDirectoryComputerAttribute x
Prelude.Generic)

-- |
-- Create a value of 'ActiveDirectoryComputerAttribute' 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:
--
-- 'value', 'activeDirectoryComputerAttribute_value' - The value for the LDAP attribute.
--
-- 'name', 'activeDirectoryComputerAttribute_name' - The name for the LDAP attribute.
newActiveDirectoryComputerAttribute ::
  ActiveDirectoryComputerAttribute
newActiveDirectoryComputerAttribute :: ActiveDirectoryComputerAttribute
newActiveDirectoryComputerAttribute =
  ActiveDirectoryComputerAttribute' :: Maybe Text -> Maybe Text -> ActiveDirectoryComputerAttribute
ActiveDirectoryComputerAttribute'
    { $sel:value:ActiveDirectoryComputerAttribute' :: Maybe Text
value =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:ActiveDirectoryComputerAttribute' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The value for the LDAP attribute.
activeDirectoryComputerAttribute_value :: Lens.Lens' ActiveDirectoryComputerAttribute (Prelude.Maybe Prelude.Text)
activeDirectoryComputerAttribute_value :: (Maybe Text -> f (Maybe Text))
-> ActiveDirectoryComputerAttribute
-> f ActiveDirectoryComputerAttribute
activeDirectoryComputerAttribute_value = (ActiveDirectoryComputerAttribute -> Maybe Text)
-> (ActiveDirectoryComputerAttribute
    -> Maybe Text -> ActiveDirectoryComputerAttribute)
-> Lens
     ActiveDirectoryComputerAttribute
     ActiveDirectoryComputerAttribute
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActiveDirectoryComputerAttribute' {Maybe Text
value :: Maybe Text
$sel:value:ActiveDirectoryComputerAttribute' :: ActiveDirectoryComputerAttribute -> Maybe Text
value} -> Maybe Text
value) (\s :: ActiveDirectoryComputerAttribute
s@ActiveDirectoryComputerAttribute' {} Maybe Text
a -> ActiveDirectoryComputerAttribute
s {$sel:value:ActiveDirectoryComputerAttribute' :: Maybe Text
value = Maybe Text
a} :: ActiveDirectoryComputerAttribute)

-- | The name for the LDAP attribute.
activeDirectoryComputerAttribute_name :: Lens.Lens' ActiveDirectoryComputerAttribute (Prelude.Maybe Prelude.Text)
activeDirectoryComputerAttribute_name :: (Maybe Text -> f (Maybe Text))
-> ActiveDirectoryComputerAttribute
-> f ActiveDirectoryComputerAttribute
activeDirectoryComputerAttribute_name = (ActiveDirectoryComputerAttribute -> Maybe Text)
-> (ActiveDirectoryComputerAttribute
    -> Maybe Text -> ActiveDirectoryComputerAttribute)
-> Lens
     ActiveDirectoryComputerAttribute
     ActiveDirectoryComputerAttribute
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActiveDirectoryComputerAttribute' {Maybe Text
name :: Maybe Text
$sel:name:ActiveDirectoryComputerAttribute' :: ActiveDirectoryComputerAttribute -> Maybe Text
name} -> Maybe Text
name) (\s :: ActiveDirectoryComputerAttribute
s@ActiveDirectoryComputerAttribute' {} Maybe Text
a -> ActiveDirectoryComputerAttribute
s {$sel:name:ActiveDirectoryComputerAttribute' :: Maybe Text
name = Maybe Text
a} :: ActiveDirectoryComputerAttribute)

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

instance
  Prelude.Hashable
    ActiveDirectoryComputerAttribute

instance
  Prelude.NFData
    ActiveDirectoryComputerAttribute

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