{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# 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.CreateProxySession
-- 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)
--
-- Creates a proxy session on the specified Amazon Chime Voice Connector
-- for the specified participant phone numbers.
module Amazonka.Chime.CreateProxySession
  ( -- * Creating a Request
    CreateProxySession (..),
    newCreateProxySession,

    -- * Request Lenses
    createProxySession_numberSelectionBehavior,
    createProxySession_geoMatchParams,
    createProxySession_expiryMinutes,
    createProxySession_name,
    createProxySession_geoMatchLevel,
    createProxySession_participantPhoneNumbers,
    createProxySession_capabilities,
    createProxySession_voiceConnectorId,

    -- * Destructuring the Response
    CreateProxySessionResponse (..),
    newCreateProxySessionResponse,

    -- * Response Lenses
    createProxySessionResponse_proxySession,
    createProxySessionResponse_httpStatus,
  )
where

import Amazonka.Chime.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newCreateProxySession' smart constructor.
data CreateProxySession = CreateProxySession'
  { -- | The preference for proxy phone number reuse, or stickiness, between the
    -- same participants across sessions.
    CreateProxySession -> Maybe NumberSelectionBehavior
numberSelectionBehavior :: Prelude.Maybe NumberSelectionBehavior,
    -- | The country and area code for the proxy phone number.
    CreateProxySession -> Maybe GeoMatchParams
geoMatchParams :: Prelude.Maybe GeoMatchParams,
    -- | The number of minutes allowed for the proxy session.
    CreateProxySession -> Maybe Natural
expiryMinutes :: Prelude.Maybe Prelude.Natural,
    -- | The name of the proxy session.
    CreateProxySession -> Maybe (Sensitive Text)
name :: Prelude.Maybe (Core.Sensitive Prelude.Text),
    -- | The preference for matching the country or area code of the proxy phone
    -- number with that of the first participant.
    CreateProxySession -> Maybe GeoMatchLevel
geoMatchLevel :: Prelude.Maybe GeoMatchLevel,
    -- | The participant phone numbers.
    CreateProxySession -> NonEmpty (Sensitive Text)
participantPhoneNumbers :: Prelude.NonEmpty (Core.Sensitive Prelude.Text),
    -- | The proxy session capabilities.
    CreateProxySession -> [Capability]
capabilities :: [Capability],
    -- | The Amazon Chime voice connector ID.
    CreateProxySession -> Text
voiceConnectorId :: Prelude.Text
  }
  deriving (CreateProxySession -> CreateProxySession -> Bool
(CreateProxySession -> CreateProxySession -> Bool)
-> (CreateProxySession -> CreateProxySession -> Bool)
-> Eq CreateProxySession
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateProxySession -> CreateProxySession -> Bool
$c/= :: CreateProxySession -> CreateProxySession -> Bool
== :: CreateProxySession -> CreateProxySession -> Bool
$c== :: CreateProxySession -> CreateProxySession -> Bool
Prelude.Eq, Int -> CreateProxySession -> ShowS
[CreateProxySession] -> ShowS
CreateProxySession -> String
(Int -> CreateProxySession -> ShowS)
-> (CreateProxySession -> String)
-> ([CreateProxySession] -> ShowS)
-> Show CreateProxySession
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateProxySession] -> ShowS
$cshowList :: [CreateProxySession] -> ShowS
show :: CreateProxySession -> String
$cshow :: CreateProxySession -> String
showsPrec :: Int -> CreateProxySession -> ShowS
$cshowsPrec :: Int -> CreateProxySession -> ShowS
Prelude.Show, (forall x. CreateProxySession -> Rep CreateProxySession x)
-> (forall x. Rep CreateProxySession x -> CreateProxySession)
-> Generic CreateProxySession
forall x. Rep CreateProxySession x -> CreateProxySession
forall x. CreateProxySession -> Rep CreateProxySession x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateProxySession x -> CreateProxySession
$cfrom :: forall x. CreateProxySession -> Rep CreateProxySession x
Prelude.Generic)

-- |
-- Create a value of 'CreateProxySession' 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:
--
-- 'numberSelectionBehavior', 'createProxySession_numberSelectionBehavior' - The preference for proxy phone number reuse, or stickiness, between the
-- same participants across sessions.
--
-- 'geoMatchParams', 'createProxySession_geoMatchParams' - The country and area code for the proxy phone number.
--
-- 'expiryMinutes', 'createProxySession_expiryMinutes' - The number of minutes allowed for the proxy session.
--
-- 'name', 'createProxySession_name' - The name of the proxy session.
--
-- 'geoMatchLevel', 'createProxySession_geoMatchLevel' - The preference for matching the country or area code of the proxy phone
-- number with that of the first participant.
--
-- 'participantPhoneNumbers', 'createProxySession_participantPhoneNumbers' - The participant phone numbers.
--
-- 'capabilities', 'createProxySession_capabilities' - The proxy session capabilities.
--
-- 'voiceConnectorId', 'createProxySession_voiceConnectorId' - The Amazon Chime voice connector ID.
newCreateProxySession ::
  -- | 'participantPhoneNumbers'
  Prelude.NonEmpty Prelude.Text ->
  -- | 'voiceConnectorId'
  Prelude.Text ->
  CreateProxySession
newCreateProxySession :: NonEmpty Text -> Text -> CreateProxySession
newCreateProxySession
  NonEmpty Text
pParticipantPhoneNumbers_
  Text
pVoiceConnectorId_ =
    CreateProxySession' :: Maybe NumberSelectionBehavior
-> Maybe GeoMatchParams
-> Maybe Natural
-> Maybe (Sensitive Text)
-> Maybe GeoMatchLevel
-> NonEmpty (Sensitive Text)
-> [Capability]
-> Text
-> CreateProxySession
CreateProxySession'
      { $sel:numberSelectionBehavior:CreateProxySession' :: Maybe NumberSelectionBehavior
numberSelectionBehavior =
          Maybe NumberSelectionBehavior
forall a. Maybe a
Prelude.Nothing,
        $sel:geoMatchParams:CreateProxySession' :: Maybe GeoMatchParams
geoMatchParams = Maybe GeoMatchParams
forall a. Maybe a
Prelude.Nothing,
        $sel:expiryMinutes:CreateProxySession' :: Maybe Natural
expiryMinutes = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
        $sel:name:CreateProxySession' :: Maybe (Sensitive Text)
name = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:geoMatchLevel:CreateProxySession' :: Maybe GeoMatchLevel
geoMatchLevel = Maybe GeoMatchLevel
forall a. Maybe a
Prelude.Nothing,
        $sel:participantPhoneNumbers:CreateProxySession' :: NonEmpty (Sensitive Text)
participantPhoneNumbers =
          Tagged (NonEmpty Text) (Identity (NonEmpty Text))
-> Tagged
     (NonEmpty (Sensitive Text)) (Identity (NonEmpty (Sensitive Text)))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged (NonEmpty Text) (Identity (NonEmpty Text))
 -> Tagged
      (NonEmpty (Sensitive Text)) (Identity (NonEmpty (Sensitive Text))))
-> NonEmpty Text -> NonEmpty (Sensitive Text)
forall t b. AReview t b -> b -> t
Lens.# NonEmpty Text
pParticipantPhoneNumbers_,
        $sel:capabilities:CreateProxySession' :: [Capability]
capabilities = [Capability]
forall a. Monoid a => a
Prelude.mempty,
        $sel:voiceConnectorId:CreateProxySession' :: Text
voiceConnectorId = Text
pVoiceConnectorId_
      }

-- | The preference for proxy phone number reuse, or stickiness, between the
-- same participants across sessions.
createProxySession_numberSelectionBehavior :: Lens.Lens' CreateProxySession (Prelude.Maybe NumberSelectionBehavior)
createProxySession_numberSelectionBehavior :: (Maybe NumberSelectionBehavior
 -> f (Maybe NumberSelectionBehavior))
-> CreateProxySession -> f CreateProxySession
createProxySession_numberSelectionBehavior = (CreateProxySession -> Maybe NumberSelectionBehavior)
-> (CreateProxySession
    -> Maybe NumberSelectionBehavior -> CreateProxySession)
-> Lens
     CreateProxySession
     CreateProxySession
     (Maybe NumberSelectionBehavior)
     (Maybe NumberSelectionBehavior)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateProxySession' {Maybe NumberSelectionBehavior
numberSelectionBehavior :: Maybe NumberSelectionBehavior
$sel:numberSelectionBehavior:CreateProxySession' :: CreateProxySession -> Maybe NumberSelectionBehavior
numberSelectionBehavior} -> Maybe NumberSelectionBehavior
numberSelectionBehavior) (\s :: CreateProxySession
s@CreateProxySession' {} Maybe NumberSelectionBehavior
a -> CreateProxySession
s {$sel:numberSelectionBehavior:CreateProxySession' :: Maybe NumberSelectionBehavior
numberSelectionBehavior = Maybe NumberSelectionBehavior
a} :: CreateProxySession)

-- | The country and area code for the proxy phone number.
createProxySession_geoMatchParams :: Lens.Lens' CreateProxySession (Prelude.Maybe GeoMatchParams)
createProxySession_geoMatchParams :: (Maybe GeoMatchParams -> f (Maybe GeoMatchParams))
-> CreateProxySession -> f CreateProxySession
createProxySession_geoMatchParams = (CreateProxySession -> Maybe GeoMatchParams)
-> (CreateProxySession
    -> Maybe GeoMatchParams -> CreateProxySession)
-> Lens
     CreateProxySession
     CreateProxySession
     (Maybe GeoMatchParams)
     (Maybe GeoMatchParams)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateProxySession' {Maybe GeoMatchParams
geoMatchParams :: Maybe GeoMatchParams
$sel:geoMatchParams:CreateProxySession' :: CreateProxySession -> Maybe GeoMatchParams
geoMatchParams} -> Maybe GeoMatchParams
geoMatchParams) (\s :: CreateProxySession
s@CreateProxySession' {} Maybe GeoMatchParams
a -> CreateProxySession
s {$sel:geoMatchParams:CreateProxySession' :: Maybe GeoMatchParams
geoMatchParams = Maybe GeoMatchParams
a} :: CreateProxySession)

-- | The number of minutes allowed for the proxy session.
createProxySession_expiryMinutes :: Lens.Lens' CreateProxySession (Prelude.Maybe Prelude.Natural)
createProxySession_expiryMinutes :: (Maybe Natural -> f (Maybe Natural))
-> CreateProxySession -> f CreateProxySession
createProxySession_expiryMinutes = (CreateProxySession -> Maybe Natural)
-> (CreateProxySession -> Maybe Natural -> CreateProxySession)
-> Lens
     CreateProxySession
     CreateProxySession
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateProxySession' {Maybe Natural
expiryMinutes :: Maybe Natural
$sel:expiryMinutes:CreateProxySession' :: CreateProxySession -> Maybe Natural
expiryMinutes} -> Maybe Natural
expiryMinutes) (\s :: CreateProxySession
s@CreateProxySession' {} Maybe Natural
a -> CreateProxySession
s {$sel:expiryMinutes:CreateProxySession' :: Maybe Natural
expiryMinutes = Maybe Natural
a} :: CreateProxySession)

-- | The name of the proxy session.
createProxySession_name :: Lens.Lens' CreateProxySession (Prelude.Maybe Prelude.Text)
createProxySession_name :: (Maybe Text -> f (Maybe Text))
-> CreateProxySession -> f CreateProxySession
createProxySession_name = (CreateProxySession -> Maybe (Sensitive Text))
-> (CreateProxySession
    -> Maybe (Sensitive Text) -> CreateProxySession)
-> Lens
     CreateProxySession
     CreateProxySession
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateProxySession' {Maybe (Sensitive Text)
name :: Maybe (Sensitive Text)
$sel:name:CreateProxySession' :: CreateProxySession -> Maybe (Sensitive Text)
name} -> Maybe (Sensitive Text)
name) (\s :: CreateProxySession
s@CreateProxySession' {} Maybe (Sensitive Text)
a -> CreateProxySession
s {$sel:name:CreateProxySession' :: Maybe (Sensitive Text)
name = Maybe (Sensitive Text)
a} :: CreateProxySession) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> CreateProxySession -> f CreateProxySession)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> CreateProxySession
-> f CreateProxySession
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 preference for matching the country or area code of the proxy phone
-- number with that of the first participant.
createProxySession_geoMatchLevel :: Lens.Lens' CreateProxySession (Prelude.Maybe GeoMatchLevel)
createProxySession_geoMatchLevel :: (Maybe GeoMatchLevel -> f (Maybe GeoMatchLevel))
-> CreateProxySession -> f CreateProxySession
createProxySession_geoMatchLevel = (CreateProxySession -> Maybe GeoMatchLevel)
-> (CreateProxySession
    -> Maybe GeoMatchLevel -> CreateProxySession)
-> Lens
     CreateProxySession
     CreateProxySession
     (Maybe GeoMatchLevel)
     (Maybe GeoMatchLevel)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateProxySession' {Maybe GeoMatchLevel
geoMatchLevel :: Maybe GeoMatchLevel
$sel:geoMatchLevel:CreateProxySession' :: CreateProxySession -> Maybe GeoMatchLevel
geoMatchLevel} -> Maybe GeoMatchLevel
geoMatchLevel) (\s :: CreateProxySession
s@CreateProxySession' {} Maybe GeoMatchLevel
a -> CreateProxySession
s {$sel:geoMatchLevel:CreateProxySession' :: Maybe GeoMatchLevel
geoMatchLevel = Maybe GeoMatchLevel
a} :: CreateProxySession)

-- | The participant phone numbers.
createProxySession_participantPhoneNumbers :: Lens.Lens' CreateProxySession (Prelude.NonEmpty Prelude.Text)
createProxySession_participantPhoneNumbers :: (NonEmpty Text -> f (NonEmpty Text))
-> CreateProxySession -> f CreateProxySession
createProxySession_participantPhoneNumbers = (CreateProxySession -> NonEmpty (Sensitive Text))
-> (CreateProxySession
    -> NonEmpty (Sensitive Text) -> CreateProxySession)
-> Lens
     CreateProxySession
     CreateProxySession
     (NonEmpty (Sensitive Text))
     (NonEmpty (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateProxySession' {NonEmpty (Sensitive Text)
participantPhoneNumbers :: NonEmpty (Sensitive Text)
$sel:participantPhoneNumbers:CreateProxySession' :: CreateProxySession -> NonEmpty (Sensitive Text)
participantPhoneNumbers} -> NonEmpty (Sensitive Text)
participantPhoneNumbers) (\s :: CreateProxySession
s@CreateProxySession' {} NonEmpty (Sensitive Text)
a -> CreateProxySession
s {$sel:participantPhoneNumbers:CreateProxySession' :: NonEmpty (Sensitive Text)
participantPhoneNumbers = NonEmpty (Sensitive Text)
a} :: CreateProxySession) ((NonEmpty (Sensitive Text) -> f (NonEmpty (Sensitive Text)))
 -> CreateProxySession -> f CreateProxySession)
-> ((NonEmpty Text -> f (NonEmpty Text))
    -> NonEmpty (Sensitive Text) -> f (NonEmpty (Sensitive Text)))
-> (NonEmpty Text -> f (NonEmpty Text))
-> CreateProxySession
-> f CreateProxySession
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty Text -> f (NonEmpty Text))
-> NonEmpty (Sensitive Text) -> f (NonEmpty (Sensitive Text))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The proxy session capabilities.
createProxySession_capabilities :: Lens.Lens' CreateProxySession [Capability]
createProxySession_capabilities :: ([Capability] -> f [Capability])
-> CreateProxySession -> f CreateProxySession
createProxySession_capabilities = (CreateProxySession -> [Capability])
-> (CreateProxySession -> [Capability] -> CreateProxySession)
-> Lens
     CreateProxySession CreateProxySession [Capability] [Capability]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateProxySession' {[Capability]
capabilities :: [Capability]
$sel:capabilities:CreateProxySession' :: CreateProxySession -> [Capability]
capabilities} -> [Capability]
capabilities) (\s :: CreateProxySession
s@CreateProxySession' {} [Capability]
a -> CreateProxySession
s {$sel:capabilities:CreateProxySession' :: [Capability]
capabilities = [Capability]
a} :: CreateProxySession) (([Capability] -> f [Capability])
 -> CreateProxySession -> f CreateProxySession)
-> (([Capability] -> f [Capability])
    -> [Capability] -> f [Capability])
-> ([Capability] -> f [Capability])
-> CreateProxySession
-> f CreateProxySession
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Capability] -> f [Capability]) -> [Capability] -> f [Capability]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The Amazon Chime voice connector ID.
createProxySession_voiceConnectorId :: Lens.Lens' CreateProxySession Prelude.Text
createProxySession_voiceConnectorId :: (Text -> f Text) -> CreateProxySession -> f CreateProxySession
createProxySession_voiceConnectorId = (CreateProxySession -> Text)
-> (CreateProxySession -> Text -> CreateProxySession)
-> Lens CreateProxySession CreateProxySession Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateProxySession' {Text
voiceConnectorId :: Text
$sel:voiceConnectorId:CreateProxySession' :: CreateProxySession -> Text
voiceConnectorId} -> Text
voiceConnectorId) (\s :: CreateProxySession
s@CreateProxySession' {} Text
a -> CreateProxySession
s {$sel:voiceConnectorId:CreateProxySession' :: Text
voiceConnectorId = Text
a} :: CreateProxySession)

instance Core.AWSRequest CreateProxySession where
  type
    AWSResponse CreateProxySession =
      CreateProxySessionResponse
  request :: CreateProxySession -> Request CreateProxySession
request = Service -> CreateProxySession -> Request CreateProxySession
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateProxySession
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateProxySession)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateProxySession))
-> Logger
-> Service
-> Proxy CreateProxySession
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateProxySession)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe ProxySession -> Int -> CreateProxySessionResponse
CreateProxySessionResponse'
            (Maybe ProxySession -> Int -> CreateProxySessionResponse)
-> Either String (Maybe ProxySession)
-> Either String (Int -> CreateProxySessionResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe ProxySession)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ProxySession")
            Either String (Int -> CreateProxySessionResponse)
-> Either String Int -> Either String CreateProxySessionResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable CreateProxySession

instance Prelude.NFData CreateProxySession

instance Core.ToHeaders CreateProxySession where
  toHeaders :: CreateProxySession -> ResponseHeaders
toHeaders = ResponseHeaders -> CreateProxySession -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty

instance Core.ToJSON CreateProxySession where
  toJSON :: CreateProxySession -> Value
toJSON CreateProxySession' {[Capability]
Maybe Natural
Maybe (Sensitive Text)
Maybe GeoMatchLevel
Maybe GeoMatchParams
Maybe NumberSelectionBehavior
NonEmpty (Sensitive Text)
Text
voiceConnectorId :: Text
capabilities :: [Capability]
participantPhoneNumbers :: NonEmpty (Sensitive Text)
geoMatchLevel :: Maybe GeoMatchLevel
name :: Maybe (Sensitive Text)
expiryMinutes :: Maybe Natural
geoMatchParams :: Maybe GeoMatchParams
numberSelectionBehavior :: Maybe NumberSelectionBehavior
$sel:voiceConnectorId:CreateProxySession' :: CreateProxySession -> Text
$sel:capabilities:CreateProxySession' :: CreateProxySession -> [Capability]
$sel:participantPhoneNumbers:CreateProxySession' :: CreateProxySession -> NonEmpty (Sensitive Text)
$sel:geoMatchLevel:CreateProxySession' :: CreateProxySession -> Maybe GeoMatchLevel
$sel:name:CreateProxySession' :: CreateProxySession -> Maybe (Sensitive Text)
$sel:expiryMinutes:CreateProxySession' :: CreateProxySession -> Maybe Natural
$sel:geoMatchParams:CreateProxySession' :: CreateProxySession -> Maybe GeoMatchParams
$sel:numberSelectionBehavior:CreateProxySession' :: CreateProxySession -> Maybe NumberSelectionBehavior
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"NumberSelectionBehavior" Text -> NumberSelectionBehavior -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (NumberSelectionBehavior -> Pair)
-> Maybe NumberSelectionBehavior -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe NumberSelectionBehavior
numberSelectionBehavior,
            (Text
"GeoMatchParams" Text -> GeoMatchParams -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (GeoMatchParams -> Pair) -> Maybe GeoMatchParams -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe GeoMatchParams
geoMatchParams,
            (Text
"ExpiryMinutes" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
expiryMinutes,
            (Text
"Name" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Sensitive Text -> Pair) -> Maybe (Sensitive Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (Sensitive Text)
name,
            (Text
"GeoMatchLevel" Text -> GeoMatchLevel -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (GeoMatchLevel -> Pair) -> Maybe GeoMatchLevel -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe GeoMatchLevel
geoMatchLevel,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"ParticipantPhoneNumbers"
                  Text -> NonEmpty (Sensitive Text) -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty (Sensitive Text)
participantPhoneNumbers
              ),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Capabilities" Text -> [Capability] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [Capability]
capabilities)
          ]
      )

instance Core.ToPath CreateProxySession where
  toPath :: CreateProxySession -> ByteString
toPath CreateProxySession' {[Capability]
Maybe Natural
Maybe (Sensitive Text)
Maybe GeoMatchLevel
Maybe GeoMatchParams
Maybe NumberSelectionBehavior
NonEmpty (Sensitive Text)
Text
voiceConnectorId :: Text
capabilities :: [Capability]
participantPhoneNumbers :: NonEmpty (Sensitive Text)
geoMatchLevel :: Maybe GeoMatchLevel
name :: Maybe (Sensitive Text)
expiryMinutes :: Maybe Natural
geoMatchParams :: Maybe GeoMatchParams
numberSelectionBehavior :: Maybe NumberSelectionBehavior
$sel:voiceConnectorId:CreateProxySession' :: CreateProxySession -> Text
$sel:capabilities:CreateProxySession' :: CreateProxySession -> [Capability]
$sel:participantPhoneNumbers:CreateProxySession' :: CreateProxySession -> NonEmpty (Sensitive Text)
$sel:geoMatchLevel:CreateProxySession' :: CreateProxySession -> Maybe GeoMatchLevel
$sel:name:CreateProxySession' :: CreateProxySession -> Maybe (Sensitive Text)
$sel:expiryMinutes:CreateProxySession' :: CreateProxySession -> Maybe Natural
$sel:geoMatchParams:CreateProxySession' :: CreateProxySession -> Maybe GeoMatchParams
$sel:numberSelectionBehavior:CreateProxySession' :: CreateProxySession -> Maybe NumberSelectionBehavior
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/voice-connectors/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
voiceConnectorId,
        ByteString
"/proxy-sessions"
      ]

instance Core.ToQuery CreateProxySession where
  toQuery :: CreateProxySession -> QueryString
toQuery = QueryString -> CreateProxySession -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newCreateProxySessionResponse' smart constructor.
data CreateProxySessionResponse = CreateProxySessionResponse'
  { -- | The proxy session details.
    CreateProxySessionResponse -> Maybe ProxySession
proxySession :: Prelude.Maybe ProxySession,
    -- | The response's http status code.
    CreateProxySessionResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateProxySessionResponse -> CreateProxySessionResponse -> Bool
(CreateProxySessionResponse -> CreateProxySessionResponse -> Bool)
-> (CreateProxySessionResponse
    -> CreateProxySessionResponse -> Bool)
-> Eq CreateProxySessionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateProxySessionResponse -> CreateProxySessionResponse -> Bool
$c/= :: CreateProxySessionResponse -> CreateProxySessionResponse -> Bool
== :: CreateProxySessionResponse -> CreateProxySessionResponse -> Bool
$c== :: CreateProxySessionResponse -> CreateProxySessionResponse -> Bool
Prelude.Eq, Int -> CreateProxySessionResponse -> ShowS
[CreateProxySessionResponse] -> ShowS
CreateProxySessionResponse -> String
(Int -> CreateProxySessionResponse -> ShowS)
-> (CreateProxySessionResponse -> String)
-> ([CreateProxySessionResponse] -> ShowS)
-> Show CreateProxySessionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateProxySessionResponse] -> ShowS
$cshowList :: [CreateProxySessionResponse] -> ShowS
show :: CreateProxySessionResponse -> String
$cshow :: CreateProxySessionResponse -> String
showsPrec :: Int -> CreateProxySessionResponse -> ShowS
$cshowsPrec :: Int -> CreateProxySessionResponse -> ShowS
Prelude.Show, (forall x.
 CreateProxySessionResponse -> Rep CreateProxySessionResponse x)
-> (forall x.
    Rep CreateProxySessionResponse x -> CreateProxySessionResponse)
-> Generic CreateProxySessionResponse
forall x.
Rep CreateProxySessionResponse x -> CreateProxySessionResponse
forall x.
CreateProxySessionResponse -> Rep CreateProxySessionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateProxySessionResponse x -> CreateProxySessionResponse
$cfrom :: forall x.
CreateProxySessionResponse -> Rep CreateProxySessionResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateProxySessionResponse' 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:
--
-- 'proxySession', 'createProxySessionResponse_proxySession' - The proxy session details.
--
-- 'httpStatus', 'createProxySessionResponse_httpStatus' - The response's http status code.
newCreateProxySessionResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateProxySessionResponse
newCreateProxySessionResponse :: Int -> CreateProxySessionResponse
newCreateProxySessionResponse Int
pHttpStatus_ =
  CreateProxySessionResponse' :: Maybe ProxySession -> Int -> CreateProxySessionResponse
CreateProxySessionResponse'
    { $sel:proxySession:CreateProxySessionResponse' :: Maybe ProxySession
proxySession =
        Maybe ProxySession
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateProxySessionResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The proxy session details.
createProxySessionResponse_proxySession :: Lens.Lens' CreateProxySessionResponse (Prelude.Maybe ProxySession)
createProxySessionResponse_proxySession :: (Maybe ProxySession -> f (Maybe ProxySession))
-> CreateProxySessionResponse -> f CreateProxySessionResponse
createProxySessionResponse_proxySession = (CreateProxySessionResponse -> Maybe ProxySession)
-> (CreateProxySessionResponse
    -> Maybe ProxySession -> CreateProxySessionResponse)
-> Lens
     CreateProxySessionResponse
     CreateProxySessionResponse
     (Maybe ProxySession)
     (Maybe ProxySession)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateProxySessionResponse' {Maybe ProxySession
proxySession :: Maybe ProxySession
$sel:proxySession:CreateProxySessionResponse' :: CreateProxySessionResponse -> Maybe ProxySession
proxySession} -> Maybe ProxySession
proxySession) (\s :: CreateProxySessionResponse
s@CreateProxySessionResponse' {} Maybe ProxySession
a -> CreateProxySessionResponse
s {$sel:proxySession:CreateProxySessionResponse' :: Maybe ProxySession
proxySession = Maybe ProxySession
a} :: CreateProxySessionResponse)

-- | The response's http status code.
createProxySessionResponse_httpStatus :: Lens.Lens' CreateProxySessionResponse Prelude.Int
createProxySessionResponse_httpStatus :: (Int -> f Int)
-> CreateProxySessionResponse -> f CreateProxySessionResponse
createProxySessionResponse_httpStatus = (CreateProxySessionResponse -> Int)
-> (CreateProxySessionResponse
    -> Int -> CreateProxySessionResponse)
-> Lens
     CreateProxySessionResponse CreateProxySessionResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateProxySessionResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateProxySessionResponse' :: CreateProxySessionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateProxySessionResponse
s@CreateProxySessionResponse' {} Int
a -> CreateProxySessionResponse
s {$sel:httpStatus:CreateProxySessionResponse' :: Int
httpStatus = Int
a} :: CreateProxySessionResponse)

instance Prelude.NFData CreateProxySessionResponse