{-# 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.Connect.StartOutboundVoiceContact
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Places an outbound call to a contact, and then initiates the flow. It
-- performs the actions in the flow that\'s specified (in @ContactFlowId@).
--
-- Agents do not initiate the outbound API, which means that they do not
-- dial the contact. If the flow places an outbound call to a contact, and
-- then puts the contact in queue, the call is then routed to the agent,
-- like any other inbound case.
--
-- There is a 60-second dialing timeout for this operation. If the call is
-- not connected after 60 seconds, it fails.
--
-- UK numbers with a 447 prefix are not allowed by default. Before you can
-- dial these UK mobile numbers, you must submit a service quota increase
-- request. For more information, see
-- <https://docs.aws.amazon.com/connect/latest/adminguide/amazon-connect-service-limits.html Amazon Connect Service Quotas>
-- in the /Amazon Connect Administrator Guide/.
--
-- Campaign calls are not allowed by default. Before you can make a call
-- with @TrafficType@ = @CAMPAIGN@, you must submit a service quota
-- increase request to the quota
-- <https://docs.aws.amazon.com/connect/latest/adminguide/amazon-connect-service-limits.html#outbound-communications-quotas Amazon Connect campaigns>.
module Amazonka.Connect.StartOutboundVoiceContact
  ( -- * Creating a Request
    StartOutboundVoiceContact (..),
    newStartOutboundVoiceContact,

    -- * Request Lenses
    startOutboundVoiceContact_answerMachineDetectionConfig,
    startOutboundVoiceContact_attributes,
    startOutboundVoiceContact_campaignId,
    startOutboundVoiceContact_clientToken,
    startOutboundVoiceContact_queueId,
    startOutboundVoiceContact_sourcePhoneNumber,
    startOutboundVoiceContact_trafficType,
    startOutboundVoiceContact_destinationPhoneNumber,
    startOutboundVoiceContact_contactFlowId,
    startOutboundVoiceContact_instanceId,

    -- * Destructuring the Response
    StartOutboundVoiceContactResponse (..),
    newStartOutboundVoiceContactResponse,

    -- * Response Lenses
    startOutboundVoiceContactResponse_contactId,
    startOutboundVoiceContactResponse_httpStatus,
  )
where

import Amazonka.Connect.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:/ 'newStartOutboundVoiceContact' smart constructor.
data StartOutboundVoiceContact = StartOutboundVoiceContact'
  { -- | Configuration of the answering machine detection for this outbound call.
    StartOutboundVoiceContact -> Maybe AnswerMachineDetectionConfig
answerMachineDetectionConfig :: Prelude.Maybe AnswerMachineDetectionConfig,
    -- | A custom key-value pair using an attribute map. The attributes are
    -- standard Amazon Connect attributes, and can be accessed in flows just
    -- like any other contact attributes.
    --
    -- There can be up to 32,768 UTF-8 bytes across all key-value pairs per
    -- contact. Attribute keys can include only alphanumeric, dash, and
    -- underscore characters.
    StartOutboundVoiceContact -> Maybe (HashMap Text Text)
attributes :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The campaign identifier of the outbound communication.
    StartOutboundVoiceContact -> Maybe Text
campaignId :: Prelude.Maybe Prelude.Text,
    -- | A unique, case-sensitive identifier that you provide to ensure the
    -- idempotency of the request. If not provided, the Amazon Web Services SDK
    -- populates this field. For more information about idempotency, see
    -- <https://aws.amazon.com/builders-library/making-retries-safe-with-idempotent-APIs/ Making retries safe with idempotent APIs>.
    -- The token is valid for 7 days after creation. If a contact is already
    -- started, the contact ID is returned.
    StartOutboundVoiceContact -> Maybe Text
clientToken :: Prelude.Maybe Prelude.Text,
    -- | The queue for the call. If you specify a queue, the phone displayed for
    -- caller ID is the phone number specified in the queue. If you do not
    -- specify a queue, the queue defined in the flow is used. If you do not
    -- specify a queue, you must specify a source phone number.
    StartOutboundVoiceContact -> Maybe Text
queueId :: Prelude.Maybe Prelude.Text,
    -- | The phone number associated with the Amazon Connect instance, in E.164
    -- format. If you do not specify a source phone number, you must specify a
    -- queue.
    StartOutboundVoiceContact -> Maybe Text
sourcePhoneNumber :: Prelude.Maybe Prelude.Text,
    -- | Denotes the class of traffic. Calls with different traffic types are
    -- handled differently by Amazon Connect. The default value is @GENERAL@.
    -- Use @CAMPAIGN@ if @EnableAnswerMachineDetection@ is set to @true@. For
    -- all other cases, use @GENERAL@.
    StartOutboundVoiceContact -> Maybe TrafficType
trafficType :: Prelude.Maybe TrafficType,
    -- | The phone number of the customer, in E.164 format.
    StartOutboundVoiceContact -> Text
destinationPhoneNumber :: Prelude.Text,
    -- | The identifier of the flow for the outbound call. To see the
    -- ContactFlowId in the Amazon Connect console user interface, on the
    -- navigation menu go to __Routing__, __Contact Flows__. Choose the flow.
    -- On the flow page, under the name of the flow, choose __Show additional
    -- flow information__. The ContactFlowId is the last part of the ARN, shown
    -- here in bold:
    --
    -- arn:aws:connect:us-west-2:xxxxxxxxxxxx:instance\/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\/contact-flow\/__846ec553-a005-41c0-8341-xxxxxxxxxxxx__
    StartOutboundVoiceContact -> Text
contactFlowId :: Prelude.Text,
    -- | The identifier of the Amazon Connect instance. You can find the
    -- instanceId in the ARN of the instance.
    StartOutboundVoiceContact -> Text
instanceId :: Prelude.Text
  }
  deriving (StartOutboundVoiceContact -> StartOutboundVoiceContact -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartOutboundVoiceContact -> StartOutboundVoiceContact -> Bool
$c/= :: StartOutboundVoiceContact -> StartOutboundVoiceContact -> Bool
== :: StartOutboundVoiceContact -> StartOutboundVoiceContact -> Bool
$c== :: StartOutboundVoiceContact -> StartOutboundVoiceContact -> Bool
Prelude.Eq, ReadPrec [StartOutboundVoiceContact]
ReadPrec StartOutboundVoiceContact
Int -> ReadS StartOutboundVoiceContact
ReadS [StartOutboundVoiceContact]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartOutboundVoiceContact]
$creadListPrec :: ReadPrec [StartOutboundVoiceContact]
readPrec :: ReadPrec StartOutboundVoiceContact
$creadPrec :: ReadPrec StartOutboundVoiceContact
readList :: ReadS [StartOutboundVoiceContact]
$creadList :: ReadS [StartOutboundVoiceContact]
readsPrec :: Int -> ReadS StartOutboundVoiceContact
$creadsPrec :: Int -> ReadS StartOutboundVoiceContact
Prelude.Read, Int -> StartOutboundVoiceContact -> ShowS
[StartOutboundVoiceContact] -> ShowS
StartOutboundVoiceContact -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartOutboundVoiceContact] -> ShowS
$cshowList :: [StartOutboundVoiceContact] -> ShowS
show :: StartOutboundVoiceContact -> String
$cshow :: StartOutboundVoiceContact -> String
showsPrec :: Int -> StartOutboundVoiceContact -> ShowS
$cshowsPrec :: Int -> StartOutboundVoiceContact -> ShowS
Prelude.Show, forall x.
Rep StartOutboundVoiceContact x -> StartOutboundVoiceContact
forall x.
StartOutboundVoiceContact -> Rep StartOutboundVoiceContact x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep StartOutboundVoiceContact x -> StartOutboundVoiceContact
$cfrom :: forall x.
StartOutboundVoiceContact -> Rep StartOutboundVoiceContact x
Prelude.Generic)

