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

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

-- | The Amazon Chime Voice Connector settings. Includes any Amazon S3
-- buckets designated for storing call detail records.
--
-- /See:/ 'newVoiceConnectorSettings' smart constructor.
data VoiceConnectorSettings = VoiceConnectorSettings'
  { -- | The Amazon S3 bucket designated for call detail record storage.
    VoiceConnectorSettings -> Maybe Text
cdrBucket :: Prelude.Maybe Prelude.Text
  }
  deriving (VoiceConnectorSettings -> VoiceConnectorSettings -> Bool
(VoiceConnectorSettings -> VoiceConnectorSettings -> Bool)
-> (VoiceConnectorSettings -> VoiceConnectorSettings -> Bool)
-> Eq VoiceConnectorSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VoiceConnectorSettings -> VoiceConnectorSettings -> Bool
$c/= :: VoiceConnectorSettings -> VoiceConnectorSettings -> Bool
== :: VoiceConnectorSettings -> VoiceConnectorSettings -> Bool
$c== :: VoiceConnectorSettings -> VoiceConnectorSettings -> Bool
Prelude.Eq, ReadPrec [VoiceConnectorSettings]
ReadPrec VoiceConnectorSettings
Int -> ReadS VoiceConnectorSettings
ReadS [VoiceConnectorSettings]
(Int -> ReadS VoiceConnectorSettings)
-> ReadS [VoiceConnectorSettings]
-> ReadPrec VoiceConnectorSettings
-> ReadPrec [VoiceConnectorSettings]
-> Read VoiceConnectorSettings
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [VoiceConnectorSettings]
$creadListPrec :: ReadPrec [VoiceConnectorSettings]
readPrec :: ReadPrec VoiceConnectorSettings
$creadPrec :: ReadPrec VoiceConnectorSettings
readList :: ReadS [VoiceConnectorSettings]
$creadList :: ReadS [VoiceConnectorSettings]
readsPrec :: Int -> ReadS VoiceConnectorSettings
$creadsPrec :: Int -> ReadS VoiceConnectorSettings
Prelude.Read, Int -> VoiceConnectorSettings -> ShowS
[VoiceConnectorSettings] -> ShowS
VoiceConnectorSettings -> String
(Int -> VoiceConnectorSettings -> ShowS)
-> (VoiceConnectorSettings -> String)
-> ([VoiceConnectorSettings] -> ShowS)
-> Show VoiceConnectorSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VoiceConnectorSettings] -> ShowS
$cshowList :: [VoiceConnectorSettings] -> ShowS
show :: VoiceConnectorSettings -> String
$cshow :: VoiceConnectorSettings -> String
showsPrec :: Int -> VoiceConnectorSettings -> ShowS
$cshowsPrec :: Int -> VoiceConnectorSettings -> ShowS
Prelude.Show, (forall x. VoiceConnectorSettings -> Rep VoiceConnectorSettings x)
-> (forall x.
    Rep VoiceConnectorSettings x -> VoiceConnectorSettings)
-> Generic VoiceConnectorSettings
forall x. Rep VoiceConnectorSettings x -> VoiceConnectorSettings
forall x. VoiceConnectorSettings -> Rep VoiceConnectorSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep VoiceConnectorSettings x -> VoiceConnectorSettings
$cfrom :: forall x. VoiceConnectorSettings -> Rep VoiceConnectorSettings x
Prelude.Generic)

-- |
-- Create a value of 'VoiceConnectorSettings' 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:
--
-- 'cdrBucket', 'voiceConnectorSettings_cdrBucket' - The Amazon S3 bucket designated for call detail record storage.
newVoiceConnectorSettings ::
  VoiceConnectorSettings
newVoiceConnectorSettings :: VoiceConnectorSettings
newVoiceConnectorSettings =
  VoiceConnectorSettings' :: Maybe Text -> VoiceConnectorSettings
VoiceConnectorSettings'
    { $sel:cdrBucket:VoiceConnectorSettings' :: Maybe Text
cdrBucket =
        Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon S3 bucket designated for call detail record storage.
voiceConnectorSettings_cdrBucket :: Lens.Lens' VoiceConnectorSettings (Prelude.Maybe Prelude.Text)
voiceConnectorSettings_cdrBucket :: (Maybe Text -> f (Maybe Text))
-> VoiceConnectorSettings -> f VoiceConnectorSettings
voiceConnectorSettings_cdrBucket = (VoiceConnectorSettings -> Maybe Text)
-> (VoiceConnectorSettings -> Maybe Text -> VoiceConnectorSettings)
-> Lens
     VoiceConnectorSettings
     VoiceConnectorSettings
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VoiceConnectorSettings' {Maybe Text
cdrBucket :: Maybe Text
$sel:cdrBucket:VoiceConnectorSettings' :: VoiceConnectorSettings -> Maybe Text
cdrBucket} -> Maybe Text
cdrBucket) (\s :: VoiceConnectorSettings
s@VoiceConnectorSettings' {} Maybe Text
a -> VoiceConnectorSettings
s {$sel:cdrBucket:VoiceConnectorSettings' :: Maybe Text
cdrBucket = Maybe Text
a} :: VoiceConnectorSettings)

instance Core.FromJSON VoiceConnectorSettings where
  parseJSON :: Value -> Parser VoiceConnectorSettings
parseJSON =
    String
-> (Object -> Parser VoiceConnectorSettings)
-> Value
-> Parser VoiceConnectorSettings
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"VoiceConnectorSettings"
      ( \Object
x ->
          Maybe Text -> VoiceConnectorSettings
VoiceConnectorSettings'
            (Maybe Text -> VoiceConnectorSettings)
-> Parser (Maybe Text) -> Parser VoiceConnectorSettings
forall (f :: * -> *) a b. Functor 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
"CdrBucket")
      )

instance Prelude.Hashable VoiceConnectorSettings

instance Prelude.NFData VoiceConnectorSettings

instance Core.ToJSON VoiceConnectorSettings where
  toJSON :: VoiceConnectorSettings -> Value
toJSON VoiceConnectorSettings' {Maybe Text
cdrBucket :: Maybe Text
$sel:cdrBucket:VoiceConnectorSettings' :: VoiceConnectorSettings -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Text
"CdrBucket" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
cdrBucket]
      )