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

-- | The details of an @AppInstance@, an instance of an Amazon Chime SDK
-- messaging application.
--
-- /See:/ 'newAppInstance' smart constructor.
data AppInstance = AppInstance'
  { -- | 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 Data.POSIX,
    -- | The time an @AppInstance@ was last updated. In epoch milliseconds.
    AppInstance -> Maybe POSIX
lastUpdatedTimestamp :: Prelude.Maybe Data.POSIX,
    -- | The metadata of an @AppInstance@.
    AppInstance -> Maybe (Sensitive Text)
metadata :: Prelude.Maybe (Data.Sensitive Prelude.Text),
    -- | The name of an @AppInstance@.
    AppInstance -> Maybe (Sensitive Text)
name :: Prelude.Maybe (Data.Sensitive Prelude.Text)
  }
  deriving (AppInstance -> AppInstance -> Bool
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
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. 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:
--
-- '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.
--
-- 'metadata', 'appInstance_metadata' - The metadata of an @AppInstance@.
--
-- 'name', 'appInstance_name' - The name of an @AppInstance@.
newAppInstance ::
  AppInstance
newAppInstance :: AppInstance
newAppInstance =
  AppInstance'
    { $sel:appInstanceArn:AppInstance' :: Maybe Text
appInstanceArn = forall a. Maybe a
Prelude.Nothing,
      $sel:createdTimestamp:AppInstance' :: Maybe POSIX
createdTimestamp = forall a. Maybe a
Prelude.Nothing,
      $sel:lastUpdatedTimestamp:AppInstance' :: Maybe POSIX
lastUpdatedTimestamp = forall a. Maybe a
Prelude.Nothing,
      $sel:metadata:AppInstance' :: Maybe (Sensitive Text)
metadata = forall a. Maybe a
Prelude.Nothing,
      $sel:name:AppInstance' :: Maybe (Sensitive Text)
name = forall a. Maybe a
Prelude.Nothing
    }

-- | The ARN of the messaging instance.
appInstance_appInstanceArn :: Lens.Lens' AppInstance (Prelude.Maybe Prelude.Text)
appInstance_appInstanceArn :: Lens' AppInstance (Maybe Text)
appInstance_appInstanceArn = 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 :: Lens' AppInstance (Maybe UTCTime)
appInstance_createdTimestamp = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The time an @AppInstance@ was last updated. In epoch milliseconds.
appInstance_lastUpdatedTimestamp :: Lens.Lens' AppInstance (Prelude.Maybe Prelude.UTCTime)
appInstance_lastUpdatedTimestamp :: Lens' AppInstance (Maybe UTCTime)
appInstance_lastUpdatedTimestamp = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The metadata of an @AppInstance@.
appInstance_metadata :: Lens.Lens' AppInstance (Prelude.Maybe Prelude.Text)
appInstance_metadata :: Lens' AppInstance (Maybe Text)
appInstance_metadata = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall a. Iso' (Sensitive a) a
Data._Sensitive

-- | The name of an @AppInstance@.
appInstance_name :: Lens.Lens' AppInstance (Prelude.Maybe Prelude.Text)
appInstance_name :: Lens' AppInstance (Maybe Text)
appInstance_name = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall a. Iso' (Sensitive a) a
Data._Sensitive

instance Data.FromJSON AppInstance where
  parseJSON :: Value -> Parser AppInstance
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"AppInstance"
      ( \Object
x ->
          Maybe Text
-> Maybe POSIX
-> Maybe POSIX
-> Maybe (Sensitive Text)
-> Maybe (Sensitive Text)
-> AppInstance
AppInstance'
            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
"AppInstanceArn")
            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
"CreatedTimestamp")
            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
"LastUpdatedTimestamp")
            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
"Metadata")
            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
"Name")
      )

instance Prelude.Hashable AppInstance where
  hashWithSalt :: Int -> AppInstance -> Int
hashWithSalt Int
_salt AppInstance' {Maybe Text
Maybe (Sensitive Text)
Maybe POSIX
name :: Maybe (Sensitive Text)
metadata :: Maybe (Sensitive Text)
lastUpdatedTimestamp :: Maybe POSIX
createdTimestamp :: Maybe POSIX
appInstanceArn :: Maybe Text
$sel:name:AppInstance' :: AppInstance -> Maybe (Sensitive Text)
$sel:metadata:AppInstance' :: AppInstance -> Maybe (Sensitive Text)
$sel:lastUpdatedTimestamp:AppInstance' :: AppInstance -> Maybe POSIX
$sel:createdTimestamp:AppInstance' :: AppInstance -> Maybe POSIX
$sel:appInstanceArn:AppInstance' :: AppInstance -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
appInstanceArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
createdTimestamp
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
lastUpdatedTimestamp
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (Sensitive Text)
metadata
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (Sensitive Text)
name

instance Prelude.NFData AppInstance where
  rnf :: AppInstance -> ()
rnf AppInstance' {Maybe Text
Maybe (Sensitive Text)
Maybe POSIX
name :: Maybe (Sensitive Text)
metadata :: Maybe (Sensitive Text)
lastUpdatedTimestamp :: Maybe POSIX
createdTimestamp :: Maybe POSIX
appInstanceArn :: Maybe Text
$sel:name:AppInstance' :: AppInstance -> Maybe (Sensitive Text)
$sel:metadata:AppInstance' :: AppInstance -> Maybe (Sensitive Text)
$sel:lastUpdatedTimestamp:AppInstance' :: AppInstance -> Maybe POSIX
$sel:createdTimestamp:AppInstance' :: AppInstance -> Maybe POSIX
$sel:appInstanceArn:AppInstance' :: AppInstance -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
appInstanceArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
createdTimestamp
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
lastUpdatedTimestamp
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (Sensitive Text)
metadata
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (Sensitive Text)
name