{-# 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.ListProxySessions
-- 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.ListProxySessions
  ( -- * Creating a Request
    ListProxySessions (..),
    newListProxySessions,

    -- * Request Lenses
    listProxySessions_maxResults,
    listProxySessions_nextToken,
    listProxySessions_status,
    listProxySessions_voiceConnectorId,

    -- * Destructuring the Response
    ListProxySessionsResponse (..),
    newListProxySessionsResponse,

    -- * Response Lenses
    listProxySessionsResponse_nextToken,
    listProxySessionsResponse_proxySessions,
    listProxySessionsResponse_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:/ 'newListProxySessions' smart constructor.
data ListProxySessions = ListProxySessions'
  { ListProxySessions -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    ListProxySessions -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    ListProxySessions -> Maybe ProxySessionStatus
status :: Prelude.Maybe ProxySessionStatus,
    ListProxySessions -> Text
voiceConnectorId :: Prelude.Text
  }
  deriving (ListProxySessions -> ListProxySessions -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListProxySessions -> ListProxySessions -> Bool
$c/= :: ListProxySessions -> ListProxySessions -> Bool
== :: ListProxySessions -> ListProxySessions -> Bool
$c== :: ListProxySessions -> ListProxySessions -> Bool
Prelude.Eq, ReadPrec [ListProxySessions]
ReadPrec ListProxySessions
Int -> ReadS ListProxySessions
ReadS [ListProxySessions]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListProxySessions]
$creadListPrec :: ReadPrec [ListProxySessions]
readPrec :: ReadPrec ListProxySessions
$creadPrec :: ReadPrec ListProxySessions
readList :: ReadS [ListProxySessions]
$creadList :: ReadS [ListProxySessions]
readsPrec :: Int -> ReadS ListProxySessions
$creadsPrec :: Int -> ReadS ListProxySessions
Prelude.Read, Int -> ListProxySessions -> ShowS
[ListProxySessions] -> ShowS
ListProxySessions -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListProxySessions] -> ShowS
$cshowList :: [ListProxySessions] -> ShowS
show :: ListProxySessions -> String
$cshow :: ListProxySessions -> String
showsPrec :: Int -> ListProxySessions -> ShowS
$cshowsPrec :: Int -> ListProxySessions -> ShowS
Prelude.Show, forall x. Rep ListProxySessions x -> ListProxySessions
forall x. ListProxySessions -> Rep ListProxySessions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListProxySessions x -> ListProxySessions
$cfrom :: forall x. ListProxySessions -> Rep ListProxySessions x
Prelude.Generic)

-- |
-- Create a value of 'ListProxySessions' 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:
--
-- 'maxResults', 'listProxySessions_maxResults' - Undocumented member.
--
-- 'nextToken', 'listProxySessions_nextToken' - Undocumented member.
--
-- 'status', 'listProxySessions_status' - Undocumented member.
--
-- 'voiceConnectorId', 'listProxySessions_voiceConnectorId' - Undocumented member.
newListProxySessions ::
  -- | 'voiceConnectorId'
  Prelude.Text ->
  ListProxySessions
newListProxySessions :: Text -> ListProxySessions
newListProxySessions Text
pVoiceConnectorId_ =
  ListProxySessions'
    { $sel:maxResults:ListProxySessions' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListProxySessions' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:status:ListProxySessions' :: Maybe ProxySessionStatus
status = forall a. Maybe a
Prelude.Nothing,
      $sel:voiceConnectorId:ListProxySessions' :: Text
voiceConnectorId = Text
pVoiceConnectorId_
    }

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

-- | Undocumented member.
listProxySessions_nextToken :: Lens.Lens' ListProxySessions (Prelude.Maybe Prelude.Text)
listProxySessions_nextToken :: Lens' ListProxySessions (Maybe Text)
listProxySessions_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListProxySessions' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListProxySessions' :: ListProxySessions -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListProxySessions
s@ListProxySessions' {} Maybe Text
a -> ListProxySessions
s {$sel:nextToken:ListProxySessions' :: Maybe Text
nextToken = Maybe Text
a} :: ListProxySessions)

-- | Undocumented member.
listProxySessions_status :: Lens.Lens' ListProxySessions (Prelude.Maybe ProxySessionStatus)
listProxySessions_status :: Lens' ListProxySessions (Maybe ProxySessionStatus)
listProxySessions_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListProxySessions' {Maybe ProxySessionStatus
status :: Maybe ProxySessionStatus
$sel:status:ListProxySessions' :: ListProxySessions -> Maybe ProxySessionStatus
status} -> Maybe ProxySessionStatus
status) (\s :: ListProxySessions
s@ListProxySessions' {} Maybe ProxySessionStatus
a -> ListProxySessions
s {$sel:status:ListProxySessions' :: Maybe ProxySessionStatus
status = Maybe ProxySessionStatus
a} :: ListProxySessions)

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

instance Core.AWSRequest ListProxySessions where
  type
    AWSResponse ListProxySessions =
      ListProxySessionsResponse
  request :: (Service -> Service)
-> ListProxySessions -> Request ListProxySessions
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy ListProxySessions
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListProxySessions)))
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 Text
-> Maybe [ProxySession] -> Int -> ListProxySessionsResponse
ListProxySessionsResponse'
            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
"NextToken")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"ProxySessions" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
            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 ListProxySessions where
  hashWithSalt :: Int -> ListProxySessions -> Int
hashWithSalt Int
_salt ListProxySessions' {Maybe Natural
Maybe Text
Maybe ProxySessionStatus
Text
voiceConnectorId :: Text
status :: Maybe ProxySessionStatus
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:voiceConnectorId:ListProxySessions' :: ListProxySessions -> Text
$sel:status:ListProxySessions' :: ListProxySessions -> Maybe ProxySessionStatus
$sel:nextToken:ListProxySessions' :: ListProxySessions -> Maybe Text
$sel:maxResults:ListProxySessions' :: ListProxySessions -> Maybe Natural
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxResults
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ProxySessionStatus
status
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
voiceConnectorId

instance Prelude.NFData ListProxySessions where
  rnf :: ListProxySessions -> ()
rnf ListProxySessions' {Maybe Natural
Maybe Text
Maybe ProxySessionStatus
Text
voiceConnectorId :: Text
status :: Maybe ProxySessionStatus
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:voiceConnectorId:ListProxySessions' :: ListProxySessions -> Text
$sel:status:ListProxySessions' :: ListProxySessions -> Maybe ProxySessionStatus
$sel:nextToken:ListProxySessions' :: ListProxySessions -> Maybe Text
$sel:maxResults:ListProxySessions' :: ListProxySessions -> Maybe Natural
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
maxResults
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ProxySessionStatus
status
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
voiceConnectorId

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

instance Data.ToPath ListProxySessions where
  toPath :: ListProxySessions -> ByteString
toPath ListProxySessions' {Maybe Natural
Maybe Text
Maybe ProxySessionStatus
Text
voiceConnectorId :: Text
status :: Maybe ProxySessionStatus
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:voiceConnectorId:ListProxySessions' :: ListProxySessions -> Text
$sel:status:ListProxySessions' :: ListProxySessions -> Maybe ProxySessionStatus
$sel:nextToken:ListProxySessions' :: ListProxySessions -> Maybe Text
$sel:maxResults:ListProxySessions' :: ListProxySessions -> 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"
      ]

instance Data.ToQuery ListProxySessions where
  toQuery :: ListProxySessions -> QueryString
toQuery ListProxySessions' {Maybe Natural
Maybe Text
Maybe ProxySessionStatus
Text
voiceConnectorId :: Text
status :: Maybe ProxySessionStatus
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:voiceConnectorId:ListProxySessions' :: ListProxySessions -> Text
$sel:status:ListProxySessions' :: ListProxySessions -> Maybe ProxySessionStatus
$sel:nextToken:ListProxySessions' :: ListProxySessions -> Maybe Text
$sel:maxResults:ListProxySessions' :: ListProxySessions -> Maybe Natural
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"max-results" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Natural
maxResults,
        ByteString
"next-token" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
nextToken,
        ByteString
"status" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe ProxySessionStatus
status
      ]

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

-- |
-- Create a value of 'ListProxySessionsResponse' 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:
--
-- 'nextToken', 'listProxySessionsResponse_nextToken' - Undocumented member.
--
-- 'proxySessions', 'listProxySessionsResponse_proxySessions' - Undocumented member.
--
-- 'httpStatus', 'listProxySessionsResponse_httpStatus' - The response's http status code.
newListProxySessionsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListProxySessionsResponse
newListProxySessionsResponse :: Int -> ListProxySessionsResponse
newListProxySessionsResponse Int
pHttpStatus_ =
  ListProxySessionsResponse'
    { $sel:nextToken:ListProxySessionsResponse' :: Maybe Text
nextToken =
        forall a. Maybe a
Prelude.Nothing,
      $sel:proxySessions:ListProxySessionsResponse' :: Maybe [ProxySession]
proxySessions = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListProxySessionsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Undocumented member.
listProxySessionsResponse_nextToken :: Lens.Lens' ListProxySessionsResponse (Prelude.Maybe Prelude.Text)
listProxySessionsResponse_nextToken :: Lens' ListProxySessionsResponse (Maybe Text)
listProxySessionsResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListProxySessionsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListProxySessionsResponse' :: ListProxySessionsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListProxySessionsResponse
s@ListProxySessionsResponse' {} Maybe Text
a -> ListProxySessionsResponse
s {$sel:nextToken:ListProxySessionsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListProxySessionsResponse)

-- | Undocumented member.
listProxySessionsResponse_proxySessions :: Lens.Lens' ListProxySessionsResponse (Prelude.Maybe [ProxySession])
listProxySessionsResponse_proxySessions :: Lens' ListProxySessionsResponse (Maybe [ProxySession])
listProxySessionsResponse_proxySessions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListProxySessionsResponse' {Maybe [ProxySession]
proxySessions :: Maybe [ProxySession]
$sel:proxySessions:ListProxySessionsResponse' :: ListProxySessionsResponse -> Maybe [ProxySession]
proxySessions} -> Maybe [ProxySession]
proxySessions) (\s :: ListProxySessionsResponse
s@ListProxySessionsResponse' {} Maybe [ProxySession]
a -> ListProxySessionsResponse
s {$sel:proxySessions:ListProxySessionsResponse' :: Maybe [ProxySession]
proxySessions = Maybe [ProxySession]
a} :: ListProxySessionsResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.NFData ListProxySessionsResponse where
  rnf :: ListProxySessionsResponse -> ()
rnf ListProxySessionsResponse' {Int
Maybe [ProxySession]
Maybe Text
httpStatus :: Int
proxySessions :: Maybe [ProxySession]
nextToken :: Maybe Text
$sel:httpStatus:ListProxySessionsResponse' :: ListProxySessionsResponse -> Int
$sel:proxySessions:ListProxySessionsResponse' :: ListProxySessionsResponse -> Maybe [ProxySession]
$sel:nextToken:ListProxySessionsResponse' :: ListProxySessionsResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [ProxySession]
proxySessions
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus