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

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

-- | The proxy configuration for an Amazon Chime Voice Connector.
--
-- /See:/ 'newProxy' smart constructor.
data Proxy = Proxy'
  { -- | The default number of minutes allowed for proxy sessions.
    Proxy -> Maybe Int
defaultSessionExpiryMinutes :: Prelude.Maybe Prelude.Int,
    -- | When true, stops proxy sessions from being created on the specified
    -- Amazon Chime Voice Connector.
    Proxy -> Maybe Bool
disabled :: Prelude.Maybe Prelude.Bool,
    -- | The phone number to route calls to after a proxy session expires.
    Proxy -> Maybe (Sensitive Text)
fallBackPhoneNumber :: Prelude.Maybe (Core.Sensitive Prelude.Text),
    -- | The countries for proxy phone numbers to be selected from.
    Proxy -> Maybe [Text]
phoneNumberCountries :: Prelude.Maybe [Prelude.Text]
  }
  deriving (Proxy -> Proxy -> Bool
(Proxy -> Proxy -> Bool) -> (Proxy -> Proxy -> Bool) -> Eq Proxy
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Proxy -> Proxy -> Bool
$c/= :: Proxy -> Proxy -> Bool
== :: Proxy -> Proxy -> Bool
$c== :: Proxy -> Proxy -> Bool
Prelude.Eq, Int -> Proxy -> ShowS
[Proxy] -> ShowS
Proxy -> String
(Int -> Proxy -> ShowS)
-> (Proxy -> String) -> ([Proxy] -> ShowS) -> Show Proxy
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Proxy] -> ShowS
$cshowList :: [Proxy] -> ShowS
show :: Proxy -> String
$cshow :: Proxy -> String
showsPrec :: Int -> Proxy -> ShowS
$cshowsPrec :: Int -> Proxy -> ShowS
Prelude.Show, (forall x. Proxy -> Rep Proxy x)
-> (forall x. Rep Proxy x -> Proxy) -> Generic Proxy
forall x. Rep Proxy x -> Proxy
forall x. Proxy -> Rep Proxy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Proxy x -> Proxy
$cfrom :: forall x. Proxy -> Rep Proxy x
Prelude.Generic)

-- |
-- Create a value of 'Proxy' 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:
--
-- 'defaultSessionExpiryMinutes', 'proxy_defaultSessionExpiryMinutes' - The default number of minutes allowed for proxy sessions.
--
-- 'disabled', 'proxy_disabled' - When true, stops proxy sessions from being created on the specified
-- Amazon Chime Voice Connector.
--
-- 'fallBackPhoneNumber', 'proxy_fallBackPhoneNumber' - The phone number to route calls to after a proxy session expires.
--
-- 'phoneNumberCountries', 'proxy_phoneNumberCountries' - The countries for proxy phone numbers to be selected from.
newProxy ::
  Proxy
newProxy :: Proxy
newProxy =
  Proxy' :: Maybe Int
-> Maybe Bool -> Maybe (Sensitive Text) -> Maybe [Text] -> Proxy
Proxy'
    { $sel:defaultSessionExpiryMinutes:Proxy' :: Maybe Int
defaultSessionExpiryMinutes =
        Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:disabled:Proxy' :: Maybe Bool
disabled = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:fallBackPhoneNumber:Proxy' :: Maybe (Sensitive Text)
fallBackPhoneNumber = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:phoneNumberCountries:Proxy' :: Maybe [Text]
phoneNumberCountries = Maybe [Text]
forall a. Maybe a
Prelude.Nothing
    }

-- | The default number of minutes allowed for proxy sessions.
proxy_defaultSessionExpiryMinutes :: Lens.Lens' Proxy (Prelude.Maybe Prelude.Int)
proxy_defaultSessionExpiryMinutes :: (Maybe Int -> f (Maybe Int)) -> Proxy -> f Proxy
proxy_defaultSessionExpiryMinutes = (Proxy -> Maybe Int)
-> (Proxy -> Maybe Int -> Proxy)
-> Lens Proxy Proxy (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Proxy' {Maybe Int
defaultSessionExpiryMinutes :: Maybe Int
$sel:defaultSessionExpiryMinutes:Proxy' :: Proxy -> Maybe Int
defaultSessionExpiryMinutes} -> Maybe Int
defaultSessionExpiryMinutes) (\s :: Proxy
s@Proxy' {} Maybe Int
a -> Proxy
s {$sel:defaultSessionExpiryMinutes:Proxy' :: Maybe Int
defaultSessionExpiryMinutes = Maybe Int
a} :: Proxy)

-- | When true, stops proxy sessions from being created on the specified
-- Amazon Chime Voice Connector.
proxy_disabled :: Lens.Lens' Proxy (Prelude.Maybe Prelude.Bool)
proxy_disabled :: (Maybe Bool -> f (Maybe Bool)) -> Proxy -> f Proxy
proxy_disabled = (Proxy -> Maybe Bool)
-> (Proxy -> Maybe Bool -> Proxy)
-> Lens Proxy Proxy (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Proxy' {Maybe Bool
disabled :: Maybe Bool
$sel:disabled:Proxy' :: Proxy -> Maybe Bool
disabled} -> Maybe Bool
disabled) (\s :: Proxy
s@Proxy' {} Maybe Bool
a -> Proxy
s {$sel:disabled:Proxy' :: Maybe Bool
disabled = Maybe Bool
a} :: Proxy)

-- | The phone number to route calls to after a proxy session expires.
proxy_fallBackPhoneNumber :: Lens.Lens' Proxy (Prelude.Maybe Prelude.Text)
proxy_fallBackPhoneNumber :: (Maybe Text -> f (Maybe Text)) -> Proxy -> f Proxy
proxy_fallBackPhoneNumber = (Proxy -> Maybe (Sensitive Text))
-> (Proxy -> Maybe (Sensitive Text) -> Proxy)
-> Lens
     Proxy Proxy (Maybe (Sensitive Text)) (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Proxy' {Maybe (Sensitive Text)
fallBackPhoneNumber :: Maybe (Sensitive Text)
$sel:fallBackPhoneNumber:Proxy' :: Proxy -> Maybe (Sensitive Text)
fallBackPhoneNumber} -> Maybe (Sensitive Text)
fallBackPhoneNumber) (\s :: Proxy
s@Proxy' {} Maybe (Sensitive Text)
a -> Proxy
s {$sel:fallBackPhoneNumber:Proxy' :: Maybe (Sensitive Text)
fallBackPhoneNumber = Maybe (Sensitive Text)
a} :: Proxy) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> Proxy -> f Proxy)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> Proxy
-> f Proxy
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
     (Maybe Text)
     (Maybe Text)
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 AnIso (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive

-- | The countries for proxy phone numbers to be selected from.
proxy_phoneNumberCountries :: Lens.Lens' Proxy (Prelude.Maybe [Prelude.Text])
proxy_phoneNumberCountries :: (Maybe [Text] -> f (Maybe [Text])) -> Proxy -> f Proxy
proxy_phoneNumberCountries = (Proxy -> Maybe [Text])
-> (Proxy -> Maybe [Text] -> Proxy)
-> Lens Proxy Proxy (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Proxy' {Maybe [Text]
phoneNumberCountries :: Maybe [Text]
$sel:phoneNumberCountries:Proxy' :: Proxy -> Maybe [Text]
phoneNumberCountries} -> Maybe [Text]
phoneNumberCountries) (\s :: Proxy
s@Proxy' {} Maybe [Text]
a -> Proxy
s {$sel:phoneNumberCountries:Proxy' :: Maybe [Text]
phoneNumberCountries = Maybe [Text]
a} :: Proxy) ((Maybe [Text] -> f (Maybe [Text])) -> Proxy -> f Proxy)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> Proxy
-> f Proxy
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 AnIso [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON Proxy where
  parseJSON :: Value -> Parser Proxy
parseJSON =
    String -> (Object -> Parser Proxy) -> Value -> Parser Proxy
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Proxy"
      ( \Object
x ->
          Maybe Int
-> Maybe Bool -> Maybe (Sensitive Text) -> Maybe [Text] -> Proxy
Proxy'
            (Maybe Int
 -> Maybe Bool -> Maybe (Sensitive Text) -> Maybe [Text] -> Proxy)
-> Parser (Maybe Int)
-> Parser
     (Maybe Bool -> Maybe (Sensitive Text) -> Maybe [Text] -> Proxy)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DefaultSessionExpiryMinutes")
            Parser
  (Maybe Bool -> Maybe (Sensitive Text) -> Maybe [Text] -> Proxy)
-> Parser (Maybe Bool)
-> Parser (Maybe (Sensitive Text) -> Maybe [Text] -> Proxy)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Disabled")
            Parser (Maybe (Sensitive Text) -> Maybe [Text] -> Proxy)
-> Parser (Maybe (Sensitive Text))
-> Parser (Maybe [Text] -> Proxy)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Sensitive Text))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"FallBackPhoneNumber")
            Parser (Maybe [Text] -> Proxy)
-> Parser (Maybe [Text]) -> Parser Proxy
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"PhoneNumberCountries"
                            Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance Prelude.Hashable Proxy

instance Prelude.NFData Proxy