{-# 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.ChimeSdkVoice.UpdateProxySession
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- -- | Undocumented operation.
module Amazonka.ChimeSdkVoice.UpdateProxySession
  ( -- * Creating a Request
    UpdateProxySession (..),
    newUpdateProxySession,

    -- * Request Lenses
    updateProxySession_expiryMinutes,
    updateProxySession_capabilities,
    updateProxySession_voiceConnectorId,
    updateProxySession_proxySessionId,

    -- * Destructuring the Response
    UpdateProxySessionResponse (..),
    newUpdateProxySessionResponse,

    -- * Response Lenses
    updateProxySessionResponse_proxySession,
    updateProxySessionResponse_httpStatus,
  )
where

import Amazonka.ChimeSdkVoice.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newUpdateProxySession' smart constructor.
data UpdateProxySession = UpdateProxySession'
  { UpdateProxySession -> Maybe Natural
expiryMinutes :: Prelude.Maybe Prelude.Natural,
    UpdateProxySession -> [Capability]
capabilities :: [Capability],
    UpdateProxySession -> Text
voiceConnectorId :: Prelude.Text,
    UpdateProxySession -> Text
proxySessionId :: Prelude.Text
  }
  deriving (UpdateProxySession -> UpdateProxySession -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateProxySession -> UpdateProxySession -> Bool
$c/= :: UpdateProxySession -> UpdateProxySession -> Bool
== :: UpdateProxySession -> UpdateProxySession -> Bool
$c== :: UpdateProxySession -> UpdateProxySession -> Bool
Prelude.Eq, ReadPrec [UpdateProxySession]
ReadPrec UpdateProxySession
Int -> ReadS UpdateProxySession
ReadS [UpdateProxySession]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateProxySession]
$creadListPrec :: ReadPrec [UpdateProxySession]
readPrec :: ReadPrec UpdateProxySession
$creadPrec :: ReadPrec UpdateProxySession
readList :: ReadS [UpdateProxySession]
$creadList :: ReadS [UpdateProxySession]
readsPrec :: Int -> ReadS UpdateProxySession
$creadsPrec :: Int -> ReadS UpdateProxySession
Prelude.Read, Int -> UpdateProxySession -> ShowS
[UpdateProxySession] -> ShowS
UpdateProxySession -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateProxySession] -> ShowS
$cshowList :: [UpdateProxySession] -> ShowS
show :: UpdateProxySession -> String
$cshow :: UpdateProxySession -> String
showsPrec :: Int -> UpdateProxySession -> ShowS
$cshowsPrec :: Int -> UpdateProxySession -> ShowS
Prelude.Show, forall x. Rep UpdateProxySession x -> UpdateProxySession
forall x. UpdateProxySession -> Rep UpdateProxySession x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateProxySession x -> UpdateProxySession
$cfrom :: forall x. UpdateProxySession -> Rep UpdateProxySession x
Prelude.Generic)

-- |
-- Create a value of 'UpdateProxySession' 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:
--
-- 'expiryMinutes', 'updateProxySession_expiryMinutes' - Undocumented member.
--
-- 'capabilities', 'updateProxySession_capabilities' - Undocumented member.
--
-- 'voiceConnectorId', 'updateProxySession_voiceConnectorId' - Undocumented member.
--
-- 'proxySessionId', 'updateProxySession_proxySessionId' - Undocumented member.
newUpdateProxySession ::
  -- | 'voiceConnectorId'
  Prelude.Text ->
  -- | 'proxySessionId'
  Prelude.Text ->
  UpdateProxySession
newUpdateProxySession :: Text -> Text -> UpdateProxySession
newUpdateProxySession
  Text
pVoiceConnectorId_
  Text
pProxySessionId_ =
    UpdateProxySession'
      { $sel:expiryMinutes:UpdateProxySession' :: Maybe Natural
expiryMinutes =
          forall a. Maybe a
Prelude.Nothing,
        $sel:capabilities:UpdateProxySession' :: [Capability]
capabilities = forall a. Monoid a => a
Prelude.mempty,
        $sel:voiceConnectorId:UpdateProxySession' :: Text
voiceConnectorId = Text
pVoiceConnectorId_,
        $sel:proxySessionId:UpdateProxySession' :: Text
proxySessionId = Text
pProxySessionId_
      }

