{-# 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.Chime.Types.AppInstanceUser
-- 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.Chime.Types.AppInstanceUser where

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

-- | The details of an @AppInstanceUser@.
--
-- /See:/ 'newAppInstanceUser' smart constructor.
data AppInstanceUser = AppInstanceUser'
  { -- | The ARN of the @AppInstanceUser@.
    AppInstanceUser -> Maybe Text
appInstanceUserArn :: Prelude.Maybe Prelude.Text,
    -- | The name of the @AppInstanceUser@.
    AppInstanceUser -> Maybe (Sensitive Text)
name :: Prelude.Maybe (Core.Sensitive Prelude.Text),
    -- | The metadata of the @AppInstanceUser@.
    AppInstanceUser -> Maybe (Sensitive Text)
metadata :: Prelude.Maybe (Core.Sensitive Prelude.Text),
    -- | The time at which the @AppInstanceUser@ was created.
    AppInstanceUser -> Maybe POSIX
createdTimestamp :: Prelude.Maybe Core.POSIX,
    -- | The time at which the @AppInstanceUser@ was last updated.
    AppInstanceUser -> Maybe POSIX
lastUpdatedTimestamp :: Prelude.Maybe Core.POSIX
  }
  deriving (AppInstanceUser -> AppInstanceUser -> Bool
(AppInstanceUser -> AppInstanceUser -> Bool)
-> (AppInstanceUser -> AppInstanceUser -> Bool)
-> Eq AppInstanceUser
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AppInstanceUser -> AppInstanceUser -> Bool
$c/= :: AppInstanceUser -> AppInstanceUser -> Bool
== :: AppInstanceUser -> AppInstanceUser -> Bool
$c== :: AppInstanceUser -> AppInstanceUser -> Bool
Prelude.Eq, Int -> AppInstanceUser -> ShowS
[AppInstanceUser] -> ShowS
AppInstanceUser -> String
(Int -> AppInstanceUser -> ShowS)
-> (AppInstanceUser -> String)
-> ([AppInstanceUser] -> ShowS)
-> Show AppInstanceUser
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AppInstanceUser] -> ShowS
$cshowList :: [AppInstanceUser] -> ShowS
show :: AppInstanceUser -> String
$cshow :: AppInstanceUser -> String
showsPrec :: Int -> AppInstanceUser -> ShowS
$cshowsPrec :: Int -> AppInstanceUser -> ShowS
Prelude.Show, (forall x. AppInstanceUser -> Rep AppInstanceUser x)
-> (forall x. Rep AppInstanceUser x -> AppInstanceUser)
-> Generic AppInstanceUser
forall x. Rep AppInstanceUser x -> AppInstanceUser
forall x. AppInstanceUser -> Rep AppInstanceUser x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AppInstanceUser x -> AppInstanceUser
$cfrom :: forall x. AppInstanceUser -> Rep AppInstanceUser x
Prelude.Generic)

-- |
-- Create a value of 'AppInstanceUser' 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:
--
-- 'appInstanceUserArn', 'appInstanceUser_appInstanceUserArn' - The ARN of the @AppInstanceUser@.
--
-- 'name', 'appInstanceUser_name' - The name of the @AppInstanceUser@.
--
-- 'metadata', 'appInstanceUser_metadata' - The metadata of the @AppInstanceUser@.
--
-- 'createdTimestamp', 'appInstanceUser_createdTimestamp' - The time at which the @AppInstanceUser@ was created.
--
-- 'lastUpdatedTimestamp', 'appInstanceUser_lastUpdatedTimestamp' - The time at which the @AppInstanceUser@ was last updated.
newAppInstanceUser ::
  AppInstanceUser
newAppInstanceUser :: AppInstanceUser
newAppInstanceUser =
  AppInstanceUser' :: Maybe Text
-> Maybe (Sensitive Text)
-> Maybe (Sensitive Text)
-> Maybe POSIX
-> Maybe POSIX
-> AppInstanceUser
AppInstanceUser'
    { $sel:appInstanceUserArn:AppInstanceUser' :: Maybe Text
appInstanceUserArn =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:AppInstanceUser' :: Maybe (Sensitive Text)
name = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:metadata:AppInstanceUser' :: Maybe (Sensitive Text)
metadata = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:createdTimestamp:AppInstanceUser' :: Maybe POSIX
createdTimestamp = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:lastUpdatedTimestamp:AppInstanceUser' :: Maybe POSIX
lastUpdatedTimestamp = Maybe POSIX
forall a. Maybe a
Prelude.Nothing
    }

