{-# 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.AccountSharingInfo
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.SSM.Types.AccountSharingInfo where

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

-- | Information includes the Amazon Web Services account ID where the
-- current document is shared and the version shared with that account.
--
-- /See:/ 'newAccountSharingInfo' smart constructor.
data AccountSharingInfo = AccountSharingInfo'
  { -- | The Amazon Web Services account ID where the current document is shared.
    AccountSharingInfo -> Maybe Text
accountId :: Prelude.Maybe Prelude.Text,
    -- | The version of the current document shared with the account.
    AccountSharingInfo -> Maybe Text
sharedDocumentVersion :: Prelude.Maybe Prelude.Text
  }
  deriving (AccountSharingInfo -> AccountSharingInfo -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AccountSharingInfo -> AccountSharingInfo -> Bool
$c/= :: AccountSharingInfo -> AccountSharingInfo -> Bool
== :: AccountSharingInfo -> AccountSharingInfo -> Bool
$c== :: AccountSharingInfo -> AccountSharingInfo -> Bool
Prelude.Eq, ReadPrec [AccountSharingInfo]
ReadPrec AccountSharingInfo
Int -> ReadS AccountSharingInfo
ReadS [AccountSharingInfo]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AccountSharingInfo]
$creadListPrec :: ReadPrec [AccountSharingInfo]
readPrec :: ReadPrec AccountSharingInfo
$creadPrec :: ReadPrec AccountSharingInfo
readList :: ReadS [AccountSharingInfo]
$creadList :: ReadS [AccountSharingInfo]
readsPrec :: Int -> ReadS AccountSharingInfo
$creadsPrec :: Int -> ReadS AccountSharingInfo
Prelude.Read, Int -> AccountSharingInfo -> ShowS
[AccountSharingInfo] -> ShowS
AccountSharingInfo -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AccountSharingInfo] -> ShowS
$cshowList :: [AccountSharingInfo] -> ShowS
show :: AccountSharingInfo -> String
$cshow :: AccountSharingInfo -> String
showsPrec :: Int -> AccountSharingInfo -> ShowS
$cshowsPrec :: Int -> AccountSharingInfo -> ShowS
Prelude.Show, forall x. Rep AccountSharingInfo x -> AccountSharingInfo
forall x. AccountSharingInfo -> Rep AccountSharingInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AccountSharingInfo x -> AccountSharingInfo
$cfrom :: forall x. AccountSharingInfo -> Rep AccountSharingInfo x
Prelude.Generic)

-- |
-- Create a value of 'AccountSharingInfo' 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:
--
-- 'accountId', 'accountSharingInfo_accountId' - The Amazon Web Services account ID where the current document is shared.
--
-- 'sharedDocumentVersion', 'accountSharingInfo_sharedDocumentVersion' - The version of the current document shared with the account.
newAccountSharingInfo ::
  AccountSharingInfo
newAccountSharingInfo :: AccountSharingInfo
newAccountSharingInfo =
  AccountSharingInfo'
    { $sel:accountId:AccountSharingInfo' :: Maybe Text
accountId = forall a. Maybe a
Prelude.Nothing,
      $sel:sharedDocumentVersion:AccountSharingInfo' :: Maybe Text
sharedDocumentVersion = forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon Web Services account ID where the current document is shared.
accountSharingInfo_accountId :: Lens.Lens' AccountSharingInfo (Prelude.Maybe Prelude.Text)
accountSharingInfo_accountId :: Lens' AccountSharingInfo (Maybe Text)
accountSharingInfo_accountId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AccountSharingInfo' {Maybe Text
accountId :: Maybe Text
$sel:accountId:AccountSharingInfo' :: AccountSharingInfo -> Maybe Text
accountId} -> Maybe Text
accountId) (\s :: AccountSharingInfo
s@AccountSharingInfo' {} Maybe Text
a -> AccountSharingInfo
s {$sel:accountId:AccountSharingInfo' :: Maybe Text
accountId = Maybe Text
a} :: AccountSharingInfo)

-- | The version of the current document shared with the account.
accountSharingInfo_sharedDocumentVersion :: Lens.Lens' AccountSharingInfo (Prelude.Maybe Prelude.Text)
accountSharingInfo_sharedDocumentVersion :: Lens' AccountSharingInfo (Maybe Text)
accountSharingInfo_sharedDocumentVersion = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AccountSharingInfo' {Maybe Text
sharedDocumentVersion :: Maybe Text
$sel:sharedDocumentVersion:AccountSharingInfo' :: AccountSharingInfo -> Maybe Text
sharedDocumentVersion} -> Maybe Text
sharedDocumentVersion) (\s :: AccountSharingInfo
s@AccountSharingInfo' {} Maybe Text
a -> AccountSharingInfo
s {$sel:sharedDocumentVersion:AccountSharingInfo' :: Maybe Text
sharedDocumentVersion = Maybe Text
a} :: AccountSharingInfo)

instance Data.FromJSON AccountSharingInfo where
  parseJSON :: Value -> Parser AccountSharingInfo
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"AccountSharingInfo"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> AccountSharingInfo
AccountSharingInfo'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"AccountId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"SharedDocumentVersion")
      )

instance Prelude.Hashable AccountSharingInfo where
  hashWithSalt :: Int -> AccountSharingInfo -> Int
hashWithSalt Int
_salt AccountSharingInfo' {Maybe Text
sharedDocumentVersion :: Maybe Text
accountId :: Maybe Text
$sel:sharedDocumentVersion:AccountSharingInfo' :: AccountSharingInfo -> Maybe Text
$sel:accountId:AccountSharingInfo' :: AccountSharingInfo -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
accountId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
sharedDocumentVersion

instance Prelude.NFData AccountSharingInfo where
  rnf :: AccountSharingInfo -> ()
rnf AccountSharingInfo' {Maybe Text
sharedDocumentVersion :: Maybe Text
accountId :: Maybe Text
$sel:sharedDocumentVersion:AccountSharingInfo' :: AccountSharingInfo -> Maybe Text
$sel:accountId:AccountSharingInfo' :: AccountSharingInfo -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
accountId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
sharedDocumentVersion