{-# 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.WorkDocs.Types.ShareResult
-- 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.WorkDocs.Types.ShareResult where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.WorkDocs.Types.RoleType
import Amazonka.WorkDocs.Types.ShareStatusType

-- | Describes the share results of a resource.
--
-- /See:/ 'newShareResult' smart constructor.
data ShareResult = ShareResult'
  { -- | The status.
    ShareResult -> Maybe ShareStatusType
status :: Prelude.Maybe ShareStatusType,
    -- | The ID of the principal.
    ShareResult -> Maybe Text
principalId :: Prelude.Maybe Prelude.Text,
    -- | The ID of the invited user.
    ShareResult -> Maybe Text
inviteePrincipalId :: Prelude.Maybe Prelude.Text,
    -- | The role.
    ShareResult -> Maybe RoleType
role' :: Prelude.Maybe RoleType,
    -- | The status message.
    ShareResult -> Maybe (Sensitive Text)
statusMessage :: Prelude.Maybe (Core.Sensitive Prelude.Text),
    -- | The ID of the resource that was shared.
    ShareResult -> Maybe Text
shareId :: Prelude.Maybe Prelude.Text
  }
  deriving (ShareResult -> ShareResult -> Bool
(ShareResult -> ShareResult -> Bool)
-> (ShareResult -> ShareResult -> Bool) -> Eq ShareResult
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ShareResult -> ShareResult -> Bool
$c/= :: ShareResult -> ShareResult -> Bool
== :: ShareResult -> ShareResult -> Bool
$c== :: ShareResult -> ShareResult -> Bool
Prelude.Eq, Int -> ShareResult -> ShowS
[ShareResult] -> ShowS
ShareResult -> String
(Int -> ShareResult -> ShowS)
-> (ShareResult -> String)
-> ([ShareResult] -> ShowS)
-> Show ShareResult
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ShareResult] -> ShowS
$cshowList :: [ShareResult] -> ShowS
show :: ShareResult -> String
$cshow :: ShareResult -> String
showsPrec :: Int -> ShareResult -> ShowS
$cshowsPrec :: Int -> ShareResult -> ShowS
Prelude.Show, (forall x. ShareResult -> Rep ShareResult x)
-> (forall x. Rep ShareResult x -> ShareResult)
-> Generic ShareResult
forall x. Rep ShareResult x -> ShareResult
forall x. ShareResult -> Rep ShareResult x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ShareResult x -> ShareResult
$cfrom :: forall x. ShareResult -> Rep ShareResult x
Prelude.Generic)

-- |
-- Create a value of 'ShareResult' 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:
--
-- 'status', 'shareResult_status' - The status.
--
-- 'principalId', 'shareResult_principalId' - The ID of the principal.
--
-- 'inviteePrincipalId', 'shareResult_inviteePrincipalId' - The ID of the invited user.
--
-- 'role'', 'shareResult_role' - The role.
--
-- 'statusMessage', 'shareResult_statusMessage' - The status message.
--
-- 'shareId', 'shareResult_shareId' - The ID of the resource that was shared.
newShareResult ::
  ShareResult
newShareResult :: ShareResult
newShareResult =
  ShareResult' :: Maybe ShareStatusType