-- | Undocumented member.
updateProxySession_expiryMinutes :: Lens.Lens' UpdateProxySession (Prelude.Maybe Prelude.Natural)
updateProxySession_expiryMinutes :: Lens' UpdateProxySession (Maybe Natural)
updateProxySession_expiryMinutes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateProxySession' {Maybe Natural
expiryMinutes :: Maybe Natural
$sel:expiryMinutes:UpdateProxySession' :: UpdateProxySession -> Maybe Natural
expiryMinutes} -> Maybe Natural
expiryMinutes) (\s :: UpdateProxySession
s@UpdateProxySession' {} Maybe Natural
a -> UpdateProxySession
s {$sel:expiryMinutes:UpdateProxySession' :: Maybe Natural
expiryMinutes = Maybe Natural
a} :: UpdateProxySession)

-- | Undocumented member.
updateProxySession_capabilities :: Lens.Lens' UpdateProxySession [Capability]
updateProxySession_capabilities :: Lens' UpdateProxySession [Capability]
updateProxySession_capabilities = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateProxySession' {[Capability]
capabilities :: [Capability]
$sel:capabilities:UpdateProxySession' :: UpdateProxySession -> [Capability]
capabilities} -> [Capability]
capabilities) (\s :: UpdateProxySession
s@UpdateProxySession' {} [Capability]
a -> UpdateProxySession
s {$sel:capabilities:UpdateProxySession' :: [Capability]
capabilities = [Capability]
a} :: UpdateProxySession) 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

-- | Undocumented member.
updateProxySession_voiceConnectorId :: Lens.Lens' UpdateProxySession Prelude.Text
updateProxySession_voiceConnectorId :: Lens' UpdateProxySession Text
updateProxySession_voiceConnectorId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateProxySession' {Text
voiceConnectorId :: Text
$sel:voiceConnectorId:UpdateProxySession' :: UpdateProxySession -> Text
voiceConnectorId} -> Text
voiceConnectorId) (\s :: UpdateProxySession
s@UpdateProxySession' {} Text
a -> UpdateProxySession
s {$sel:voiceConnectorId:UpdateProxySession' :: Text
voiceConnectorId = Text
a} :: UpdateProxySession)

-- | Undocumented member.
updateProxySession_proxySessionId :: Lens.Lens' UpdateProxySession Prelude.Text
updateProxySession_proxySessionId :: Lens' UpdateProxySession Text
updateProxySession_proxySessionId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateProxySession' {Text
proxySessionId :: Text
$sel:proxySessionId:UpdateProxySession' :: UpdateProxySession -> Text
proxySessionId} -> Text
proxySessionId) (\s :: UpdateProxySession
s@UpdateProxySession' {} Text
a -> UpdateProxySession
s {$sel:proxySessionId:UpdateProxySession' :: Text
proxySessionId = Text
a} :: UpdateProxySession)

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

instance Prelude.Hashable UpdateProxySession where
  hashWithSalt :: Int -> UpdateProxySession -> Int
hashWithSalt Int
_salt UpdateProxySession' {[Capability]
Maybe Natural
Text
proxySessionId :: Text
voiceConnectorId :: Text
capabilities :: [Capability]
expiryMinutes :: Maybe Natural
$sel:proxySessionId:UpdateProxySession' :: UpdateProxySession -> Text
$sel:voiceConnectorId:UpdateProxySession' :: UpdateProxySession -> Text
$sel:capabilities:UpdateProxySession' :: UpdateProxySession -> [Capability]
$sel:expiryMinutes:UpdateProxySession' :: UpdateProxySession -> Maybe Natural
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
expiryMinutes
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [Capability]
capabilities
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
voiceConnectorId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
proxySessionId

instance Prelude.NFData UpdateProxySession where
  rnf :: UpdateProxySession -> ()
