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

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

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

-- |
-- Create a value of 'AppInstance' 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:
--
-- 'name', 'appInstance_name' - The name of an @AppInstance@.
--
-- 'metadata', 'appInstance_metadata' - The metadata of an @AppInstance@.
--
-- 'appInstanceArn', 'appInstance_appInstanceArn' - The ARN of the messaging instance.
--
-- 'createdTimestamp', 'appInstance_createdTimestamp' - The time at which an @AppInstance@ was created. In epoch milliseconds.
--
-- 'lastUpdatedTimestamp', 'appInstance_lastUpdatedTimestamp' - The time an @AppInstance@ was last updated. In epoch milliseconds.
newAppInstance ::
  AppInstance
newAppInstance :: AppInstance
newAppInstance =
  AppInstance' :: Maybe (Sensitive Text)
-> Maybe (Sensitive Text)
-> Maybe Text
-> Maybe POSIX
-> Maybe POSIX
-> AppInstance
AppInstance'
    { $sel:name:AppInstance' :: Maybe (Sensitive Text)
name = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:metadata:AppInstance' :: Maybe (Sensitive Text)
metadata = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:appInstanceArn:AppInstance' :: Maybe Text
appInstanceArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:createdTimestamp:AppInstance' :: Maybe POSIX
createdTimestamp = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:lastUpdatedTimestamp:AppInstance' :: Maybe POSIX
lastUpdatedTimestamp = Maybe POSIX
forall a. Maybe a
Prelude.Nothing
    }

-- | The name of an @AppInstance@.
appInstance_name :: Lens.Lens' AppInstance (Prelude.Maybe Prelude.Text)
appInstance_name :: (Maybe Text -> f (Maybe Text)) -> AppInstance -> f AppInstance
appInstance_name = (AppInstance -> Maybe (Sensitive Text))
-> (AppInstance -> Maybe (Sensitive Text) -> AppInstance)
-> Lens
     AppInstance
     AppInstance
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AppInstance' {Maybe (Sensitive Text)
name :: Maybe (Sensitive Text)
$sel:name:AppInstance' :: AppInstance -> Maybe (Sensitive Text)
name} -> Maybe (Sensitive Text)
name) (\s :: AppInstance
s@AppInstance' {} Maybe (Sensitive Text)
a -> AppInstance
s {$sel:name:AppInstance' :: Maybe (Sensitive Text)
name = Maybe (Sensitive Text)
a} :: AppInstance) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> AppInstance -> f AppInstance)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> AppInstance
-> f AppInstance
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 an @AppInstance@.
appInstance_metadata :: Lens.Lens' AppInstance (Prelude.Maybe Prelude.Text)
appInstance_metadata :: (Maybe Text -> f (Maybe Text)) -> AppInstance -> f AppInstance
appInstance_metadata = (AppInstance -> Maybe (Sensitive Text))
-> (AppInstance -> Maybe (Sensitive Text) -> AppInstance)
-> Lens
     AppInstance
     AppInstance
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AppInstance' {Maybe (Sensitive Text)
metadata :: Maybe (Sensitive Text)
$sel:metadata:AppInstance' :: AppInstance -> Maybe (Sensitive Text)
metadata} -> Maybe (Sensitive Text)
metadata) (\s :: AppInstance
s@AppInstance' {} Maybe (Sensitive Text)
a -> AppInstance
s {$sel:metadata:AppInstance' :: Maybe (Sensitive Text)
metadata = Maybe (Sensitive Text)
a} :: AppInstance) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> AppInstance -> f AppInstance)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> AppInstance
-> f AppInstance
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 ARN of the messaging instance.
appInstance_appInstanceArn :: Lens.Lens' AppInstance (Prelude.Maybe Prelude.Text)
appInstance_appInstanceArn :: (Maybe Text -> f (Maybe Text)) -> AppInstance -> f AppInstance
appInstance_appInstanceArn = (AppInstance -> Maybe Text)
-> (AppInstance -> Maybe Text -> AppInstance)
-> Lens AppInstance AppInstance (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AppInstance' {Maybe Text
appInstanceArn :: Maybe Text
$sel:appInstanceArn:AppInstance' :: AppInstance -> Maybe Text
appInstanceArn} -> Maybe Text
appInstanceArn) (\s :: AppInstance
s@AppInstance' {} Maybe Text
a -> AppInstance
s {$sel:appInstanceArn:AppInstance' :: Maybe Text
appInstanceArn = Maybe Text
a} :: AppInstance)