-> Maybe Text
-> Maybe Text
-> Maybe RoleType
-> Maybe (Sensitive Text)
-> Maybe Text
-> ShareResult
ShareResult'
    { $sel:status:ShareResult' :: Maybe ShareStatusType
status = Maybe ShareStatusType
forall a. Maybe a
Prelude.Nothing,
      $sel:principalId:ShareResult' :: Maybe Text
principalId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:inviteePrincipalId:ShareResult' :: Maybe Text
inviteePrincipalId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:role':ShareResult' :: Maybe RoleType
role' = Maybe RoleType
forall a. Maybe a
Prelude.Nothing,
      $sel:statusMessage:ShareResult' :: Maybe (Sensitive Text)
statusMessage = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:shareId:ShareResult' :: Maybe Text
shareId = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The status.
shareResult_status :: Lens.Lens' ShareResult (Prelude.Maybe ShareStatusType)
shareResult_status :: (Maybe ShareStatusType -> f (Maybe ShareStatusType))
-> ShareResult -> f ShareResult
shareResult_status = (ShareResult -> Maybe ShareStatusType)
-> (ShareResult -> Maybe ShareStatusType -> ShareResult)
-> Lens
     ShareResult
     ShareResult
     (Maybe ShareStatusType)
     (Maybe ShareStatusType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ShareResult' {Maybe ShareStatusType
status :: Maybe ShareStatusType
$sel:status:ShareResult' :: ShareResult -> Maybe ShareStatusType
status} -> Maybe ShareStatusType
status) (\s :: ShareResult
s@ShareResult' {} Maybe ShareStatusType
a -> ShareResult
s {$sel:status:ShareResult' :: Maybe ShareStatusType
status = Maybe ShareStatusType
a} :: ShareResult)

-- | The ID of the principal.
shareResult_principalId :: Lens.Lens' ShareResult (Prelude.Maybe Prelude.Text)
shareResult_principalId :: (Maybe Text -> f (Maybe Text)) -> ShareResult -> f ShareResult
shareResult_principalId = (ShareResult -> Maybe Text)
-> (ShareResult -> Maybe Text -> ShareResult)
-> Lens ShareResult ShareResult (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ShareResult' {Maybe Text
principalId :: Maybe Text
$sel:principalId:ShareResult' :: ShareResult -> Maybe Text
principalId} -> Maybe Text
principalId) (\s :: ShareResult
s@ShareResult' {} Maybe Text
a -> ShareResult
s {$sel:principalId:ShareResult' :: Maybe Text
principalId = Maybe Text
a} :: ShareResult)

-- | The ID of the invited user.
shareResult_inviteePrincipalId :: Lens.Lens' ShareResult (Prelude.Maybe Prelude.Text)
shareResult_inviteePrincipalId :: (Maybe Text -> f (Maybe Text)) -> ShareResult -> f ShareResult
shareResult_inviteePrincipalId = (ShareResult -> Maybe Text)
-> (ShareResult -> Maybe Text -> ShareResult)
-> Lens ShareResult ShareResult (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ShareResult' {Maybe Text
inviteePrincipalId :: Maybe Text
$sel:inviteePrincipalId:ShareResult' :: ShareResult -> Maybe Text
inviteePrincipalId} -> Maybe Text
inviteePrincipalId) (\s :: ShareResult
s@ShareResult' {} Maybe Text
a -> ShareResult
s {$sel:inviteePrincipalId:ShareResult' :: Maybe Text
inviteePrincipalId = Maybe Text
a} :: ShareResult)

-- | The role.
shareResult_role :: Lens.Lens' ShareResult (Prelude.Maybe RoleType)
shareResult_role :: (Maybe RoleType -> f (Maybe RoleType))
-> ShareResult -> f ShareResult
shareResult_role = (ShareResult -> Maybe RoleType)
-> (ShareResult -> Maybe RoleType -> ShareResult)
-> Lens ShareResult ShareResult (Maybe RoleType) (Maybe RoleType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ShareResult' {Maybe RoleType
role' :: Maybe RoleType
$sel:role':ShareResult' :: ShareResult -> Maybe RoleType
role'} -> Maybe RoleType
role') (\s :: ShareResult
s@ShareResult' {} Maybe RoleType
a -> ShareResult
s {$sel:role':ShareResult' :: Maybe RoleType
role' = Maybe RoleType
a} :: ShareResult)

-- | The status message.
shareResult_statusMessage :: Lens.Lens' ShareResult (Prelude.Maybe Prelude.Text)
shareResult_statusMessage :: (Maybe Text -> f (Maybe Text)) -> ShareResult -> f ShareResult
shareResult_statusMessage = (ShareResult -> Maybe (Sensitive Text))
-> (ShareResult -> Maybe (Sensitive Text) -> ShareResult)
-> Lens
     ShareResult
     ShareResult
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ShareResult' {Maybe (Sensitive Text)
statusMessage :: Maybe (Sensitive Text)
$sel:statusMessage:ShareResult' :: ShareResult -> Maybe (Sensitive Text)
statusMessage} -> Maybe (Sensitive Text)
statusMessage) (\s :: ShareResult
s@ShareResult' {} Maybe (Sensitive Text)
a -> ShareResult
s {$sel:statusMessage:ShareResult' :: Maybe (Sensitive Text)
statusMessage = Maybe (Sensitive Text)
a} :: ShareResult) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> ShareResult -> f ShareResult)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> ShareResult
-> f ShareResult
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
     (Maybe Text)
     (Maybe Text)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive

-- | The ID of the resource that was shared.
shareResult_shareId :: Lens.Lens' ShareResult (Prelude.Maybe Prelude.Text)
shareResult_shareId :: (Maybe Text -> f (Maybe Text)) -> ShareResult -> f ShareResult
shareResult_shareId = (ShareResult -> Maybe Text)
-> (ShareResult -> Maybe Text -> ShareResult)
-> Lens ShareResult ShareResult (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ShareResult' {Maybe Text
shareId :: Maybe Text
$sel:shareId:ShareResult' :: ShareResult -> Maybe Text
shareId} -> Maybe Text
shareId) (\s :: ShareResult
s@ShareResult' {} Maybe Text
a -> ShareResult
s {$sel:shareId:ShareResult' :: Maybe Text
shareId = Maybe Text
a} :: ShareResult)

instance Core.FromJSON ShareResult where
  parseJSON :: Value -> Parser ShareResult
parseJSON =
    String
-> (Object -> Parser ShareResult) -> Value -> Parser ShareResult
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ShareResult"
      ( \Object
x ->
          Maybe ShareStatusType
-> Maybe Text
-> Maybe Text
-> Maybe RoleType
-> Maybe (Sensitive Text)
-> Maybe Text
-> ShareResult
ShareResult'
            (Maybe ShareStatusType
 -> Maybe Text
 -> Maybe Text
 -> Maybe RoleType
 -> Maybe (Sensitive Text)
 -> Maybe Text
 -> ShareResult)
-> Parser (Maybe ShareStatusType)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe RoleType
      -> Maybe (Sensitive Text)
      -> Maybe Text
      -> ShareResult)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe ShareStatusType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Status")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe RoleType
   -> Maybe (Sensitive Text)
   -> Maybe Text
   -> ShareResult)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe RoleType
      -> Maybe (Sensitive Text)
      -> Maybe Text
      -> ShareResult)
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
"PrincipalId")
            Parser
  (Maybe Text
   -> Maybe RoleType
   -> Maybe (Sensitive Text)
   -> Maybe Text
   -> ShareResult)
-> Parser (Maybe Text)
-> Parser
     (Maybe RoleType
      -> Maybe (Sensitive Text) -> Maybe Text -> ShareResult)
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
"InviteePrincipalId")
            Parser
  (Maybe RoleType
   -> Maybe (Sensitive Text) -> Maybe Text -> ShareResult)
-> Parser (Maybe RoleType)
-> Parser (Maybe (Sensitive Text) -> Maybe Text -> ShareResult)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe RoleType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Role")
            Parser (Maybe (Sensitive Text) -> Maybe Text -> ShareResult)
-> Parser (Maybe (Sensitive Text))
-> Parser (Maybe Text -> ShareResult)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Sensitive Text))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"StatusMessage")
            Parser (Maybe Text -> ShareResult)
-> Parser (Maybe Text) -> Parser ShareResult
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
"ShareId")
      )

instance Prelude.Hashable ShareResult

instance Prelude.NFData ShareResult