{-# 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.ListVoiceConnectorTerminationCredentials
-- 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)
--
-- Lists the SIP credentials for the specified Amazon Chime Voice
-- Connector.
module Amazonka.Chime.ListVoiceConnectorTerminationCredentials
  ( -- * Creating a Request
    ListVoiceConnectorTerminationCredentials (..),
    newListVoiceConnectorTerminationCredentials,

    -- * Request Lenses
    listVoiceConnectorTerminationCredentials_voiceConnectorId,

    -- * Destructuring the Response
    ListVoiceConnectorTerminationCredentialsResponse (..),
    newListVoiceConnectorTerminationCredentialsResponse,

    -- * Response Lenses
    listVoiceConnectorTerminationCredentialsResponse_usernames,
    listVoiceConnectorTerminationCredentialsResponse_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:/ 'newListVoiceConnectorTerminationCredentials' smart constructor.
data ListVoiceConnectorTerminationCredentials = ListVoiceConnectorTerminationCredentials'
  { -- | The Amazon Chime Voice Connector ID.
    ListVoiceConnectorTerminationCredentials -> Text
voiceConnectorId :: Prelude.Text
  }
  deriving (ListVoiceConnectorTerminationCredentials
-> ListVoiceConnectorTerminationCredentials -> Bool
(ListVoiceConnectorTerminationCredentials
 -> ListVoiceConnectorTerminationCredentials -> Bool)
-> (ListVoiceConnectorTerminationCredentials
    -> ListVoiceConnectorTerminationCredentials -> Bool)
-> Eq ListVoiceConnectorTerminationCredentials
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListVoiceConnectorTerminationCredentials
-> ListVoiceConnectorTerminationCredentials -> Bool
$c/= :: ListVoiceConnectorTerminationCredentials
-> ListVoiceConnectorTerminationCredentials -> Bool
== :: ListVoiceConnectorTerminationCredentials
-> ListVoiceConnectorTerminationCredentials -> Bool
$c== :: ListVoiceConnectorTerminationCredentials
-> ListVoiceConnectorTerminationCredentials -> Bool
Prelude.Eq, ReadPrec [ListVoiceConnectorTerminationCredentials]
ReadPrec ListVoiceConnectorTerminationCredentials
Int -> ReadS ListVoiceConnectorTerminationCredentials
ReadS [ListVoiceConnectorTerminationCredentials]
(Int -> ReadS ListVoiceConnectorTerminationCredentials)
-> ReadS [ListVoiceConnectorTerminationCredentials]
-> ReadPrec ListVoiceConnectorTerminationCredentials
-> ReadPrec [ListVoiceConnectorTerminationCredentials]
-> Read ListVoiceConnectorTerminationCredentials
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListVoiceConnectorTerminationCredentials]
$creadListPrec :: ReadPrec [ListVoiceConnectorTerminationCredentials]
readPrec :: ReadPrec ListVoiceConnectorTerminationCredentials
$creadPrec :: ReadPrec ListVoiceConnectorTerminationCredentials
readList :: ReadS [ListVoiceConnectorTerminationCredentials]
$creadList :: ReadS [ListVoiceConnectorTerminationCredentials]
readsPrec :: Int -> ReadS ListVoiceConnectorTerminationCredentials
$creadsPrec :: Int -> ReadS ListVoiceConnectorTerminationCredentials
Prelude.Read, Int -> ListVoiceConnectorTerminationCredentials -> ShowS
[ListVoiceConnectorTerminationCredentials] -> ShowS
ListVoiceConnectorTerminationCredentials -> String
(Int -> ListVoiceConnectorTerminationCredentials -> ShowS)
-> (ListVoiceConnectorTerminationCredentials -> String)
-> ([ListVoiceConnectorTerminationCredentials] -> ShowS)
-> Show ListVoiceConnectorTerminationCredentials
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListVoiceConnectorTerminationCredentials] -> ShowS
$cshowList :: [ListVoiceConnectorTerminationCredentials] -> ShowS
show :: ListVoiceConnectorTerminationCredentials -> String
$cshow :: ListVoiceConnectorTerminationCredentials -> String
showsPrec :: Int -> ListVoiceConnectorTerminationCredentials -> ShowS
$cshowsPrec :: Int -> ListVoiceConnectorTerminationCredentials -> ShowS
Prelude.Show, (forall x.
 ListVoiceConnectorTerminationCredentials
 -> Rep ListVoiceConnectorTerminationCredentials x)