-- |
-- Create a value of 'StartOutboundVoiceContact' 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:
--
-- 'answerMachineDetectionConfig', 'startOutboundVoiceContact_answerMachineDetectionConfig' - Configuration of the answering machine detection for this outbound call.
--
-- 'attributes', 'startOutboundVoiceContact_attributes' - A custom key-value pair using an attribute map. The attributes are
-- standard Amazon Connect attributes, and can be accessed in flows just
-- like any other contact attributes.
--
-- There can be up to 32,768 UTF-8 bytes across all key-value pairs per
-- contact. Attribute keys can include only alphanumeric, dash, and
-- underscore characters.
--
-- 'campaignId', 'startOutboundVoiceContact_campaignId' - The campaign identifier of the outbound communication.
--
-- 'clientToken', 'startOutboundVoiceContact_clientToken' - A unique, case-sensitive identifier that you provide to ensure the
-- idempotency of the request. If not provided, the Amazon Web Services SDK
-- populates this field. For more information about idempotency, see
-- <https://aws.amazon.com/builders-library/making-retries-safe-with-idempotent-APIs/ Making retries safe with idempotent APIs>.
-- The token is valid for 7 days after creation. If a contact is already
-- started, the contact ID is returned.
--
-- 'queueId', 'startOutboundVoiceContact_queueId' - The queue for the call. If you specify a queue, the phone displayed for
-- caller ID is the phone number specified in the queue. If you do not
-- specify a queue, the queue defined in the flow is used. If you do not
-- specify a queue, you must specify a source phone number.
--
-- 'sourcePhoneNumber', 'startOutboundVoiceContact_sourcePhoneNumber' - The phone number associated with the Amazon Connect instance, in E.164
-- format. If you do not specify a source phone number, you must specify a
-- queue.
--
-- 'trafficType', 'startOutboundVoiceContact_trafficType' - Denotes the class of traffic. Calls with different traffic types are
-- handled differently by Amazon Connect. The default value is @GENERAL@.
-- Use @CAMPAIGN@ if @EnableAnswerMachineDetection@ is set to @true@. For
-- all other cases, use @GENERAL@.
--
-- 'destinationPhoneNumber', 'startOutboundVoiceContact_destinationPhoneNumber' - The phone number of the customer, in E.164 format.
--
-- 'contactFlowId', 'startOutboundVoiceContact_contactFlowId' - The identifier of the flow for the outbound call. To see the
-- ContactFlowId in the Amazon Connect console user interface, on the
-- navigation menu go to __Routing__, __Contact Flows__. Choose the flow.
-- On the flow page, under the name of the flow, choose __Show additional
-- flow information__. The ContactFlowId is the last part of the ARN, shown
-- here in bold:
--
-- arn:aws:connect:us-west-2:xxxxxxxxxxxx:instance\/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\/contact-flow\/__846ec553-a005-41c0-8341-xxxxxxxxxxxx__
--
-- 'instanceId', 'startOutboundVoiceContact_instanceId' - The identifier of the Amazon Connect instance. You can find the
-- instanceId in the ARN of the instance.
newStartOutboundVoiceContact ::
  -- | 'destinationPhoneNumber'
  Prelude.Text ->
  -- | 'contactFlowId'
  Prelude.Text ->
  -- | 'instanceId'
  Prelude.Text ->
  StartOutboundVoiceContact
newStartOutboundVoiceContact :: Text -> Text -> Text -> StartOutboundVoiceContact
newStartOutboundVoiceContact
  Text
pDestinationPhoneNumber_
  Text
pContactFlowId_
  Text
pInstanceId_ =
    StartOutboundVoiceContact'
      { $sel:answerMachineDetectionConfig:StartOutboundVoiceContact' :: Maybe AnswerMachineDetectionConfig
answerMachineDetectionConfig =
          forall a. Maybe a
Prelude.Nothing,
        $sel:attributes:StartOutboundVoiceContact' :: Maybe (HashMap Text Text)
attributes = forall a. Maybe a
Prelude.Nothing,
        $sel:campaignId:StartOutboundVoiceContact' :: Maybe Text
campaignId = forall a. Maybe a
Prelude.Nothing,
        $sel:clientToken:StartOutboundVoiceContact' :: Maybe Text
clientToken = forall a. Maybe a
Prelude.Nothing,
        $sel:queueId:StartOutboundVoiceContact' :: Maybe Text
queueId = forall a. Maybe a
Prelude.Nothing,
        $sel:sourcePhoneNumber:StartOutboundVoiceContact' :: Maybe Text
sourcePhoneNumber = forall a. Maybe a
Prelude.Nothing,
        $sel:trafficType:StartOutboundVoiceContact' :: Maybe TrafficType
trafficType = forall a. Maybe a
Prelude.Nothing,
        $sel:destinationPhoneNumber:StartOutboundVoiceContact' :: Text
destinationPhoneNumber =
          Text
pDestinationPhoneNumber_,
        $sel:contactFlowId:StartOutboundVoiceContact' :: Text
contactFlowId = Text
pContactFlowId_,
        $sel:instanceId:StartOutboundVoiceContact' :: Text
instanceId = Text
pInstanceId_
      }

-- | Configuration of the answering machine detection for this outbound call.
startOutboundVoiceContact_answerMachineDetectionConfig :: Lens.Lens' StartOutboundVoiceContact (Prelude.Maybe AnswerMachineDetectionConfig)
startOutboundVoiceContact_answerMachineDetectionConfig :: Lens'
  StartOutboundVoiceContact (Maybe AnswerMachineDetectionConfig)
startOutboundVoiceContact_answerMachineDetectionConfig = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartOutboundVoiceContact' {Maybe AnswerMachineDetectionConfig
answerMachineDetectionConfig :: Maybe AnswerMachineDetectionConfig
$sel:answerMachineDetectionConfig:StartOutboundVoiceContact' :: StartOutboundVoiceContact -> Maybe AnswerMachineDetectionConfig
answerMachineDetectionConfig} -> Maybe AnswerMachineDetectionConfig
answerMachineDetectionConfig) (\s :: StartOutboundVoiceContact
s@StartOutboundVoiceContact' {} Maybe AnswerMachineDetectionConfig
a -> StartOutboundVoiceContact
s {$sel:answerMachineDetectionConfig:StartOutboundVoiceContact' :: Maybe AnswerMachineDetectionConfig
answerMachineDetectionConfig = Maybe AnswerMachineDetectionConfig
a} :: StartOutboundVoiceContact)

-- | A custom key-value pair using an attribute map. The attributes are
-- standard Amazon Connect attributes, and can be accessed in flows just
-- like any other contact attributes.
--
-- There can be up to 32,768 UTF-8 bytes across all key-value pairs per
-- contact. Attribute keys can include only alphanumeric, dash, and
-- underscore characters.
startOutboundVoiceContact_attributes :: Lens.Lens' StartOutboundVoiceContact (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
startOutboundVoiceContact_attributes :: Lens' StartOutboundVoiceContact (Maybe (HashMap Text Text))
startOutboundVoiceContact_attributes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartOutboundVoiceContact' {Maybe (HashMap Text Text)
attributes :: Maybe (HashMap Text Text)
$sel:attributes:StartOutboundVoiceContact' :: StartOutboundVoiceContact -> Maybe (HashMap Text Text)
attributes} -> Maybe (HashMap Text Text)
attributes) (\s :: StartOutboundVoiceContact
s@StartOutboundVoiceContact' {} Maybe (HashMap Text Text)
a -> StartOutboundVoiceContact
s {$sel:attributes:StartOutboundVoiceContact' :: Maybe (HashMap Text Text)
attributes = Maybe (HashMap Text Text)
a} :: StartOutboundVoiceContact) 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 campaign identifier of the outbound communication.
startOutboundVoiceContact_campaignId :: Lens.Lens' StartOutboundVoiceContact (Prelude.Maybe Prelude.Text)
startOutboundVoiceContact_campaignId :: Lens' StartOutboundVoiceContact (Maybe Text)
startOutboundVoiceContact_campaignId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartOutboundVoiceContact' {Maybe Text
campaignId :: Maybe Text
$sel:campaignId:StartOutboundVoiceContact' :: StartOutboundVoiceContact -> Maybe Text
campaignId} -> Maybe Text
campaignId) (\s :: StartOutboundVoiceContact
s@StartOutboundVoiceContact' {} Maybe Text
a -> StartOutboundVoiceContact
s {$sel:campaignId:StartOutboundVoiceContact' :: Maybe Text
campaignId = Maybe Text
a} :: StartOutboundVoiceContact)

-- | A unique, case-sensitive identifier that you provide to ensure the
-- idempotency of the request. If not provided, the Amazon Web Services SDK
-- populates this field. For more information about idempotency, see
-- <https://aws.amazon.com/builders-library/making-retries-safe-with-idempotent-APIs/ Making retries safe with idempotent APIs>.
-- The token is valid for 7 days after creation. If a contact is already
-- started, the contact ID is returned.
startOutboundVoiceContact_clientToken :: Lens.Lens' StartOutboundVoiceContact (Prelude.Maybe Prelude.Text)
startOutboundVoiceContact_clientToken :: Lens' StartOutboundVoiceContact (Maybe Text)
startOutboundVoiceContact_clientToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartOutboundVoiceContact' {Maybe Text
clientToken :: Maybe Text
$sel:clientToken:StartOutboundVoiceContact' :: StartOutboundVoiceContact -> Maybe Text
clientToken} -> Maybe Text
clientToken) (\s :: StartOutboundVoiceContact
s@StartOutboundVoiceContact' {} Maybe Text
a -> StartOutboundVoiceContact
s {$sel:clientToken:StartOutboundVoiceContact' :: Maybe Text
clientToken = Maybe Text
a} :: StartOutboundVoiceContact)

-- | The queue for the call. If you specify a queue, the phone displayed for
-- caller ID is the phone number specified in the queue. If you do not
-- specify a queue, the queue defined in the flow is used. If you do not
-- specify a queue, you must specify a source phone number.
startOutboundVoiceContact_queueId :: Lens.Lens' StartOutboundVoiceContact (Prelude.Maybe Prelude.Text)
startOutboundVoiceContact_queueId :: Lens' StartOutboundVoiceContact (Maybe Text)
startOutboundVoiceContact_queueId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartOutboundVoiceContact' {Maybe Text
queueId :: Maybe Text
$sel:queueId:StartOutboundVoiceContact' :: StartOutboundVoiceContact -> Maybe Text
queueId} -> Maybe Text
queueId) (\s :: StartOutboundVoiceContact
s@StartOutboundVoiceContact' {} Maybe Text
a -> StartOutboundVoiceContact
s {$sel:queueId:StartOutboundVoiceContact' :: Maybe Text
queueId = Maybe Text
a} :: StartOutboundVoiceContact)

-- | The phone number associated with the Amazon Connect instance, in E.164
-- format. If you do not specify a source phone number, you must specify a
-- queue.
startOutboundVoiceContact_sourcePhoneNumber :: Lens.Lens' StartOutboundVoiceContact (Prelude.Maybe Prelude.Text)
startOutboundVoiceContact_sourcePhoneNumber :: Lens' StartOutboundVoiceContact (Maybe Text)
startOutboundVoiceContact_sourcePhoneNumber = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartOutboundVoiceContact' {Maybe Text
sourcePhoneNumber :: Maybe Text
$sel:sourcePhoneNumber:StartOutboundVoiceContact' :: StartOutboundVoiceContact -> Maybe Text
sourcePhoneNumber} -> Maybe Text
sourcePhoneNumber) (\s :: StartOutboundVoiceContact
s@StartOutboundVoiceContact' {} Maybe Text
a -> StartOutboundVoiceContact
s {$sel:sourcePhoneNumber:StartOutboundVoiceContact' :: Maybe Text
sourcePhoneNumber = Maybe Text
a} :: StartOutboundVoiceContact)

-- | Denotes the class of traffic. Calls with different traffic types are
-- handled differently by Amazon Connect. The default value is @GENERAL@.
-- Use @CAMPAIGN@ if @EnableAnswerMachineDetection@ is set to @true@. For
-- all other cases, use @GENERAL@.
startOutboundVoiceContact_trafficType :: Lens.Lens' StartOutboundVoiceContact (Prelude.Maybe TrafficType)
startOutboundVoiceContact_trafficType :: Lens' StartOutboundVoiceContact (Maybe TrafficType)
startOutboundVoiceContact_trafficType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartOutboundVoiceContact' {Maybe TrafficType
trafficType :: Maybe TrafficType
$sel:trafficType:StartOutboundVoiceContact' :: StartOutboundVoiceContact -> Maybe TrafficType
trafficType} -> Maybe TrafficType
trafficType) (\s :: StartOutboundVoiceContact
s@StartOutboundVoiceContact' {} Maybe TrafficType
a -> StartOutboundVoiceContact
s {$sel:trafficType:StartOutboundVoiceContact' :: Maybe TrafficType
trafficType = Maybe TrafficType
a} :: StartOutboundVoiceContact)

-- | The phone number of the customer, in E.164 format.
startOutboundVoiceContact_destinationPhoneNumber :: Lens.Lens' StartOutboundVoiceContact Prelude.Text
startOutboundVoiceContact_destinationPhoneNumber :: Lens' StartOutboundVoiceContact Text
startOutboundVoiceContact_destinationPhoneNumber = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartOutboundVoiceContact' {Text
destinationPhoneNumber :: Text
$sel:destinationPhoneNumber:StartOutboundVoiceContact' :: StartOutboundVoiceContact -> Text
destinationPhoneNumber} -> Text
destinationPhoneNumber) (\s :: StartOutboundVoiceContact
s@StartOutboundVoiceContact' {} Text
a -> StartOutboundVoiceContact
s {$sel:destinationPhoneNumber:StartOutboundVoiceContact' :: Text
destinationPhoneNumber = Text
a} :: StartOutboundVoiceContact)

-- | The identifier of the flow for the outbound call. To see the
-- ContactFlowId in the Amazon Connect console user interface, on the
-- navigation menu go to __Routing__, __Contact Flows__. Choose the flow.
-- On the flow page, under the name of the flow, choose __Show additional
-- flow information__. The ContactFlowId is the last part of the ARN, shown
-- here in bold:
--
-- arn:aws:connect:us-west-2:xxxxxxxxxxxx:instance\/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\/contact-flow\/__846ec553-a005-41c0-8341-xxxxxxxxxxxx__
startOutboundVoiceContact_contactFlowId :: Lens.Lens' StartOutboundVoiceContact Prelude.Text
startOutboundVoiceContact_contactFlowId :: Lens' StartOutboundVoiceContact Text
startOutboundVoiceContact_contactFlowId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartOutboundVoiceContact' {Text
contactFlowId :: Text
$sel:contactFlowId:StartOutboundVoiceContact' :: StartOutboundVoiceContact -> Text
contactFlowId} -> Text
contactFlowId) (\s :: StartOutboundVoiceContact
s@StartOutboundVoiceContact' {} Text
a -> StartOutboundVoiceContact
s {$sel:contactFlowId:StartOutboundVoiceContact' :: Text
contactFlowId = Text
a} :: StartOutboundVoiceContact)

-- | The identifier of the Amazon Connect instance. You can find the
-- instanceId in the ARN of the instance.
startOutboundVoiceContact_instanceId :: Lens.Lens' StartOutboundVoiceContact Prelude.Text
startOutboundVoiceContact_instanceId :: Lens' StartOutboundVoiceContact Text
startOutboundVoiceContact_instanceId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartOutboundVoiceContact' {Text
instanceId :: Text
$sel:instanceId:StartOutboundVoiceContact' :: StartOutboundVoiceContact -> Text
instanceId} -> Text
instanceId) (\s :: StartOutboundVoiceContact
s@StartOutboundVoiceContact' {} Text
a -> StartOutboundVoiceContact
s {$sel:instanceId:StartOutboundVoiceContact' :: Text
instanceId = Text
a} :: StartOutboundVoiceContact)

instance Core.AWSRequest StartOutboundVoiceContact where
  type
    AWSResponse StartOutboundVoiceContact =
      StartOutboundVoiceContactResponse
  request :: (Service -> Service)
-> StartOutboundVoiceContact -> Request StartOutboundVoiceContact
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy StartOutboundVoiceContact
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse StartOutboundVoiceContact)))
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 -> Int -> StartOutboundVoiceContactResponse
StartOutboundVoiceContactResponse'
            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
"ContactId")
            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 StartOutboundVoiceContact where
  hashWithSalt :: Int -> StartOutboundVoiceContact -> Int
hashWithSalt Int
_salt StartOutboundVoiceContact' {Maybe Text
Maybe (HashMap Text Text)
Maybe AnswerMachineDetectionConfig
Maybe TrafficType
Text
instanceId :: Text
contactFlowId :: Text
destinationPhoneNumber :: Text
trafficType :: Maybe TrafficType
sourcePhoneNumber :: Maybe Text
queueId :: Maybe Text
clientToken :: Maybe Text
campaignId :: Maybe Text
attributes :: Maybe (HashMap Text Text)
answerMachineDetectionConfig :: Maybe AnswerMachineDetectionConfig
$sel:instanceId:StartOutboundVoiceContact' :: StartOutboundVoiceContact -> Text
$sel:contactFlowId:StartOutboundVoiceContact' :: StartOutboundVoiceContact -> Text
$sel:destinationPhoneNumber:StartOutboundVoiceContact' :: StartOutboundVoiceContact -> Text
$sel:trafficType:StartOutboundVoiceContact' :: StartOutboundVoiceContact -> Maybe TrafficType
$sel:sourcePhoneNumber:StartOutboundVoiceContact' :: StartOutboundVoiceContact -> Maybe Text
$sel:queueId:StartOutboundVoiceContact' :: StartOutboundVoiceContact -> Maybe Text
$sel:clientToken:StartOutboundVoiceContact' :: StartOutboundVoiceContact -> Maybe Text
$sel:campaignId:StartOutboundVoiceContact' :: StartOutboundVoiceContact -> Maybe Text
$sel:attributes:StartOutboundVoiceContact' :: StartOutboundVoiceContact -> Maybe (HashMap Text Text)
$sel:answerMachineDetectionConfig:StartOutboundVoiceContact' :: StartOutboundVoiceContact -> Maybe AnswerMachineDetectionConfig
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe AnswerMachineDetectionConfig
answerMachineDetectionConfig
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
attributes
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
campaignId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
clientToken
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
queueId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
sourcePhoneNumber
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe TrafficType
trafficType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
destinationPhoneNumber
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
contactFlowId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
instanceId

instance Prelude.NFData StartOutboundVoiceContact where
  rnf :: StartOutboundVoiceContact -> ()
rnf StartOutboundVoiceContact' {Maybe Text
Maybe (HashMap Text Text)
Maybe AnswerMachineDetectionConfig
Maybe TrafficType
Text
instanceId :: Text
contactFlowId :: Text
destinationPhoneNumber :: Text
trafficType :: Maybe TrafficType
sourcePhoneNumber :: Maybe Text
queueId :: Maybe Text
clientToken :: Maybe Text
campaignId :: Maybe Text
attributes :: Maybe (HashMap Text Text)
answerMachineDetectionConfig :: Maybe AnswerMachineDetectionConfig
$sel:instanceId:StartOutboundVoiceContact' :: StartOutboundVoiceContact -> Text
$sel:contactFlowId:StartOutboundVoiceContact' :: StartOutboundVoiceContact -> Text
$sel:destinationPhoneNumber:StartOutboundVoiceContact' :: StartOutboundVoiceContact -> Text
$sel:trafficType:StartOutboundVoiceContact' :: StartOutboundVoiceContact -> Maybe TrafficType
$sel:sourcePhoneNumber:StartOutboundVoiceContact' :: StartOutboundVoiceContact -> Maybe Text
$sel:queueId:StartOutboundVoiceContact' :: StartOutboundVoiceContact -> Maybe Text
$sel:clientToken:StartOutboundVoiceContact' :: StartOutboundVoiceContact -> Maybe Text
$sel:campaignId:StartOutboundVoiceContact' :: StartOutboundVoiceContact -> Maybe Text
$sel:attributes:StartOutboundVoiceContact' :: StartOutboundVoiceContact -> Maybe (HashMap Text Text)
$sel:answerMachineDetectionConfig:StartOutboundVoiceContact' :: StartOutboundVoiceContact -> Maybe AnswerMachineDetectionConfig
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe AnswerMachineDetectionConfig
answerMachineDetectionConfig
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
attributes
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
campaignId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
clientToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
queueId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
sourcePhoneNumber
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe TrafficType
trafficType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
destinationPhoneNumber
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
contactFlowId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
instanceId

instance Data.ToHeaders StartOutboundVoiceContact where
  toHeaders :: StartOutboundVoiceContact -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON StartOutboundVoiceContact where
  toJSON :: StartOutboundVoiceContact -> Value
