{-# 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.IVS.Types.S3DestinationConfiguration
-- 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.IVS.Types.S3DestinationConfiguration where

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

-- | A complex type that describes an S3 location where recorded videos will
-- be stored.
--
-- /See:/ 'newS3DestinationConfiguration' smart constructor.
data S3DestinationConfiguration = S3DestinationConfiguration'
  { -- | Location (S3 bucket name) where recorded videos will be stored.
    S3DestinationConfiguration -> Text
bucketName :: Prelude.Text
  }
  deriving (S3DestinationConfiguration -> S3DestinationConfiguration -> Bool
(S3DestinationConfiguration -> S3DestinationConfiguration -> Bool)
-> (S3DestinationConfiguration
    -> S3DestinationConfiguration -> Bool)
-> Eq S3DestinationConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: S3DestinationConfiguration -> S3DestinationConfiguration -> Bool
$c/= :: S3DestinationConfiguration -> S3DestinationConfiguration -> Bool
== :: S3DestinationConfiguration -> S3DestinationConfiguration -> Bool
$c== :: S3DestinationConfiguration -> S3DestinationConfiguration -> Bool
Prelude.Eq, ReadPrec [S3DestinationConfiguration]
ReadPrec S3DestinationConfiguration
Int -> ReadS S3DestinationConfiguration
ReadS [S3DestinationConfiguration]
(Int -> ReadS S3DestinationConfiguration)
-> ReadS [S3DestinationConfiguration]
-> ReadPrec S3DestinationConfiguration
-> ReadPrec [S3DestinationConfiguration]
-> Read S3DestinationConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [S3DestinationConfiguration]
$creadListPrec :: ReadPrec [S3DestinationConfiguration]
readPrec :: ReadPrec S3DestinationConfiguration
$creadPrec :: ReadPrec S3DestinationConfiguration
readList :: ReadS [S3DestinationConfiguration]
$creadList :: ReadS [S3DestinationConfiguration]
readsPrec :: Int -> ReadS S3DestinationConfiguration
$creadsPrec :: Int -> ReadS S3DestinationConfiguration
Prelude.Read, Int -> S3DestinationConfiguration -> ShowS
[S3DestinationConfiguration] -> ShowS
S3DestinationConfiguration -> String
(Int -> S3DestinationConfiguration -> ShowS)
-> (S3DestinationConfiguration -> String)
-> ([S3DestinationConfiguration] -> ShowS)
-> Show S3DestinationConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [S3DestinationConfiguration] -> ShowS
$cshowList :: [S3DestinationConfiguration] -> ShowS
show :: S3DestinationConfiguration -> String
$cshow :: S3DestinationConfiguration -> String
showsPrec :: Int -> S3DestinationConfiguration -> ShowS
$cshowsPrec :: Int -> S3DestinationConfiguration -> ShowS
Prelude.Show, (forall x.
 S3DestinationConfiguration -> Rep S3DestinationConfiguration x)
-> (forall x.
    Rep S3DestinationConfiguration x -> S3DestinationConfiguration)
-> Generic S3DestinationConfiguration
forall x.
Rep S3DestinationConfiguration x -> S3DestinationConfiguration
forall x.
S3DestinationConfiguration -> Rep S3DestinationConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep S3DestinationConfiguration x -> S3DestinationConfiguration
$cfrom :: forall x.
S3DestinationConfiguration -> Rep S3DestinationConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'S3DestinationConfiguration' 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:
--
-- 'bucketName', 's3DestinationConfiguration_bucketName' - Location (S3 bucket name) where recorded videos will be stored.
newS3DestinationConfiguration ::
  -- | 'bucketName'
  Prelude.Text ->
  S3DestinationConfiguration
newS3DestinationConfiguration :: Text -> S3DestinationConfiguration
newS3DestinationConfiguration Text
pBucketName_ =
  S3DestinationConfiguration' :: Text -> S3DestinationConfiguration
S3DestinationConfiguration'
    { $sel:bucketName:S3DestinationConfiguration' :: Text
bucketName =
        Text
pBucketName_
    }

-- | Location (S3 bucket name) where recorded videos will be stored.
s3DestinationConfiguration_bucketName :: Lens.Lens' S3DestinationConfiguration Prelude.Text
s3DestinationConfiguration_bucketName :: (Text -> f Text)
-> S3DestinationConfiguration -> f S3DestinationConfiguration
s3DestinationConfiguration_bucketName = (S3DestinationConfiguration -> Text)
-> (S3DestinationConfiguration
    -> Text -> S3DestinationConfiguration)
-> Lens
     S3DestinationConfiguration S3DestinationConfiguration Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3DestinationConfiguration' {Text
bucketName :: Text
$sel:bucketName:S3DestinationConfiguration' :: S3DestinationConfiguration -> Text
bucketName} -> Text
bucketName) (\s :: S3DestinationConfiguration
s@S3DestinationConfiguration' {} Text
a -> S3DestinationConfiguration
s {$sel:bucketName:S3DestinationConfiguration' :: Text
bucketName = Text
a} :: S3DestinationConfiguration)

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

instance Prelude.Hashable S3DestinationConfiguration

instance Prelude.NFData S3DestinationConfiguration

instance Core.ToJSON S3DestinationConfiguration where
  toJSON :: S3DestinationConfiguration -> Value
toJSON S3DestinationConfiguration' {Text
bucketName :: Text
$sel:bucketName:S3DestinationConfiguration' :: S3DestinationConfiguration -> Text
..} =
    [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
"bucketName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
bucketName)]
      )