rnf UpdateProxySession' {[Capability]
Maybe Natural
Text
proxySessionId :: Text
voiceConnectorId :: Text
capabilities :: [Capability]
expiryMinutes :: Maybe Natural
$sel:proxySessionId:UpdateProxySession' :: UpdateProxySession -> Text
$sel:voiceConnectorId:UpdateProxySession' :: UpdateProxySession -> Text
$sel:capabilities:UpdateProxySession' :: UpdateProxySession -> [Capability]
$sel:expiryMinutes:UpdateProxySession' :: UpdateProxySession -> Maybe Natural
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
expiryMinutes
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [Capability]
capabilities
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
voiceConnectorId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
proxySessionId

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

instance Data.ToJSON UpdateProxySession where
  toJSON :: UpdateProxySession -> Value
toJSON UpdateProxySession' {[Capability]
Maybe Natural
Text
proxySessionId :: Text
voiceConnectorId :: Text
capabilities :: [Capability]
expiryMinutes :: Maybe Natural
$sel:proxySessionId:UpdateProxySession' :: UpdateProxySession -> Text
$sel:voiceConnectorId:UpdateProxySession' :: UpdateProxySession -> Text
$sel:capabilities:UpdateProxySession' :: UpdateProxySession -> [Capability]
$sel:expiryMinutes:UpdateProxySession' :: UpdateProxySession -> Maybe Natural
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"ExpiryMinutes" 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 Natural
expiryMinutes,
            forall a. a -> Maybe a
Prelude.Just (Key
"Capabilities" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= [Capability]
capabilities)
          ]
      )

instance Data.ToPath UpdateProxySession where
  toPath :: UpdateProxySession -> ByteString
toPath UpdateProxySession' {[Capability]
Maybe Natural
Text
proxySessionId :: Text
voiceConnectorId :: Text
capabilities :: [Capability]
expiryMinutes :: Maybe Natural
$sel:proxySessionId:UpdateProxySession' :: UpdateProxySession -> Text
$sel:voiceConnectorId:UpdateProxySession' :: UpdateProxySession -> Text
$sel:capabilities:UpdateProxySession' :: UpdateProxySession -> [Capability]
$sel:expiryMinutes:UpdateProxySession' :: UpdateProxySession -> Maybe Natural
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/voice-connectors/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
voiceConnectorId,
        ByteString
"/proxy-sessions/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
proxySessionId
      ]

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

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

-- |
-- Create a value of 'UpdateProxySessionResponse' 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', 'updateProxySessionResponse_proxySession' - Undocumented member.
--
-- 'httpStatus', 'updateProxySessionResponse_httpStatus' - The response's http status code.
newUpdateProxySessionResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  UpdateProxySessionResponse
newUpdateProxySessionResponse :: Int -> UpdateProxySessionResponse
newUpdateProxySessionResponse Int
pHttpStatus_ =
  UpdateProxySessionResponse'
    { $sel:proxySession:UpdateProxySessionResponse' :: Maybe ProxySession
proxySession =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:UpdateProxySessionResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Undocumented member.
updateProxySessionResponse_proxySession :: Lens.Lens' UpdateProxySessionResponse (Prelude.Maybe ProxySession)
updateProxySessionResponse_proxySession :: Lens' UpdateProxySessionResponse (Maybe ProxySession)
updateProxySessionResponse_proxySession = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateProxySessionResponse' {Maybe ProxySession
proxySession :: Maybe ProxySession
$sel:proxySession:UpdateProxySessionResponse' :: UpdateProxySessionResponse -> Maybe ProxySession
proxySession} -> Maybe ProxySession
proxySession) (\s :: UpdateProxySessionResponse
s@UpdateProxySessionResponse' {} Maybe ProxySession
a -> UpdateProxySessionResponse
s {$sel:proxySession:UpdateProxySessionResponse' :: Maybe ProxySession
proxySession = Maybe ProxySession
a} :: UpdateProxySessionResponse)

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

instance Prelude.NFData UpdateProxySessionResponse where
  rnf :: UpdateProxySessionResponse -> ()
rnf UpdateProxySessionResponse' {Int
Maybe ProxySession
httpStatus :: Int
proxySession :: Maybe ProxySession
$sel:httpStatus:UpdateProxySessionResponse' :: UpdateProxySessionResponse -> Int
$sel:proxySession:UpdateProxySessionResponse' :: UpdateProxySessionResponse -> Maybe ProxySession
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe ProxySession
proxySession
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus