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

    -- * Request Lenses
    putVoiceConnectorTerminationCredentials_credentials,
    putVoiceConnectorTerminationCredentials_voiceConnectorId,

    -- * Destructuring the Response
    PutVoiceConnectorTerminationCredentialsResponse (..),
    newPutVoiceConnectorTerminationCredentialsResponse,
  )
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:/ 'newPutVoiceConnectorTerminationCredentials' smart constructor.
data PutVoiceConnectorTerminationCredentials = PutVoiceConnectorTerminationCredentials'
  { -- | The termination SIP credentials.
    PutVoiceConnectorTerminationCredentials -> Maybe [Credential]
credentials :: Prelude.Maybe [Credential],
    -- | The Amazon Chime Voice Connector ID.
    PutVoiceConnectorTerminationCredentials -> Text
voiceConnectorId :: Prelude.Text
  }
  deriving (PutVoiceConnectorTerminationCredentials
-> PutVoiceConnectorTerminationCredentials -> Bool
(PutVoiceConnectorTerminationCredentials
 -> PutVoiceConnectorTerminationCredentials -> Bool)
-> (PutVoiceConnectorTerminationCredentials
    -> PutVoiceConnectorTerminationCredentials -> Bool)
-> Eq PutVoiceConnectorTerminationCredentials
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutVoiceConnectorTerminationCredentials
-> PutVoiceConnectorTerminationCredentials -> Bool
$c/= :: PutVoiceConnectorTerminationCredentials
-> PutVoiceConnectorTerminationCredentials -> Bool
== :: PutVoiceConnectorTerminationCredentials
-> PutVoiceConnectorTerminationCredentials -> Bool
$c== :: PutVoiceConnectorTerminationCredentials
-> PutVoiceConnectorTerminationCredentials -> Bool
Prelude.Eq, Int -> PutVoiceConnectorTerminationCredentials -> ShowS
[PutVoiceConnectorTerminationCredentials] -> ShowS
PutVoiceConnectorTerminationCredentials -> String
(Int -> PutVoiceConnectorTerminationCredentials -> ShowS)
-> (PutVoiceConnectorTerminationCredentials -> String)
-> ([PutVoiceConnectorTerminationCredentials] -> ShowS)
-> Show PutVoiceConnectorTerminationCredentials
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutVoiceConnectorTerminationCredentials] -> ShowS
$cshowList :: [PutVoiceConnectorTerminationCredentials] -> ShowS
show :: PutVoiceConnectorTerminationCredentials -> String
$cshow :: PutVoiceConnectorTerminationCredentials -> String
showsPrec :: Int -> PutVoiceConnectorTerminationCredentials -> ShowS
$cshowsPrec :: Int -> PutVoiceConnectorTerminationCredentials -> ShowS
Prelude.Show, (forall x.
 PutVoiceConnectorTerminationCredentials
 -> Rep PutVoiceConnectorTerminationCredentials x)
-> (forall x.
    Rep PutVoiceConnectorTerminationCredentials x
    -> PutVoiceConnectorTerminationCredentials)
-> Generic PutVoiceConnectorTerminationCredentials
forall x.
Rep PutVoiceConnectorTerminationCredentials x
-> PutVoiceConnectorTerminationCredentials
forall x.
PutVoiceConnectorTerminationCredentials
-> Rep PutVoiceConnectorTerminationCredentials x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PutVoiceConnectorTerminationCredentials x
-> PutVoiceConnectorTerminationCredentials
$cfrom :: forall x.
PutVoiceConnectorTerminationCredentials
-> Rep PutVoiceConnectorTerminationCredentials x
Prelude.Generic)

-- |
-- Create a value of 'PutVoiceConnectorTerminationCredentials' 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:
--
-- 'credentials', 'putVoiceConnectorTerminationCredentials_credentials' - The termination SIP credentials.
--
-- 'voiceConnectorId', 'putVoiceConnectorTerminationCredentials_voiceConnectorId' - The Amazon Chime Voice Connector ID.
newPutVoiceConnectorTerminationCredentials ::
  -- | 'voiceConnectorId'
  Prelude.Text ->
  PutVoiceConnectorTerminationCredentials
newPutVoiceConnectorTerminationCredentials :: Text -> PutVoiceConnectorTerminationCredentials
newPutVoiceConnectorTerminationCredentials
  Text
pVoiceConnectorId_ =
    PutVoiceConnectorTerminationCredentials' :: Maybe [Credential]
-> Text -> PutVoiceConnectorTerminationCredentials
PutVoiceConnectorTerminationCredentials'
      { $sel:credentials:PutVoiceConnectorTerminationCredentials' :: Maybe [Credential]
credentials =
          Maybe [Credential]
forall a. Maybe a
Prelude.Nothing,
        $sel:voiceConnectorId:PutVoiceConnectorTerminationCredentials' :: Text
voiceConnectorId =
          Text
pVoiceConnectorId_
      }

-- | The termination SIP credentials.
putVoiceConnectorTerminationCredentials_credentials :: Lens.Lens' PutVoiceConnectorTerminationCredentials (Prelude.Maybe [Credential])
putVoiceConnectorTerminationCredentials_credentials :: (Maybe [Credential] -> f (Maybe [Credential]))
-> PutVoiceConnectorTerminationCredentials
-> f PutVoiceConnectorTerminationCredentials
putVoiceConnectorTerminationCredentials_credentials = (PutVoiceConnectorTerminationCredentials -> Maybe [Credential])
-> (PutVoiceConnectorTerminationCredentials
    -> Maybe [Credential] -> PutVoiceConnectorTerminationCredentials)
-> Lens
     PutVoiceConnectorTerminationCredentials
     PutVoiceConnectorTerminationCredentials
     (Maybe [Credential])
     (Maybe [Credential])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutVoiceConnectorTerminationCredentials' {Maybe [Credential]
credentials :: Maybe [Credential]
$sel:credentials:PutVoiceConnectorTerminationCredentials' :: PutVoiceConnectorTerminationCredentials -> Maybe [Credential]
credentials} -> Maybe [Credential]
credentials) (\s :: PutVoiceConnectorTerminationCredentials
s@PutVoiceConnectorTerminationCredentials' {} Maybe [Credential]
a -> PutVoiceConnectorTerminationCredentials
s {$sel:credentials:PutVoiceConnectorTerminationCredentials' :: Maybe [Credential]
credentials = Maybe [Credential]
a} :: PutVoiceConnectorTerminationCredentials) ((Maybe [Credential] -> f (Maybe [Credential]))
 -> PutVoiceConnectorTerminationCredentials
 -> f PutVoiceConnectorTerminationCredentials)
-> ((Maybe [Credential] -> f (Maybe [Credential]))
    -> Maybe [Credential] -> f (Maybe [Credential]))
-> (Maybe [Credential] -> f (Maybe [Credential]))
-> PutVoiceConnectorTerminationCredentials
-> f PutVoiceConnectorTerminationCredentials
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Credential] [Credential] [Credential] [Credential]
-> Iso
     (Maybe [Credential])
     (Maybe [Credential])
     (Maybe [Credential])
     (Maybe [Credential])
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 [Credential] [Credential] [Credential] [Credential]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance
  Core.AWSRequest
    PutVoiceConnectorTerminationCredentials
  where
  type
    AWSResponse
      PutVoiceConnectorTerminationCredentials =
      PutVoiceConnectorTerminationCredentialsResponse
  request :: PutVoiceConnectorTerminationCredentials
-> Request PutVoiceConnectorTerminationCredentials
request = Service
-> PutVoiceConnectorTerminationCredentials
-> Request PutVoiceConnectorTerminationCredentials
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy PutVoiceConnectorTerminationCredentials
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse
           (AWSResponse PutVoiceConnectorTerminationCredentials)))
response =
    AWSResponse PutVoiceConnectorTerminationCredentials
-> Logger
-> Service
-> Proxy PutVoiceConnectorTerminationCredentials
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse
           (AWSResponse PutVoiceConnectorTerminationCredentials)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull
      AWSResponse PutVoiceConnectorTerminationCredentials
PutVoiceConnectorTerminationCredentialsResponse
PutVoiceConnectorTerminationCredentialsResponse'

instance
  Prelude.Hashable
    PutVoiceConnectorTerminationCredentials

instance
  Prelude.NFData
    PutVoiceConnectorTerminationCredentials

instance
  Core.ToHeaders
    PutVoiceConnectorTerminationCredentials
  where
  toHeaders :: PutVoiceConnectorTerminationCredentials -> [Header]
toHeaders = [Header] -> PutVoiceConnectorTerminationCredentials -> [Header]
forall a b. a -> b -> a
Prelude.const [Header]
forall a. Monoid a => a
Prelude.mempty

instance
  Core.ToJSON
    PutVoiceConnectorTerminationCredentials
  where
  toJSON :: PutVoiceConnectorTerminationCredentials -> Value
toJSON PutVoiceConnectorTerminationCredentials' {Maybe [Credential]
Text
voiceConnectorId :: Text
credentials :: Maybe [Credential]
$sel:voiceConnectorId:PutVoiceConnectorTerminationCredentials' :: PutVoiceConnectorTerminationCredentials -> Text
$sel:credentials:PutVoiceConnectorTerminationCredentials' :: PutVoiceConnectorTerminationCredentials -> Maybe [Credential]
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Text
"Credentials" Text -> [Credential] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Credential] -> Pair) -> Maybe [Credential] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Credential]
credentials]
      )

instance
  Core.ToPath
    PutVoiceConnectorTerminationCredentials
  where
  toPath :: PutVoiceConnectorTerminationCredentials -> ByteString
toPath PutVoiceConnectorTerminationCredentials' {Maybe [Credential]
Text
voiceConnectorId :: Text
credentials :: Maybe [Credential]
$sel:voiceConnectorId:PutVoiceConnectorTerminationCredentials' :: PutVoiceConnectorTerminationCredentials -> Text
$sel:credentials:PutVoiceConnectorTerminationCredentials' :: PutVoiceConnectorTerminationCredentials -> Maybe [Credential]
..} =
    [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
    PutVoiceConnectorTerminationCredentials
  where
  toQuery :: PutVoiceConnectorTerminationCredentials -> QueryString
toQuery =
    QueryString
-> PutVoiceConnectorTerminationCredentials -> QueryString
forall a b. a -> b -> a
Prelude.const ([QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat [QueryString
"operation=put"])

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

-- |
-- Create a value of 'PutVoiceConnectorTerminationCredentialsResponse' 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.
newPutVoiceConnectorTerminationCredentialsResponse ::
  PutVoiceConnectorTerminationCredentialsResponse
newPutVoiceConnectorTerminationCredentialsResponse :: PutVoiceConnectorTerminationCredentialsResponse
newPutVoiceConnectorTerminationCredentialsResponse =
  PutVoiceConnectorTerminationCredentialsResponse
PutVoiceConnectorTerminationCredentialsResponse'

instance
  Prelude.NFData
    PutVoiceConnectorTerminationCredentialsResponse