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

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

-- | Synchronize Amazon Web Services Systems Manager Inventory data from
-- multiple Amazon Web Services accounts defined in Organizations to a
-- centralized Amazon S3 bucket. Data is synchronized to individual key
-- prefixes in the central bucket. Each key prefix represents a different
-- Amazon Web Services account ID.
--
-- /See:/ 'newResourceDataSyncDestinationDataSharing' smart constructor.
data ResourceDataSyncDestinationDataSharing = ResourceDataSyncDestinationDataSharing'
  { -- | The sharing data type. Only @Organization@ is supported.
    ResourceDataSyncDestinationDataSharing -> Maybe Text
destinationDataSharingType :: Prelude.Maybe Prelude.Text
  }
  deriving (ResourceDataSyncDestinationDataSharing
-> ResourceDataSyncDestinationDataSharing -> Bool
(ResourceDataSyncDestinationDataSharing
 -> ResourceDataSyncDestinationDataSharing -> Bool)
-> (ResourceDataSyncDestinationDataSharing
    -> ResourceDataSyncDestinationDataSharing -> Bool)
-> Eq ResourceDataSyncDestinationDataSharing
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ResourceDataSyncDestinationDataSharing
-> ResourceDataSyncDestinationDataSharing -> Bool
$c/= :: ResourceDataSyncDestinationDataSharing
-> ResourceDataSyncDestinationDataSharing -> Bool
== :: ResourceDataSyncDestinationDataSharing
-> ResourceDataSyncDestinationDataSharing -> Bool
$c== :: ResourceDataSyncDestinationDataSharing
-> ResourceDataSyncDestinationDataSharing -> Bool
Prelude.Eq, ReadPrec [ResourceDataSyncDestinationDataSharing]
ReadPrec ResourceDataSyncDestinationDataSharing
Int -> ReadS ResourceDataSyncDestinationDataSharing
ReadS [ResourceDataSyncDestinationDataSharing]
(Int -> ReadS ResourceDataSyncDestinationDataSharing)
-> ReadS [ResourceDataSyncDestinationDataSharing]
-> ReadPrec ResourceDataSyncDestinationDataSharing
-> ReadPrec [ResourceDataSyncDestinationDataSharing]
-> Read ResourceDataSyncDestinationDataSharing
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ResourceDataSyncDestinationDataSharing]
$creadListPrec :: ReadPrec [ResourceDataSyncDestinationDataSharing]
readPrec :: ReadPrec ResourceDataSyncDestinationDataSharing
$creadPrec :: ReadPrec ResourceDataSyncDestinationDataSharing
readList :: ReadS [ResourceDataSyncDestinationDataSharing]
$creadList :: ReadS [ResourceDataSyncDestinationDataSharing]
readsPrec :: Int -> ReadS ResourceDataSyncDestinationDataSharing
$creadsPrec :: Int -> ReadS ResourceDataSyncDestinationDataSharing
Prelude.Read, Int -> ResourceDataSyncDestinationDataSharing -> ShowS
[ResourceDataSyncDestinationDataSharing] -> ShowS
ResourceDataSyncDestinationDataSharing -> String
(Int -> ResourceDataSyncDestinationDataSharing -> ShowS)
-> (ResourceDataSyncDestinationDataSharing -> String)
-> ([ResourceDataSyncDestinationDataSharing] -> ShowS)
-> Show ResourceDataSyncDestinationDataSharing
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ResourceDataSyncDestinationDataSharing] -> ShowS
$cshowList :: [ResourceDataSyncDestinationDataSharing] -> ShowS
show :: ResourceDataSyncDestinationDataSharing -> String
$cshow :: ResourceDataSyncDestinationDataSharing -> String
showsPrec :: Int -> ResourceDataSyncDestinationDataSharing -> ShowS
$cshowsPrec :: Int -> ResourceDataSyncDestinationDataSharing -> ShowS
Prelude.Show, (forall x.
 ResourceDataSyncDestinationDataSharing
 -> Rep ResourceDataSyncDestinationDataSharing x)
-> (forall x.
    Rep ResourceDataSyncDestinationDataSharing x
    -> ResourceDataSyncDestinationDataSharing)
-> Generic ResourceDataSyncDestinationDataSharing
forall x.
Rep ResourceDataSyncDestinationDataSharing x
-> ResourceDataSyncDestinationDataSharing
forall x.
ResourceDataSyncDestinationDataSharing
-> Rep ResourceDataSyncDestinationDataSharing x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ResourceDataSyncDestinationDataSharing x
-> ResourceDataSyncDestinationDataSharing
$cfrom :: forall x.
ResourceDataSyncDestinationDataSharing
-> Rep ResourceDataSyncDestinationDataSharing x
Prelude.Generic)

-- |
-- Create a value of 'ResourceDataSyncDestinationDataSharing' 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:
--
-- 'destinationDataSharingType', 'resourceDataSyncDestinationDataSharing_destinationDataSharingType' - The sharing data type. Only @Organization@ is supported.
newResourceDataSyncDestinationDataSharing ::
  ResourceDataSyncDestinationDataSharing
newResourceDataSyncDestinationDataSharing :: ResourceDataSyncDestinationDataSharing
newResourceDataSyncDestinationDataSharing =
  ResourceDataSyncDestinationDataSharing' :: Maybe Text -> ResourceDataSyncDestinationDataSharing
ResourceDataSyncDestinationDataSharing'
    { $sel:destinationDataSharingType:ResourceDataSyncDestinationDataSharing' :: Maybe Text
destinationDataSharingType =
        Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The sharing data type. Only @Organization@ is supported.
resourceDataSyncDestinationDataSharing_destinationDataSharingType :: Lens.Lens' ResourceDataSyncDestinationDataSharing (Prelude.Maybe Prelude.Text)
resourceDataSyncDestinationDataSharing_destinationDataSharingType :: (Maybe Text -> f (Maybe Text))
-> ResourceDataSyncDestinationDataSharing
-> f ResourceDataSyncDestinationDataSharing
resourceDataSyncDestinationDataSharing_destinationDataSharingType = (ResourceDataSyncDestinationDataSharing -> Maybe Text)
-> (ResourceDataSyncDestinationDataSharing
    -> Maybe Text -> ResourceDataSyncDestinationDataSharing)
-> Lens
     ResourceDataSyncDestinationDataSharing
     ResourceDataSyncDestinationDataSharing
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResourceDataSyncDestinationDataSharing' {Maybe Text
destinationDataSharingType :: Maybe Text
$sel:destinationDataSharingType:ResourceDataSyncDestinationDataSharing' :: ResourceDataSyncDestinationDataSharing -> Maybe Text
destinationDataSharingType} -> Maybe Text
destinationDataSharingType) (\s :: ResourceDataSyncDestinationDataSharing
s@ResourceDataSyncDestinationDataSharing' {} Maybe Text
a -> ResourceDataSyncDestinationDataSharing
s {$sel:destinationDataSharingType:ResourceDataSyncDestinationDataSharing' :: Maybe Text
destinationDataSharingType = Maybe Text
a} :: ResourceDataSyncDestinationDataSharing)

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

instance
  Prelude.Hashable
    ResourceDataSyncDestinationDataSharing

instance
  Prelude.NFData
    ResourceDataSyncDestinationDataSharing

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