{-# 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.SSM.Types.ResourceDataSyncOrganizationalUnit
-- 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.SSM.Types.ResourceDataSyncOrganizationalUnit where

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

-- | The Organizations organizational unit data source for the sync.
--
-- /See:/ 'newResourceDataSyncOrganizationalUnit' smart constructor.
data ResourceDataSyncOrganizationalUnit = ResourceDataSyncOrganizationalUnit'
  { -- | The Organizations unit ID data source for the sync.
    ResourceDataSyncOrganizationalUnit -> Maybe Text
organizationalUnitId :: Prelude.Maybe Prelude.Text
  }
  deriving (ResourceDataSyncOrganizationalUnit
-> ResourceDataSyncOrganizationalUnit -> Bool
(ResourceDataSyncOrganizationalUnit
 -> ResourceDataSyncOrganizationalUnit -> Bool)
-> (ResourceDataSyncOrganizationalUnit
    -> ResourceDataSyncOrganizationalUnit -> Bool)
-> Eq ResourceDataSyncOrganizationalUnit
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ResourceDataSyncOrganizationalUnit
-> ResourceDataSyncOrganizationalUnit -> Bool
$c/= :: ResourceDataSyncOrganizationalUnit
-> ResourceDataSyncOrganizationalUnit -> Bool
== :: ResourceDataSyncOrganizationalUnit
-> ResourceDataSyncOrganizationalUnit -> Bool
$c== :: ResourceDataSyncOrganizationalUnit
-> ResourceDataSyncOrganizationalUnit -> Bool
Prelude.Eq, ReadPrec [ResourceDataSyncOrganizationalUnit]
ReadPrec ResourceDataSyncOrganizationalUnit
Int -> ReadS ResourceDataSyncOrganizationalUnit
ReadS [ResourceDataSyncOrganizationalUnit]
(Int -> ReadS ResourceDataSyncOrganizationalUnit)
-> ReadS [ResourceDataSyncOrganizationalUnit]
-> ReadPrec ResourceDataSyncOrganizationalUnit
-> ReadPrec [ResourceDataSyncOrganizationalUnit]
-> Read ResourceDataSyncOrganizationalUnit
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ResourceDataSyncOrganizationalUnit]
$creadListPrec :: ReadPrec [ResourceDataSyncOrganizationalUnit]
readPrec :: ReadPrec ResourceDataSyncOrganizationalUnit
$creadPrec :: ReadPrec ResourceDataSyncOrganizationalUnit
readList :: ReadS [ResourceDataSyncOrganizationalUnit]
$creadList :: ReadS [ResourceDataSyncOrganizationalUnit]
readsPrec :: Int -> ReadS ResourceDataSyncOrganizationalUnit
$creadsPrec :: Int -> ReadS ResourceDataSyncOrganizationalUnit
Prelude.Read, Int -> ResourceDataSyncOrganizationalUnit -> ShowS
[ResourceDataSyncOrganizationalUnit] -> ShowS
ResourceDataSyncOrganizationalUnit -> String
(Int -> ResourceDataSyncOrganizationalUnit -> ShowS)
-> (ResourceDataSyncOrganizationalUnit -> String)
-> ([ResourceDataSyncOrganizationalUnit] -> ShowS)
-> Show ResourceDataSyncOrganizationalUnit
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ResourceDataSyncOrganizationalUnit] -> ShowS
$cshowList :: [ResourceDataSyncOrganizationalUnit] -> ShowS
show :: ResourceDataSyncOrganizationalUnit -> String
$cshow :: ResourceDataSyncOrganizationalUnit -> String
showsPrec :: Int -> ResourceDataSyncOrganizationalUnit -> ShowS
$cshowsPrec :: Int -> ResourceDataSyncOrganizationalUnit -> ShowS
Prelude.Show, (forall x.
 ResourceDataSyncOrganizationalUnit
 -> Rep ResourceDataSyncOrganizationalUnit x)
-> (forall x.
    Rep ResourceDataSyncOrganizationalUnit x
    -> ResourceDataSyncOrganizationalUnit)
-> Generic ResourceDataSyncOrganizationalUnit
forall x.
Rep ResourceDataSyncOrganizationalUnit x
-> ResourceDataSyncOrganizationalUnit
forall x.
ResourceDataSyncOrganizationalUnit
-> Rep ResourceDataSyncOrganizationalUnit x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ResourceDataSyncOrganizationalUnit x
-> ResourceDataSyncOrganizationalUnit
$cfrom :: forall x.
ResourceDataSyncOrganizationalUnit
-> Rep ResourceDataSyncOrganizationalUnit x
Prelude.Generic)

-- |
-- Create a value of 'ResourceDataSyncOrganizationalUnit' 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:
--
-- 'organizationalUnitId', 'resourceDataSyncOrganizationalUnit_organizationalUnitId' - The Organizations unit ID data source for the sync.
newResourceDataSyncOrganizationalUnit ::
  ResourceDataSyncOrganizationalUnit
newResourceDataSyncOrganizationalUnit :: ResourceDataSyncOrganizationalUnit
newResourceDataSyncOrganizationalUnit =
  ResourceDataSyncOrganizationalUnit' :: Maybe Text -> ResourceDataSyncOrganizationalUnit
ResourceDataSyncOrganizationalUnit'
    { $sel:organizationalUnitId:ResourceDataSyncOrganizationalUnit' :: Maybe Text
organizationalUnitId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The Organizations unit ID data source for the sync.
resourceDataSyncOrganizationalUnit_organizationalUnitId :: Lens.Lens' ResourceDataSyncOrganizationalUnit (Prelude.Maybe Prelude.Text)
resourceDataSyncOrganizationalUnit_organizationalUnitId :: (Maybe Text -> f (Maybe Text))
-> ResourceDataSyncOrganizationalUnit
-> f ResourceDataSyncOrganizationalUnit
resourceDataSyncOrganizationalUnit_organizationalUnitId = (ResourceDataSyncOrganizationalUnit -> Maybe Text)
-> (ResourceDataSyncOrganizationalUnit
    -> Maybe Text -> ResourceDataSyncOrganizationalUnit)
-> Lens
     ResourceDataSyncOrganizationalUnit
     ResourceDataSyncOrganizationalUnit
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResourceDataSyncOrganizationalUnit' {Maybe Text
organizationalUnitId :: Maybe Text
$sel:organizationalUnitId:ResourceDataSyncOrganizationalUnit' :: ResourceDataSyncOrganizationalUnit -> Maybe Text
organizationalUnitId} -> Maybe Text
organizationalUnitId) (\s :: ResourceDataSyncOrganizationalUnit
s@ResourceDataSyncOrganizationalUnit' {} Maybe Text
a -> ResourceDataSyncOrganizationalUnit
s {$sel:organizationalUnitId:ResourceDataSyncOrganizationalUnit' :: Maybe Text
organizationalUnitId = Maybe Text
a} :: ResourceDataSyncOrganizationalUnit)

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

instance
  Prelude.Hashable
    ResourceDataSyncOrganizationalUnit

instance
  Prelude.NFData
    ResourceDataSyncOrganizationalUnit

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