-- | The ARN of the @AppInstanceUser@.
appInstanceUser_appInstanceUserArn :: Lens.Lens' AppInstanceUser (Prelude.Maybe Prelude.Text)
appInstanceUser_appInstanceUserArn :: (Maybe Text -> f (Maybe Text))
-> AppInstanceUser -> f AppInstanceUser
appInstanceUser_appInstanceUserArn = (AppInstanceUser -> Maybe Text)
-> (AppInstanceUser -> Maybe Text -> AppInstanceUser)
-> Lens AppInstanceUser AppInstanceUser (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AppInstanceUser' {Maybe Text
appInstanceUserArn :: Maybe Text
$sel:appInstanceUserArn:AppInstanceUser' :: AppInstanceUser -> Maybe Text
appInstanceUserArn} -> Maybe Text
appInstanceUserArn) (\s :: AppInstanceUser
s@AppInstanceUser' {} Maybe Text
a -> AppInstanceUser
s {$sel:appInstanceUserArn:AppInstanceUser' :: Maybe Text
appInstanceUserArn = Maybe Text
a} :: AppInstanceUser)

-- | The name of the @AppInstanceUser@.
appInstanceUser_name :: Lens.Lens' AppInstanceUser (Prelude.Maybe Prelude.Text)
appInstanceUser_name :: (Maybe Text -> f (Maybe Text))
-> AppInstanceUser -> f AppInstanceUser
appInstanceUser_name = (AppInstanceUser -> Maybe (Sensitive Text))
-> (AppInstanceUser -> Maybe (Sensitive Text) -> AppInstanceUser)
-> Lens
     AppInstanceUser
     AppInstanceUser
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AppInstanceUser' {Maybe (Sensitive Text)
name :: Maybe (Sensitive Text)
$sel:name:AppInstanceUser' :: AppInstanceUser -> Maybe (Sensitive Text)
name} -> Maybe (Sensitive Text)
name) (\s :: AppInstanceUser
s@AppInstanceUser' {} Maybe (Sensitive Text)
a -> AppInstanceUser
s {$sel:name:AppInstanceUser' :: Maybe (Sensitive Text)
name = Maybe (Sensitive Text)
a} :: AppInstanceUser) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> AppInstanceUser -> f AppInstanceUser)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> AppInstanceUser
-> f AppInstanceUser
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 metadata of the @AppInstanceUser@.
appInstanceUser_metadata :: Lens.Lens' AppInstanceUser (Prelude.Maybe Prelude.Text)
appInstanceUser_metadata :: (Maybe Text -> f (Maybe Text))
-> AppInstanceUser -> f AppInstanceUser
appInstanceUser_metadata = (AppInstanceUser -> Maybe (Sensitive Text))
-> (AppInstanceUser -> Maybe (Sensitive Text) -> AppInstanceUser)
-> Lens
     AppInstanceUser
     AppInstanceUser
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AppInstanceUser' {Maybe (Sensitive Text)
metadata :: Maybe (Sensitive Text)
$sel:metadata:AppInstanceUser' :: AppInstanceUser -> Maybe (Sensitive Text)
metadata} -> Maybe (Sensitive Text)
metadata) (\s :: AppInstanceUser
s@AppInstanceUser' {} Maybe (Sensitive Text)
a -> AppInstanceUser
s {$sel:metadata:AppInstanceUser' :: Maybe (Sensitive Text)
metadata = Maybe (Sensitive Text)
a} :: AppInstanceUser) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> AppInstanceUser -> f AppInstanceUser)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> AppInstanceUser
-> f AppInstanceUser
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 time at which the @AppInstanceUser@ was created.
appInstanceUser_createdTimestamp :: Lens.Lens' AppInstanceUser (Prelude.Maybe Prelude.UTCTime)
appInstanceUser_createdTimestamp :: (Maybe UTCTime -> f (Maybe UTCTime))
-> AppInstanceUser -> f AppInstanceUser
appInstanceUser_createdTimestamp = (AppInstanceUser -> Maybe POSIX)
-> (AppInstanceUser -> Maybe POSIX -> AppInstanceUser)
-> Lens AppInstanceUser AppInstanceUser (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AppInstanceUser' {Maybe POSIX
createdTimestamp :: Maybe POSIX
$sel:createdTimestamp:AppInstanceUser' :: AppInstanceUser -> Maybe POSIX
createdTimestamp} -> Maybe POSIX
createdTimestamp) (\s :: AppInstanceUser
s@AppInstanceUser' {} Maybe POSIX
a -> AppInstanceUser
s {$sel:createdTimestamp:AppInstanceUser' :: Maybe POSIX
createdTimestamp = Maybe POSIX
a} :: AppInstanceUser) ((Maybe POSIX -> f (Maybe POSIX))
 -> AppInstanceUser -> f AppInstanceUser)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> AppInstanceUser