toJSON StartOutboundVoiceContact' {Maybe Text
Maybe (HashMap Text Text)
Maybe AnswerMachineDetectionConfig
Maybe TrafficType
Text
instanceId :: Text
contactFlowId :: Text
destinationPhoneNumber :: Text
trafficType :: Maybe TrafficType
sourcePhoneNumber :: Maybe Text
queueId :: Maybe Text
clientToken :: Maybe Text
campaignId :: Maybe Text
attributes :: Maybe (HashMap Text Text)
answerMachineDetectionConfig :: Maybe AnswerMachineDetectionConfig
$sel:instanceId:StartOutboundVoiceContact' :: StartOutboundVoiceContact -> Text
$sel:contactFlowId:StartOutboundVoiceContact' :: StartOutboundVoiceContact -> Text
$sel:destinationPhoneNumber:StartOutboundVoiceContact' :: StartOutboundVoiceContact -> Text
$sel:trafficType:StartOutboundVoiceContact' :: StartOutboundVoiceContact -> Maybe TrafficType
$sel:sourcePhoneNumber:StartOutboundVoiceContact' :: StartOutboundVoiceContact -> Maybe Text
$sel:queueId:StartOutboundVoiceContact' :: StartOutboundVoiceContact -> Maybe Text
$sel:clientToken:StartOutboundVoiceContact' :: StartOutboundVoiceContact -> Maybe Text
$sel:campaignId:StartOutboundVoiceContact' :: StartOutboundVoiceContact -> Maybe Text
$sel:attributes:StartOutboundVoiceContact' :: StartOutboundVoiceContact -> Maybe (HashMap Text Text)
$sel:answerMachineDetectionConfig:StartOutboundVoiceContact' :: StartOutboundVoiceContact -> Maybe AnswerMachineDetectionConfig
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"AnswerMachineDetectionConfig" 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 AnswerMachineDetectionConfig
answerMachineDetectionConfig,
            (Key
"Attributes" 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 (HashMap Text Text)
attributes,
            (Key
"CampaignId" 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 Text
campaignId,
            (Key
"ClientToken" 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 Text
clientToken,
            (Key
"QueueId" 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 Text
queueId,
            (Key
"SourcePhoneNumber" 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 Text
sourcePhoneNumber,
            (Key
"TrafficType" 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 TrafficType
trafficType,
            forall a. a -> Maybe a
Prelude.Just
              ( Key
"DestinationPhoneNumber"
                  forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
destinationPhoneNumber
              ),
            forall a. a -> Maybe a
Prelude.Just (Key
"ContactFlowId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
contactFlowId),
            forall a. a -> Maybe a
Prelude.Just (Key
"InstanceId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
instanceId)
          ]
      )

instance Data.ToPath StartOutboundVoiceContact where
  toPath :: StartOutboundVoiceContact -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/contact/outbound-voice"

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

-- | /See:/ 'newStartOutboundVoiceContactResponse' smart constructor.
data StartOutboundVoiceContactResponse = StartOutboundVoiceContactResponse'
  { -- | The identifier of this contact within the Amazon Connect instance.
    StartOutboundVoiceContactResponse -> Maybe Text
contactId :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    StartOutboundVoiceContactResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (StartOutboundVoiceContactResponse
-> StartOutboundVoiceContactResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartOutboundVoiceContactResponse
-> StartOutboundVoiceContactResponse -> Bool
$c/= :: StartOutboundVoiceContactResponse
-> StartOutboundVoiceContactResponse -> Bool
== :: StartOutboundVoiceContactResponse
-> StartOutboundVoiceContactResponse -> Bool
$c== :: StartOutboundVoiceContactResponse
-> StartOutboundVoiceContactResponse -> Bool
Prelude.Eq, ReadPrec [StartOutboundVoiceContactResponse]
ReadPrec StartOutboundVoiceContactResponse
Int -> ReadS StartOutboundVoiceContactResponse
ReadS [StartOutboundVoiceContactResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartOutboundVoiceContactResponse]
$creadListPrec :: ReadPrec [StartOutboundVoiceContactResponse]
readPrec :: ReadPrec StartOutboundVoiceContactResponse
$creadPrec :: ReadPrec StartOutboundVoiceContactResponse
readList :: ReadS [StartOutboundVoiceContactResponse]
$creadList :: ReadS [StartOutboundVoiceContactResponse]
readsPrec :: Int -> ReadS StartOutboundVoiceContactResponse
$creadsPrec :: Int -> ReadS StartOutboundVoiceContactResponse
Prelude.Read, Int -> StartOutboundVoiceContactResponse -> ShowS
[StartOutboundVoiceContactResponse] -> ShowS
StartOutboundVoiceContactResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartOutboundVoiceContactResponse] -> ShowS
$cshowList :: [StartOutboundVoiceContactResponse] -> ShowS
show :: StartOutboundVoiceContactResponse -> String
$cshow :: StartOutboundVoiceContactResponse -> String
showsPrec :: Int -> StartOutboundVoiceContactResponse -> ShowS
$cshowsPrec :: Int -> StartOutboundVoiceContactResponse -> ShowS
Prelude.Show, forall x.
Rep StartOutboundVoiceContactResponse x
-> StartOutboundVoiceContactResponse
forall x.
StartOutboundVoiceContactResponse
-> Rep StartOutboundVoiceContactResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep StartOutboundVoiceContactResponse x
-> StartOutboundVoiceContactResponse
$cfrom :: forall x.
StartOutboundVoiceContactResponse
-> Rep StartOutboundVoiceContactResponse x
Prelude.Generic)

-- |
-- Create a value of 'StartOutboundVoiceContactResponse' 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:
--
-- 'contactId', 'startOutboundVoiceContactResponse_contactId' - The identifier of this contact within the Amazon Connect instance.
--
-- 'httpStatus', 'startOutboundVoiceContactResponse_httpStatus' - The response's http status code.
newStartOutboundVoiceContactResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  StartOutboundVoiceContactResponse
newStartOutboundVoiceContactResponse :: Int -> StartOutboundVoiceContactResponse
newStartOutboundVoiceContactResponse Int
pHttpStatus_ =
  StartOutboundVoiceContactResponse'
    { $sel:contactId:StartOutboundVoiceContactResponse' :: Maybe Text
contactId =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:StartOutboundVoiceContactResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The identifier of this contact within the Amazon Connect instance.
startOutboundVoiceContactResponse_contactId :: Lens.Lens' StartOutboundVoiceContactResponse (Prelude.Maybe Prelude.Text)
startOutboundVoiceContactResponse_contactId :: Lens' StartOutboundVoiceContactResponse (Maybe Text)
startOutboundVoiceContactResponse_contactId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartOutboundVoiceContactResponse' {Maybe Text
contactId :: Maybe Text
$sel:contactId:StartOutboundVoiceContactResponse' :: StartOutboundVoiceContactResponse -> Maybe Text
contactId} -> Maybe Text
contactId) (\s :: StartOutboundVoiceContactResponse
s@StartOutboundVoiceContactResponse' {} Maybe Text
a -> StartOutboundVoiceContactResponse
s {$sel:contactId:StartOutboundVoiceContactResponse' :: Maybe Text
contactId = Maybe Text
a} :: StartOutboundVoiceContactResponse)

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

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