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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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 version of the current document shared with the account.
    AccountSharingInfo -> Maybe Text
sharedDocumentVersion :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Web Services account ID where the current document is shared.
    AccountSharingInfo -> Maybe Text
accountId :: Prelude.Maybe Prelude.Text
  }
  deriving (AccountSharingInfo -> AccountSharingInfo -> Bool
(AccountSharingInfo -> AccountSharingInfo -> Bool)
-> (AccountSharingInfo -> AccountSharingInfo -> Bool)
-> Eq AccountSharingInfo
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]
(Int -> ReadS AccountSharingInfo)
-> ReadS [AccountSharingInfo]
-> ReadPrec AccountSharingInfo
-> ReadPrec [AccountSharingInfo]
-> Read 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
(Int -> AccountSharingInfo -> ShowS)
-> (AccountSharingInfo -> String)
-> ([AccountSharingInfo] -> ShowS)
-> Show AccountSharingInfo
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. AccountSharingInfo -> Rep AccountSharingInfo x)
-> (forall x. Rep AccountSharingInfo x -> AccountSharingInfo)
-> Generic AccountSharingInfo
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:
--
-- 'sharedDocumentVersion', 'accountSharingInfo_sharedDocumentVersion' - The version of the current document shared with the account.
--
-- 'accountId', 'accountSharingInfo_accountId' - The Amazon Web Services account ID where the current document is shared.
newAccountSharingInfo ::
  AccountSharingInfo
newAccountSharingInfo :: AccountSharingInfo
newAccountSharingInfo =
  AccountSharingInfo' :: Maybe Text -> Maybe Text -> AccountSharingInfo
AccountSharingInfo'
    { $sel:sharedDocumentVersion:AccountSharingInfo' :: Maybe Text
sharedDocumentVersion =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:accountId:AccountSharingInfo' :: Maybe Text
accountId = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The version of the current document shared with the account.
accountSharingInfo_sharedDocumentVersion :: Lens.Lens' AccountSharingInfo (Prelude.Maybe Prelude.Text)
accountSharingInfo_sharedDocumentVersion :: (Maybe Text -> f (Maybe Text))
-> AccountSharingInfo -> f AccountSharingInfo
accountSharingInfo_sharedDocumentVersion = (AccountSharingInfo -> Maybe Text)
-> (AccountSharingInfo -> Maybe Text -> AccountSharingInfo)
-> Lens
     AccountSharingInfo AccountSharingInfo (Maybe Text) (Maybe Text)
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)

-- | The Amazon Web Services account ID where the current document is shared.
accountSharingInfo_accountId :: Lens.Lens' AccountSharingInfo (Prelude.Maybe Prelude.Text)
accountSharingInfo_accountId :: (Maybe Text -> f (Maybe Text))
-> AccountSharingInfo -> f AccountSharingInfo
accountSharingInfo_accountId = (AccountSharingInfo -> Maybe Text)
-> (AccountSharingInfo -> Maybe Text -> AccountSharingInfo)
-> Lens
     AccountSharingInfo AccountSharingInfo (Maybe Text) (Maybe Text)
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)

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

instance Prelude.Hashable AccountSharingInfo

instance Prelude.NFData AccountSharingInfo