-> (forall x.
    Rep ListVoiceConnectorTerminationCredentials x
    -> ListVoiceConnectorTerminationCredentials)
-> Generic ListVoiceConnectorTerminationCredentials
forall x.
Rep ListVoiceConnectorTerminationCredentials x
-> ListVoiceConnectorTerminationCredentials
forall x.
ListVoiceConnectorTerminationCredentials
-> Rep ListVoiceConnectorTerminationCredentials x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListVoiceConnectorTerminationCredentials x
-> ListVoiceConnectorTerminationCredentials
$cfrom :: forall x.
ListVoiceConnectorTerminationCredentials
-> Rep ListVoiceConnectorTerminationCredentials x
Prelude.Generic)

-- |
-- Create a value of 'ListVoiceConnectorTerminationCredentials' 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:
--
-- 'voiceConnectorId', 'listVoiceConnectorTerminationCredentials_voiceConnectorId' - The Amazon Chime Voice Connector ID.
newListVoiceConnectorTerminationCredentials ::
  -- | 'voiceConnectorId'
  Prelude.Text ->
  ListVoiceConnectorTerminationCredentials
newListVoiceConnectorTerminationCredentials :: Text -> ListVoiceConnectorTerminationCredentials
newListVoiceConnectorTerminationCredentials
  Text
pVoiceConnectorId_ =
    ListVoiceConnectorTerminationCredentials' :: Text -> ListVoiceConnectorTerminationCredentials
ListVoiceConnectorTerminationCredentials'
      { $sel:voiceConnectorId:ListVoiceConnectorTerminationCredentials' :: Text
voiceConnectorId =
          Text
pVoiceConnectorId_
      }

-- | The Amazon Chime Voice Connector ID.
listVoiceConnectorTerminationCredentials_voiceConnectorId :: Lens.Lens' ListVoiceConnectorTerminationCredentials Prelude.Text
listVoiceConnectorTerminationCredentials_voiceConnectorId :: (Text -> f Text)
-> ListVoiceConnectorTerminationCredentials
-> f ListVoiceConnectorTerminationCredentials
listVoiceConnectorTerminationCredentials_voiceConnectorId = (ListVoiceConnectorTerminationCredentials -> Text)
-> (ListVoiceConnectorTerminationCredentials
    -> Text -> ListVoiceConnectorTerminationCredentials)
-> Lens
     ListVoiceConnectorTerminationCredentials
     ListVoiceConnectorTerminationCredentials
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListVoiceConnectorTerminationCredentials' {Text
voiceConnectorId :: Text
$sel:voiceConnectorId:ListVoiceConnectorTerminationCredentials' :: ListVoiceConnectorTerminationCredentials -> Text
voiceConnectorId} -> Text
voiceConnectorId) (\s :: ListVoiceConnectorTerminationCredentials
s@ListVoiceConnectorTerminationCredentials' {} Text
a -> ListVoiceConnectorTerminationCredentials
s {$sel:voiceConnectorId:ListVoiceConnectorTerminationCredentials' :: Text
voiceConnectorId = Text
a} :: ListVoiceConnectorTerminationCredentials)

instance
  Core.AWSRequest
    ListVoiceConnectorTerminationCredentials
  where
  type
    AWSResponse
      ListVoiceConnectorTerminationCredentials =
      ListVoiceConnectorTerminationCredentialsResponse
  request :: ListVoiceConnectorTerminationCredentials
-> Request ListVoiceConnectorTerminationCredentials
request = Service
-> ListVoiceConnectorTerminationCredentials
-> Request ListVoiceConnectorTerminationCredentials
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy ListVoiceConnectorTerminationCredentials
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse
           (AWSResponse ListVoiceConnectorTerminationCredentials)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either
      String (AWSResponse ListVoiceConnectorTerminationCredentials))
-> Logger
-> Service
-> Proxy ListVoiceConnectorTerminationCredentials
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse
           (AWSResponse ListVoiceConnectorTerminationCredentials)))
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 [Sensitive Text]
-> Int -> ListVoiceConnectorTerminationCredentialsResponse
ListVoiceConnectorTerminationCredentialsResponse'
            (Maybe [Sensitive Text]
 -> Int -> ListVoiceConnectorTerminationCredentialsResponse)
-> Either String (Maybe [Sensitive Text])
-> Either
     String (Int -> ListVoiceConnectorTerminationCredentialsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [Sensitive Text]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Usernames" Either String (Maybe (Maybe [Sensitive Text]))
-> Maybe [Sensitive Text] -> Either String (Maybe [Sensitive Text])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [Sensitive Text]
forall a. Monoid a => a
Prelude.mempty)
              Either
  String (Int -> ListVoiceConnectorTerminationCredentialsResponse)
-> Either String Int
-> Either String ListVoiceConnectorTerminationCredentialsResponse
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
    ListVoiceConnectorTerminationCredentials

instance
  Prelude.NFData
    ListVoiceConnectorTerminationCredentials

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

instance
  Core.ToPath
    ListVoiceConnectorTerminationCredentials
  where
  toPath :: ListVoiceConnectorTerminationCredentials -> ByteString
toPath ListVoiceConnectorTerminationCredentials' {Text
voiceConnectorId :: Text
$sel:voiceConnectorId:ListVoiceConnectorTerminationCredentials' :: ListVoiceConnectorTerminationCredentials -> Text
..} =
    [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
"/termination/credentials"
      ]

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

-- | /See:/ 'newListVoiceConnectorTerminationCredentialsResponse' smart constructor.
data ListVoiceConnectorTerminationCredentialsResponse = ListVoiceConnectorTerminationCredentialsResponse'
  { -- | A list of user names.
    ListVoiceConnectorTerminationCredentialsResponse
-> Maybe [Sensitive Text]
usernames :: Prelude.Maybe [Core.Sensitive Prelude.Text],
    -- | The response's http status code.
    ListVoiceConnectorTerminationCredentialsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListVoiceConnectorTerminationCredentialsResponse
-> ListVoiceConnectorTerminationCredentialsResponse -> Bool
(ListVoiceConnectorTerminationCredentialsResponse
 -> ListVoiceConnectorTerminationCredentialsResponse -> Bool)
-> (ListVoiceConnectorTerminationCredentialsResponse
    -> ListVoiceConnectorTerminationCredentialsResponse -> Bool)
-> Eq ListVoiceConnectorTerminationCredentialsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListVoiceConnectorTerminationCredentialsResponse
-> ListVoiceConnectorTerminationCredentialsResponse -> Bool
$c/= :: ListVoiceConnectorTerminationCredentialsResponse
-> ListVoiceConnectorTerminationCredentialsResponse -> Bool
== :: ListVoiceConnectorTerminationCredentialsResponse
-> ListVoiceConnectorTerminationCredentialsResponse -> Bool
$c== :: ListVoiceConnectorTerminationCredentialsResponse
-> ListVoiceConnectorTerminationCredentialsResponse -> Bool
Prelude.Eq, Int -> ListVoiceConnectorTerminationCredentialsResponse -> ShowS
[ListVoiceConnectorTerminationCredentialsResponse] -> ShowS
ListVoiceConnectorTerminationCredentialsResponse -> String
(Int -> ListVoiceConnectorTerminationCredentialsResponse -> ShowS)
-> (ListVoiceConnectorTerminationCredentialsResponse -> String)
-> ([ListVoiceConnectorTerminationCredentialsResponse] -> ShowS)
-> Show ListVoiceConnectorTerminationCredentialsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListVoiceConnectorTerminationCredentialsResponse] -> ShowS
$cshowList :: [ListVoiceConnectorTerminationCredentialsResponse] -> ShowS
show :: ListVoiceConnectorTerminationCredentialsResponse -> String
$cshow :: ListVoiceConnectorTerminationCredentialsResponse -> String
showsPrec :: Int -> ListVoiceConnectorTerminationCredentialsResponse -> ShowS
$cshowsPrec :: Int -> ListVoiceConnectorTerminationCredentialsResponse -> ShowS
Prelude.Show, (forall x.
 ListVoiceConnectorTerminationCredentialsResponse
 -> Rep ListVoiceConnectorTerminationCredentialsResponse x)
-> (forall x.
    Rep ListVoiceConnectorTerminationCredentialsResponse x
    -> ListVoiceConnectorTerminationCredentialsResponse)
-> Generic ListVoiceConnectorTerminationCredentialsResponse
forall x.
Rep ListVoiceConnectorTerminationCredentialsResponse x
-> ListVoiceConnectorTerminationCredentialsResponse
forall x.
ListVoiceConnectorTerminationCredentialsResponse
-> Rep ListVoiceConnectorTerminationCredentialsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListVoiceConnectorTerminationCredentialsResponse x
-> ListVoiceConnectorTerminationCredentialsResponse
$cfrom :: forall x.
ListVoiceConnectorTerminationCredentialsResponse
-> Rep ListVoiceConnectorTerminationCredentialsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListVoiceConnectorTerminationCredentialsResponse' 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:
--
-- 'usernames', 'listVoiceConnectorTerminationCredentialsResponse_usernames' - A list of user names.
--
-- 'httpStatus', 'listVoiceConnectorTerminationCredentialsResponse_httpStatus' - The response's http status code.
newListVoiceConnectorTerminationCredentialsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListVoiceConnectorTerminationCredentialsResponse
newListVoiceConnectorTerminationCredentialsResponse :: Int -> ListVoiceConnectorTerminationCredentialsResponse
newListVoiceConnectorTerminationCredentialsResponse
  Int
pHttpStatus_ =
    ListVoiceConnectorTerminationCredentialsResponse' :: Maybe [Sensitive Text]
-> Int -> ListVoiceConnectorTerminationCredentialsResponse
ListVoiceConnectorTerminationCredentialsResponse'
      { $sel:usernames:ListVoiceConnectorTerminationCredentialsResponse' :: Maybe [Sensitive Text]
usernames =
          Maybe [Sensitive Text]
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:ListVoiceConnectorTerminationCredentialsResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

-- | A list of user names.
listVoiceConnectorTerminationCredentialsResponse_usernames :: Lens.Lens' ListVoiceConnectorTerminationCredentialsResponse (Prelude.Maybe [Prelude.Text])
listVoiceConnectorTerminationCredentialsResponse_usernames :: (Maybe [Text] -> f (Maybe [Text]))
-> ListVoiceConnectorTerminationCredentialsResponse
-> f ListVoiceConnectorTerminationCredentialsResponse
listVoiceConnectorTerminationCredentialsResponse_usernames = (ListVoiceConnectorTerminationCredentialsResponse
 -> Maybe [Sensitive Text])
-> (ListVoiceConnectorTerminationCredentialsResponse
    -> Maybe [Sensitive Text]
    -> ListVoiceConnectorTerminationCredentialsResponse)
-> Lens
     ListVoiceConnectorTerminationCredentialsResponse
     ListVoiceConnectorTerminationCredentialsResponse
     (Maybe [Sensitive Text])
     (Maybe [Sensitive Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListVoiceConnectorTerminationCredentialsResponse' {Maybe [Sensitive Text]
usernames :: Maybe [Sensitive Text]
$sel:usernames:ListVoiceConnectorTerminationCredentialsResponse' :: ListVoiceConnectorTerminationCredentialsResponse
-> Maybe [Sensitive Text]
usernames} -> Maybe [Sensitive Text]
usernames) (\s :: ListVoiceConnectorTerminationCredentialsResponse
s@ListVoiceConnectorTerminationCredentialsResponse' {} Maybe [Sensitive Text]
a -> ListVoiceConnectorTerminationCredentialsResponse
s {$sel:usernames:ListVoiceConnectorTerminationCredentialsResponse' :: Maybe [Sensitive Text]
usernames = Maybe [Sensitive Text]
a} :: ListVoiceConnectorTerminationCredentialsResponse) ((Maybe [Sensitive Text] -> f (Maybe [Sensitive Text]))
 -> ListVoiceConnectorTerminationCredentialsResponse
 -> f ListVoiceConnectorTerminationCredentialsResponse)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Sensitive Text] -> f (Maybe [Sensitive Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> ListVoiceConnectorTerminationCredentialsResponse
-> f ListVoiceConnectorTerminationCredentialsResponse
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 s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance
  Prelude.NFData
    ListVoiceConnectorTerminationCredentialsResponse