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

import Amazonka.Chime.Types.AppInstanceDataType
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The details of the streaming configuration of an @AppInstance@.
--
-- /See:/ 'newAppInstanceStreamingConfiguration' smart constructor.
data AppInstanceStreamingConfiguration = AppInstanceStreamingConfiguration'
  { -- | The type of data to be streamed.
    AppInstanceStreamingConfiguration -> AppInstanceDataType
appInstanceDataType :: AppInstanceDataType,
    -- | The resource ARN.
    AppInstanceStreamingConfiguration -> Sensitive Text
resourceArn :: Core.Sensitive Prelude.Text
  }
  deriving (AppInstanceStreamingConfiguration
-> AppInstanceStreamingConfiguration -> Bool
(AppInstanceStreamingConfiguration
 -> AppInstanceStreamingConfiguration -> Bool)
-> (AppInstanceStreamingConfiguration
    -> AppInstanceStreamingConfiguration -> Bool)
-> Eq AppInstanceStreamingConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AppInstanceStreamingConfiguration
-> AppInstanceStreamingConfiguration -> Bool
$c/= :: AppInstanceStreamingConfiguration
-> AppInstanceStreamingConfiguration -> Bool
== :: AppInstanceStreamingConfiguration
-> AppInstanceStreamingConfiguration -> Bool
$c== :: AppInstanceStreamingConfiguration
-> AppInstanceStreamingConfiguration -> Bool
Prelude.Eq, Int -> AppInstanceStreamingConfiguration -> ShowS
[AppInstanceStreamingConfiguration] -> ShowS
AppInstanceStreamingConfiguration -> String
(Int -> AppInstanceStreamingConfiguration -> ShowS)
-> (AppInstanceStreamingConfiguration -> String)
-> ([AppInstanceStreamingConfiguration] -> ShowS)
-> Show AppInstanceStreamingConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AppInstanceStreamingConfiguration] -> ShowS
$cshowList :: [AppInstanceStreamingConfiguration] -> ShowS
show :: AppInstanceStreamingConfiguration -> String
$cshow :: AppInstanceStreamingConfiguration -> String
showsPrec :: Int -> AppInstanceStreamingConfiguration -> ShowS
$cshowsPrec :: Int -> AppInstanceStreamingConfiguration -> ShowS
Prelude.Show, (forall x.
 AppInstanceStreamingConfiguration
 -> Rep AppInstanceStreamingConfiguration x)
-> (forall x.
    Rep AppInstanceStreamingConfiguration x
    -> AppInstanceStreamingConfiguration)
-> Generic AppInstanceStreamingConfiguration
forall x.
Rep AppInstanceStreamingConfiguration x
-> AppInstanceStreamingConfiguration
forall x.
AppInstanceStreamingConfiguration
-> Rep AppInstanceStreamingConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AppInstanceStreamingConfiguration x
-> AppInstanceStreamingConfiguration
$cfrom :: forall x.
AppInstanceStreamingConfiguration
-> Rep AppInstanceStreamingConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'AppInstanceStreamingConfiguration' 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:
--
-- 'appInstanceDataType', 'appInstanceStreamingConfiguration_appInstanceDataType' - The type of data to be streamed.
--
-- 'resourceArn', 'appInstanceStreamingConfiguration_resourceArn' - The resource ARN.
newAppInstanceStreamingConfiguration ::
  -- | 'appInstanceDataType'
  AppInstanceDataType ->
  -- | 'resourceArn'
  Prelude.Text ->
  AppInstanceStreamingConfiguration
newAppInstanceStreamingConfiguration :: AppInstanceDataType -> Text -> AppInstanceStreamingConfiguration
newAppInstanceStreamingConfiguration
  AppInstanceDataType
pAppInstanceDataType_
  Text
pResourceArn_ =
    AppInstanceStreamingConfiguration' :: AppInstanceDataType
-> Sensitive Text -> AppInstanceStreamingConfiguration
AppInstanceStreamingConfiguration'
      { $sel:appInstanceDataType:AppInstanceStreamingConfiguration' :: AppInstanceDataType
appInstanceDataType =
          AppInstanceDataType
pAppInstanceDataType_,
        $sel:resourceArn:AppInstanceStreamingConfiguration' :: Sensitive Text
resourceArn =
          Tagged Text (Identity Text)
-> Tagged (Sensitive Text) (Identity (Sensitive Text))
forall a. Iso' (Sensitive a) a
Core._Sensitive (Tagged Text (Identity Text)
 -> Tagged (Sensitive Text) (Identity (Sensitive Text)))
-> Text -> Sensitive Text
forall t b. AReview t b -> b -> t
Lens.# Text
pResourceArn_
      }

-- | The type of data to be streamed.
appInstanceStreamingConfiguration_appInstanceDataType :: Lens.Lens' AppInstanceStreamingConfiguration AppInstanceDataType
appInstanceStreamingConfiguration_appInstanceDataType :: (AppInstanceDataType -> f AppInstanceDataType)
-> AppInstanceStreamingConfiguration
-> f AppInstanceStreamingConfiguration
appInstanceStreamingConfiguration_appInstanceDataType = (AppInstanceStreamingConfiguration -> AppInstanceDataType)
-> (AppInstanceStreamingConfiguration
    -> AppInstanceDataType -> AppInstanceStreamingConfiguration)
-> Lens
     AppInstanceStreamingConfiguration
     AppInstanceStreamingConfiguration
     AppInstanceDataType
     AppInstanceDataType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AppInstanceStreamingConfiguration' {AppInstanceDataType
appInstanceDataType :: AppInstanceDataType
$sel:appInstanceDataType:AppInstanceStreamingConfiguration' :: AppInstanceStreamingConfiguration -> AppInstanceDataType
appInstanceDataType} -> AppInstanceDataType
appInstanceDataType) (\s :: AppInstanceStreamingConfiguration
s@AppInstanceStreamingConfiguration' {} AppInstanceDataType
a -> AppInstanceStreamingConfiguration
s {$sel:appInstanceDataType:AppInstanceStreamingConfiguration' :: AppInstanceDataType
appInstanceDataType = AppInstanceDataType
a} :: AppInstanceStreamingConfiguration)

-- | The resource ARN.
appInstanceStreamingConfiguration_resourceArn :: Lens.Lens' AppInstanceStreamingConfiguration Prelude.Text
appInstanceStreamingConfiguration_resourceArn :: (Text -> f Text)
-> AppInstanceStreamingConfiguration
-> f AppInstanceStreamingConfiguration
appInstanceStreamingConfiguration_resourceArn = (AppInstanceStreamingConfiguration -> Sensitive Text)
-> (AppInstanceStreamingConfiguration
    -> Sensitive Text -> AppInstanceStreamingConfiguration)
-> Lens
     AppInstanceStreamingConfiguration
     AppInstanceStreamingConfiguration
     (Sensitive Text)
     (Sensitive Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AppInstanceStreamingConfiguration' {Sensitive Text
resourceArn :: Sensitive Text
$sel:resourceArn:AppInstanceStreamingConfiguration' :: AppInstanceStreamingConfiguration -> Sensitive Text
resourceArn} -> Sensitive Text
resourceArn) (\s :: AppInstanceStreamingConfiguration
s@AppInstanceStreamingConfiguration' {} Sensitive Text
a -> AppInstanceStreamingConfiguration
s {$sel:resourceArn:AppInstanceStreamingConfiguration' :: Sensitive Text
resourceArn = Sensitive Text
a} :: AppInstanceStreamingConfiguration) ((Sensitive Text -> f (Sensitive Text))
 -> AppInstanceStreamingConfiguration
 -> f AppInstanceStreamingConfiguration)
-> ((Text -> f Text) -> Sensitive Text -> f (Sensitive Text))
-> (Text -> f Text)
-> AppInstanceStreamingConfiguration
-> f AppInstanceStreamingConfiguration
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> f Text) -> Sensitive Text -> f (Sensitive Text)
forall a. Iso' (Sensitive a) a
Core._Sensitive

instance
  Core.FromJSON
    AppInstanceStreamingConfiguration
  where
  parseJSON :: Value -> Parser AppInstanceStreamingConfiguration
parseJSON =
    String
-> (Object -> Parser AppInstanceStreamingConfiguration)
-> Value
-> Parser AppInstanceStreamingConfiguration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AppInstanceStreamingConfiguration"
      ( \Object
x ->
          AppInstanceDataType
-> Sensitive Text -> AppInstanceStreamingConfiguration
AppInstanceStreamingConfiguration'
            (AppInstanceDataType
 -> Sensitive Text -> AppInstanceStreamingConfiguration)
-> Parser AppInstanceDataType
-> Parser (Sensitive Text -> AppInstanceStreamingConfiguration)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser AppInstanceDataType
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"AppInstanceDataType")
            Parser (Sensitive Text -> AppInstanceStreamingConfiguration)
-> Parser (Sensitive Text)
-> Parser AppInstanceStreamingConfiguration
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Sensitive Text)
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"ResourceArn")
      )

instance
  Prelude.Hashable
    AppInstanceStreamingConfiguration

instance
  Prelude.NFData
    AppInstanceStreamingConfiguration

instance
  Core.ToJSON
    AppInstanceStreamingConfiguration
  where
  toJSON :: AppInstanceStreamingConfiguration -> Value
toJSON AppInstanceStreamingConfiguration' {Sensitive Text
AppInstanceDataType
resourceArn :: Sensitive Text
appInstanceDataType :: AppInstanceDataType
$sel:resourceArn:AppInstanceStreamingConfiguration' :: AppInstanceStreamingConfiguration -> Sensitive Text
$sel:appInstanceDataType:AppInstanceStreamingConfiguration' :: AppInstanceStreamingConfiguration -> AppInstanceDataType
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"AppInstanceDataType" Text -> AppInstanceDataType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= AppInstanceDataType
appInstanceDataType),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ResourceArn" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Sensitive Text
resourceArn)
          ]
      )