-- | The time at which an @AppInstance@ was created. In epoch milliseconds.
appInstance_createdTimestamp :: Lens.Lens' AppInstance (Prelude.Maybe Prelude.UTCTime)
appInstance_createdTimestamp :: (Maybe UTCTime -> f (Maybe UTCTime))
-> AppInstance -> f AppInstance
appInstance_createdTimestamp = (AppInstance -> Maybe POSIX)
-> (AppInstance -> Maybe POSIX -> AppInstance)
-> Lens AppInstance AppInstance (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AppInstance' {Maybe POSIX
createdTimestamp :: Maybe POSIX
$sel:createdTimestamp:AppInstance' :: AppInstance -> Maybe POSIX
createdTimestamp} -> Maybe POSIX
createdTimestamp) (\s :: AppInstance
s@AppInstance' {} Maybe POSIX
a -> AppInstance
s {$sel:createdTimestamp:AppInstance' :: Maybe POSIX
createdTimestamp = Maybe POSIX
a} :: AppInstance) ((Maybe POSIX -> f (Maybe POSIX)) -> AppInstance -> f AppInstance)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> AppInstance
-> f AppInstance
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 an @AppInstance@ was last updated. In epoch milliseconds.
appInstance_lastUpdatedTimestamp :: Lens.Lens' AppInstance (Prelude.Maybe Prelude.UTCTime)
appInstance_lastUpdatedTimestamp :: (Maybe UTCTime -> f (Maybe UTCTime))
-> AppInstance -> f AppInstance
appInstance_lastUpdatedTimestamp = (AppInstance -> Maybe POSIX)
-> (AppInstance -> Maybe POSIX -> AppInstance)
-> Lens AppInstance AppInstance (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AppInstance' {Maybe POSIX
lastUpdatedTimestamp :: Maybe POSIX
$sel:lastUpdatedTimestamp:AppInstance' :: AppInstance -> Maybe POSIX
lastUpdatedTimestamp} -> Maybe POSIX
lastUpdatedTimestamp) (\s :: AppInstance
s@AppInstance' {} Maybe POSIX
a -> AppInstance
s {$sel:lastUpdatedTimestamp:AppInstance' :: Maybe POSIX
lastUpdatedTimestamp = Maybe POSIX
a} :: AppInstance) ((Maybe POSIX -> f (Maybe POSIX)) -> AppInstance -> f AppInstance)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> AppInstance
-> f AppInstance
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 AppInstance where
  parseJSON :: Value -> Parser AppInstance
parseJSON =
    String
-> (Object -> Parser AppInstance) -> Value -> Parser AppInstance
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AppInstance"
      ( \Object
x ->
          Maybe (Sensitive Text)
-> Maybe (Sensitive Text)
-> Maybe Text
-> Maybe POSIX
-> Maybe POSIX
-> AppInstance
AppInstance'
            (Maybe (Sensitive Text)
 -> Maybe (Sensitive Text)
 -> Maybe Text
 -> Maybe POSIX
 -> Maybe POSIX
 -> AppInstance)
-> Parser (Maybe (Sensitive Text))
-> Parser
     (Maybe (Sensitive Text)
      -> Maybe Text -> Maybe POSIX -> Maybe POSIX -> AppInstance)
forall (f :: * -> *) a b. Functor 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 Text -> Maybe POSIX -> Maybe POSIX -> AppInstance)
-> Parser (Maybe (Sensitive Text))
-> Parser (Maybe Text -> Maybe POSIX -> Maybe POSIX -> AppInstance)
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 Text -> Maybe POSIX -> Maybe POSIX -> AppInstance)
-> Parser (Maybe Text)
-> Parser (Maybe POSIX -> Maybe POSIX -> AppInstance)
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
"AppInstanceArn")
            Parser (Maybe POSIX -> Maybe POSIX -> AppInstance)
-> Parser (Maybe POSIX) -> Parser (Maybe POSIX -> AppInstance)
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 -> AppInstance)
-> Parser (Maybe POSIX) -> Parser AppInstance
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 AppInstance

instance Prelude.NFData AppInstance