{-# 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.Nimble.Types.StreamConfigurationSessionStorage
-- 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.Nimble.Types.StreamConfigurationSessionStorage where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Nimble.Types.StreamingSessionStorageMode
import Amazonka.Nimble.Types.StreamingSessionStorageRoot
import qualified Amazonka.Prelude as Prelude

-- | The configuration for a streaming session’s upload storage.
--
-- /See:/ 'newStreamConfigurationSessionStorage' smart constructor.
data StreamConfigurationSessionStorage = StreamConfigurationSessionStorage'
  { -- | The configuration for the upload storage root of the streaming session.
    StreamConfigurationSessionStorage
-> Maybe StreamingSessionStorageRoot
root :: Prelude.Maybe StreamingSessionStorageRoot,
    -- | Allows artists to upload files to their workstations. The only valid
    -- option is @UPLOAD@.
    StreamConfigurationSessionStorage
-> NonEmpty StreamingSessionStorageMode
mode :: Prelude.NonEmpty StreamingSessionStorageMode
  }
  deriving (StreamConfigurationSessionStorage
-> StreamConfigurationSessionStorage -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StreamConfigurationSessionStorage
-> StreamConfigurationSessionStorage -> Bool
$c/= :: StreamConfigurationSessionStorage
-> StreamConfigurationSessionStorage -> Bool
== :: StreamConfigurationSessionStorage
-> StreamConfigurationSessionStorage -> Bool
$c== :: StreamConfigurationSessionStorage
-> StreamConfigurationSessionStorage -> Bool
Prelude.Eq, Int -> StreamConfigurationSessionStorage -> ShowS
[StreamConfigurationSessionStorage] -> ShowS
StreamConfigurationSessionStorage -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StreamConfigurationSessionStorage] -> ShowS
$cshowList :: [StreamConfigurationSessionStorage] -> ShowS
show :: StreamConfigurationSessionStorage -> String
$cshow :: StreamConfigurationSessionStorage -> String
showsPrec :: Int -> StreamConfigurationSessionStorage -> ShowS
$cshowsPrec :: Int -> StreamConfigurationSessionStorage -> ShowS
Prelude.Show, forall x.
Rep StreamConfigurationSessionStorage x
-> StreamConfigurationSessionStorage
forall x.
StreamConfigurationSessionStorage
-> Rep StreamConfigurationSessionStorage x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep StreamConfigurationSessionStorage x
-> StreamConfigurationSessionStorage
$cfrom :: forall x.
StreamConfigurationSessionStorage
-> Rep StreamConfigurationSessionStorage x
Prelude.Generic)

-- |
-- Create a value of 'StreamConfigurationSessionStorage' 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:
--
-- 'root', 'streamConfigurationSessionStorage_root' - The configuration for the upload storage root of the streaming session.
--
-- 'mode', 'streamConfigurationSessionStorage_mode' - Allows artists to upload files to their workstations. The only valid
-- option is @UPLOAD@.
newStreamConfigurationSessionStorage ::
  -- | 'mode'
  Prelude.NonEmpty StreamingSessionStorageMode ->
  StreamConfigurationSessionStorage
newStreamConfigurationSessionStorage :: NonEmpty StreamingSessionStorageMode
-> StreamConfigurationSessionStorage
newStreamConfigurationSessionStorage NonEmpty StreamingSessionStorageMode
pMode_ =
  StreamConfigurationSessionStorage'
    { $sel:root:StreamConfigurationSessionStorage' :: Maybe StreamingSessionStorageRoot
root =
        forall a. Maybe a
Prelude.Nothing,
      $sel:mode:StreamConfigurationSessionStorage' :: NonEmpty StreamingSessionStorageMode
mode = forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced forall t b. AReview t b -> b -> t
Lens.# NonEmpty StreamingSessionStorageMode
pMode_
    }

-- | The configuration for the upload storage root of the streaming session.
streamConfigurationSessionStorage_root :: Lens.Lens' StreamConfigurationSessionStorage (Prelude.Maybe StreamingSessionStorageRoot)
streamConfigurationSessionStorage_root :: Lens'
  StreamConfigurationSessionStorage
  (Maybe StreamingSessionStorageRoot)
streamConfigurationSessionStorage_root = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StreamConfigurationSessionStorage' {Maybe StreamingSessionStorageRoot
root :: Maybe StreamingSessionStorageRoot
$sel:root:StreamConfigurationSessionStorage' :: StreamConfigurationSessionStorage
-> Maybe StreamingSessionStorageRoot
root} -> Maybe StreamingSessionStorageRoot
root) (\s :: StreamConfigurationSessionStorage
s@StreamConfigurationSessionStorage' {} Maybe StreamingSessionStorageRoot
a -> StreamConfigurationSessionStorage
s {$sel:root:StreamConfigurationSessionStorage' :: Maybe StreamingSessionStorageRoot
root = Maybe StreamingSessionStorageRoot
a} :: StreamConfigurationSessionStorage)

-- | Allows artists to upload files to their workstations. The only valid
-- option is @UPLOAD@.
streamConfigurationSessionStorage_mode :: Lens.Lens' StreamConfigurationSessionStorage (Prelude.NonEmpty StreamingSessionStorageMode)
streamConfigurationSessionStorage_mode :: Lens'
  StreamConfigurationSessionStorage
  (NonEmpty StreamingSessionStorageMode)
streamConfigurationSessionStorage_mode = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StreamConfigurationSessionStorage' {NonEmpty StreamingSessionStorageMode
mode :: NonEmpty StreamingSessionStorageMode
$sel:mode:StreamConfigurationSessionStorage' :: StreamConfigurationSessionStorage
-> NonEmpty StreamingSessionStorageMode
mode} -> NonEmpty StreamingSessionStorageMode
mode) (\s :: StreamConfigurationSessionStorage
s@StreamConfigurationSessionStorage' {} NonEmpty StreamingSessionStorageMode
a -> StreamConfigurationSessionStorage
s {$sel:mode:StreamConfigurationSessionStorage' :: NonEmpty StreamingSessionStorageMode
mode = NonEmpty StreamingSessionStorageMode
a} :: StreamConfigurationSessionStorage) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance
  Data.FromJSON
    StreamConfigurationSessionStorage
  where
  parseJSON :: Value -> Parser StreamConfigurationSessionStorage
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"StreamConfigurationSessionStorage"
      ( \Object
x ->
          Maybe StreamingSessionStorageRoot
-> NonEmpty StreamingSessionStorageMode
-> StreamConfigurationSessionStorage
StreamConfigurationSessionStorage'
            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
"root")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"mode")
      )

instance
  Prelude.Hashable
    StreamConfigurationSessionStorage
  where
  hashWithSalt :: Int -> StreamConfigurationSessionStorage -> Int
hashWithSalt
    Int
_salt
    StreamConfigurationSessionStorage' {Maybe StreamingSessionStorageRoot
NonEmpty StreamingSessionStorageMode
mode :: NonEmpty StreamingSessionStorageMode
root :: Maybe StreamingSessionStorageRoot
$sel:mode:StreamConfigurationSessionStorage' :: StreamConfigurationSessionStorage
-> NonEmpty StreamingSessionStorageMode
$sel:root:StreamConfigurationSessionStorage' :: StreamConfigurationSessionStorage
-> Maybe StreamingSessionStorageRoot
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe StreamingSessionStorageRoot
root
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` NonEmpty StreamingSessionStorageMode
mode

instance
  Prelude.NFData
    StreamConfigurationSessionStorage
  where
  rnf :: StreamConfigurationSessionStorage -> ()
rnf StreamConfigurationSessionStorage' {Maybe StreamingSessionStorageRoot
NonEmpty StreamingSessionStorageMode
mode :: NonEmpty StreamingSessionStorageMode
root :: Maybe StreamingSessionStorageRoot
$sel:mode:StreamConfigurationSessionStorage' :: StreamConfigurationSessionStorage
-> NonEmpty StreamingSessionStorageMode
$sel:root:StreamConfigurationSessionStorage' :: StreamConfigurationSessionStorage
-> Maybe StreamingSessionStorageRoot
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe StreamingSessionStorageRoot
root seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf NonEmpty StreamingSessionStorageMode
mode

instance
  Data.ToJSON
    StreamConfigurationSessionStorage
  where
  toJSON :: StreamConfigurationSessionStorage -> Value
toJSON StreamConfigurationSessionStorage' {Maybe StreamingSessionStorageRoot
NonEmpty StreamingSessionStorageMode
mode :: NonEmpty StreamingSessionStorageMode
root :: Maybe StreamingSessionStorageRoot
$sel:mode:StreamConfigurationSessionStorage' :: StreamConfigurationSessionStorage
-> NonEmpty StreamingSessionStorageMode
$sel:root:StreamConfigurationSessionStorage' :: StreamConfigurationSessionStorage
-> Maybe StreamingSessionStorageRoot
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"root" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe StreamingSessionStorageRoot
root,
            forall a. a -> Maybe a
Prelude.Just (Key
"mode" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= NonEmpty StreamingSessionStorageMode
mode)
          ]
      )