-> f AppInstanceUser
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The time at which the @AppInstanceUser@ was last updated.
appInstanceUser_lastUpdatedTimestamp :: Lens.Lens' AppInstanceUser (Prelude.Maybe Prelude.UTCTime)
appInstanceUser_lastUpdatedTimestamp :: (Maybe UTCTime -> f (Maybe UTCTime))
-> AppInstanceUser -> f AppInstanceUser
appInstanceUser_lastUpdatedTimestamp = (AppInstanceUser -> Maybe POSIX)
-> (AppInstanceUser -> Maybe POSIX -> AppInstanceUser)
-> Lens AppInstanceUser AppInstanceUser (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AppInstanceUser' {Maybe POSIX
lastUpdatedTimestamp :: Maybe POSIX
$sel:lastUpdatedTimestamp:AppInstanceUser' :: AppInstanceUser -> Maybe POSIX
lastUpdatedTimestamp} -> Maybe POSIX
lastUpdatedTimestamp) (\s :: AppInstanceUser
s@AppInstanceUser' {} Maybe POSIX
a -> AppInstanceUser
s {$sel:lastUpdatedTimestamp:AppInstanceUser' :: Maybe POSIX
lastUpdatedTimestamp = Maybe POSIX
a} :: AppInstanceUser) ((Maybe POSIX -> f (Maybe POSIX))
 -> AppInstanceUser -> f AppInstanceUser)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> AppInstanceUser
-> f AppInstanceUser
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

instance Core.FromJSON AppInstanceUser where
  parseJSON :: Value -> Parser AppInstanceUser
parseJSON =
    String
-> (Object -> Parser AppInstanceUser)
-> Value
-> Parser AppInstanceUser
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AppInstanceUser"
      ( \Object
x ->
          Maybe Text
-> Maybe (Sensitive Text)
-> Maybe (Sensitive Text)
-> Maybe POSIX
-> Maybe POSIX
-> AppInstanceUser
AppInstanceUser'
            (Maybe Text
 -> Maybe (Sensitive Text)
 -> Maybe (Sensitive Text)
 -> Maybe POSIX
 -> Maybe POSIX
 -> AppInstanceUser)
-> Parser (Maybe Text)
-> Parser
     (Maybe (Sensitive Text)
      -> Maybe (Sensitive Text)
      -> Maybe POSIX
      -> Maybe POSIX
      -> AppInstanceUser)
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
"AppInstanceUserArn")
            Parser
  (Maybe (Sensitive Text)
   -> Maybe (Sensitive Text)
   -> Maybe POSIX
   -> Maybe POSIX
   -> AppInstanceUser)
-> Parser (Maybe (Sensitive Text))
-> Parser
     (Maybe (Sensitive Text)
      -> Maybe POSIX -> Maybe POSIX -> AppInstanceUser)
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
"Name")
            Parser
  (Maybe (Sensitive Text)
   -> Maybe POSIX -> Maybe POSIX -> AppInstanceUser)
-> Parser (Maybe (Sensitive Text))
-> Parser (Maybe POSIX -> Maybe POSIX -> AppInstanceUser)
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
"Metadata")
            Parser (Maybe POSIX -> Maybe POSIX -> AppInstanceUser)
-> Parser (Maybe POSIX) -> Parser (Maybe POSIX -> AppInstanceUser)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CreatedTimestamp")
            Parser (Maybe POSIX -> AppInstanceUser)
-> Parser (Maybe POSIX) -> Parser AppInstanceUser
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"LastUpdatedTimestamp")
      )

instance Prelude.Hashable AppInstanceUser

instance Prelude.NFData AppInstanceUser