{-# 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.AssociateQueueQuickConnects
-- 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)
--
-- This API is in preview release for Amazon Connect and is subject to
-- change.
--
-- Associates a set of quick connects with a queue.
module Amazonka.Connect.AssociateQueueQuickConnects
  ( -- * Creating a Request
    AssociateQueueQuickConnects (..),
    newAssociateQueueQuickConnects,

    -- * Request Lenses
    associateQueueQuickConnects_instanceId,
    associateQueueQuickConnects_queueId,
    associateQueueQuickConnects_quickConnectIds,

    -- * Destructuring the Response
    AssociateQueueQuickConnectsResponse (..),
    newAssociateQueueQuickConnectsResponse,
  )
where

import Amazonka.Connect.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:/ 'newAssociateQueueQuickConnects' smart constructor.
data AssociateQueueQuickConnects = AssociateQueueQuickConnects'
  { -- | The identifier of the Amazon Connect instance. You can find the
    -- instanceId in the ARN of the instance.
    AssociateQueueQuickConnects -> Text
instanceId :: Prelude.Text,
    -- | The identifier for the queue.
    AssociateQueueQuickConnects -> Text
queueId :: Prelude.Text,
    -- | The quick connects to associate with this queue.
    AssociateQueueQuickConnects -> NonEmpty Text
quickConnectIds :: Prelude.NonEmpty Prelude.Text
  }
  deriving (AssociateQueueQuickConnects -> AssociateQueueQuickConnects -> Bool
(AssociateQueueQuickConnects
 -> AssociateQueueQuickConnects -> Bool)
-> (AssociateQueueQuickConnects
    -> AssociateQueueQuickConnects -> Bool)
-> Eq AssociateQueueQuickConnects
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssociateQueueQuickConnects -> AssociateQueueQuickConnects -> Bool
$c/= :: AssociateQueueQuickConnects -> AssociateQueueQuickConnects -> Bool
== :: AssociateQueueQuickConnects -> AssociateQueueQuickConnects -> Bool
$c== :: AssociateQueueQuickConnects -> AssociateQueueQuickConnects -> Bool
Prelude.Eq, ReadPrec [AssociateQueueQuickConnects]
ReadPrec AssociateQueueQuickConnects
Int -> ReadS AssociateQueueQuickConnects
ReadS [AssociateQueueQuickConnects]
(Int -> ReadS AssociateQueueQuickConnects)
-> ReadS [AssociateQueueQuickConnects]
-> ReadPrec AssociateQueueQuickConnects
-> ReadPrec [AssociateQueueQuickConnects]
-> Read AssociateQueueQuickConnects
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AssociateQueueQuickConnects]
$creadListPrec :: ReadPrec [AssociateQueueQuickConnects]
readPrec :: ReadPrec AssociateQueueQuickConnects
$creadPrec :: ReadPrec AssociateQueueQuickConnects
readList :: ReadS [AssociateQueueQuickConnects]
$creadList :: ReadS [AssociateQueueQuickConnects]
readsPrec :: Int -> ReadS AssociateQueueQuickConnects
$creadsPrec :: Int -> ReadS AssociateQueueQuickConnects
Prelude.Read, Int -> AssociateQueueQuickConnects -> ShowS
[AssociateQueueQuickConnects] -> ShowS
AssociateQueueQuickConnects -> String
(Int -> AssociateQueueQuickConnects -> ShowS)
-> (AssociateQueueQuickConnects -> String)
-> ([AssociateQueueQuickConnects] -> ShowS)
-> Show AssociateQueueQuickConnects
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AssociateQueueQuickConnects] -> ShowS
$cshowList :: [AssociateQueueQuickConnects] -> ShowS
show :: AssociateQueueQuickConnects -> String
$cshow :: AssociateQueueQuickConnects -> String
showsPrec :: Int -> AssociateQueueQuickConnects -> ShowS
$cshowsPrec :: Int -> AssociateQueueQuickConnects -> ShowS
Prelude.Show, (forall x.
 AssociateQueueQuickConnects -> Rep AssociateQueueQuickConnects x)
-> (forall x.
    Rep AssociateQueueQuickConnects x -> AssociateQueueQuickConnects)
-> Generic AssociateQueueQuickConnects
forall x.
Rep AssociateQueueQuickConnects x -> AssociateQueueQuickConnects
forall x.
AssociateQueueQuickConnects -> Rep AssociateQueueQuickConnects x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AssociateQueueQuickConnects x -> AssociateQueueQuickConnects
$cfrom :: forall x.
AssociateQueueQuickConnects -> Rep AssociateQueueQuickConnects x
Prelude.Generic)

-- |
-- Create a value of 'AssociateQueueQuickConnects' 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:
--
-- 'instanceId', 'associateQueueQuickConnects_instanceId' - The identifier of the Amazon Connect instance. You can find the
-- instanceId in the ARN of the instance.
--
-- 'queueId', 'associateQueueQuickConnects_queueId' - The identifier for the queue.
--
-- 'quickConnectIds', 'associateQueueQuickConnects_quickConnectIds' - The quick connects to associate with this queue.
newAssociateQueueQuickConnects ::
  -- | 'instanceId'
  Prelude.Text ->
  -- | 'queueId'
  Prelude.Text ->
  -- | 'quickConnectIds'
  Prelude.NonEmpty Prelude.Text ->
  AssociateQueueQuickConnects
newAssociateQueueQuickConnects :: Text -> Text -> NonEmpty Text -> AssociateQueueQuickConnects
newAssociateQueueQuickConnects
  Text
pInstanceId_
  Text
pQueueId_
  NonEmpty Text
pQuickConnectIds_ =
    AssociateQueueQuickConnects' :: Text -> Text -> NonEmpty Text -> AssociateQueueQuickConnects
AssociateQueueQuickConnects'
      { $sel:instanceId:AssociateQueueQuickConnects' :: Text
instanceId =
          Text
pInstanceId_,
        $sel:queueId:AssociateQueueQuickConnects' :: Text
queueId = Text
pQueueId_,
        $sel:quickConnectIds:AssociateQueueQuickConnects' :: NonEmpty Text
quickConnectIds =
          Tagged (NonEmpty Text) (Identity (NonEmpty Text))
-> Tagged (NonEmpty Text) (Identity (NonEmpty Text))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged (NonEmpty Text) (Identity (NonEmpty Text))
 -> Tagged (NonEmpty Text) (Identity (NonEmpty Text)))
-> NonEmpty Text -> NonEmpty Text
forall t b. AReview t b -> b -> t
Lens.# NonEmpty Text
pQuickConnectIds_
      }

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

-- | The identifier for the queue.
associateQueueQuickConnects_queueId :: Lens.Lens' AssociateQueueQuickConnects Prelude.Text
associateQueueQuickConnects_queueId :: (Text -> f Text)
-> AssociateQueueQuickConnects -> f AssociateQueueQuickConnects
associateQueueQuickConnects_queueId = (AssociateQueueQuickConnects -> Text)
-> (AssociateQueueQuickConnects
    -> Text -> AssociateQueueQuickConnects)
-> Lens
     AssociateQueueQuickConnects AssociateQueueQuickConnects Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateQueueQuickConnects' {Text
queueId :: Text
$sel:queueId:AssociateQueueQuickConnects' :: AssociateQueueQuickConnects -> Text
queueId} -> Text
queueId) (\s :: AssociateQueueQuickConnects
s@AssociateQueueQuickConnects' {} Text
a -> AssociateQueueQuickConnects
s {$sel:queueId:AssociateQueueQuickConnects' :: Text
queueId = Text
a} :: AssociateQueueQuickConnects)

-- | The quick connects to associate with this queue.
associateQueueQuickConnects_quickConnectIds :: Lens.Lens' AssociateQueueQuickConnects (Prelude.NonEmpty Prelude.Text)
associateQueueQuickConnects_quickConnectIds :: (NonEmpty Text -> f (NonEmpty Text))
-> AssociateQueueQuickConnects -> f AssociateQueueQuickConnects
associateQueueQuickConnects_quickConnectIds = (AssociateQueueQuickConnects -> NonEmpty Text)
-> (AssociateQueueQuickConnects
    -> NonEmpty Text -> AssociateQueueQuickConnects)
-> Lens
     AssociateQueueQuickConnects
     AssociateQueueQuickConnects
     (NonEmpty Text)
     (NonEmpty Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateQueueQuickConnects' {NonEmpty Text
quickConnectIds :: NonEmpty Text
$sel:quickConnectIds:AssociateQueueQuickConnects' :: AssociateQueueQuickConnects -> NonEmpty Text
quickConnectIds} -> NonEmpty Text
quickConnectIds) (\s :: AssociateQueueQuickConnects
s@AssociateQueueQuickConnects' {} NonEmpty Text
a -> AssociateQueueQuickConnects
s {$sel:quickConnectIds:AssociateQueueQuickConnects' :: NonEmpty Text
quickConnectIds = NonEmpty Text
a} :: AssociateQueueQuickConnects) ((NonEmpty Text -> f (NonEmpty Text))
 -> AssociateQueueQuickConnects -> f AssociateQueueQuickConnects)
-> ((NonEmpty Text -> f (NonEmpty Text))
    -> NonEmpty Text -> f (NonEmpty Text))
-> (NonEmpty Text -> f (NonEmpty Text))
-> AssociateQueueQuickConnects
-> f AssociateQueueQuickConnects
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty Text -> f (NonEmpty Text))
-> NonEmpty Text -> f (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.Hashable AssociateQueueQuickConnects

instance Prelude.NFData AssociateQueueQuickConnects

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

instance Core.ToJSON AssociateQueueQuickConnects where
  toJSON :: AssociateQueueQuickConnects -> Value
toJSON AssociateQueueQuickConnects' {NonEmpty Text
Text
quickConnectIds :: NonEmpty Text
queueId :: Text
instanceId :: Text
$sel:quickConnectIds:AssociateQueueQuickConnects' :: AssociateQueueQuickConnects -> NonEmpty Text
$sel:queueId:AssociateQueueQuickConnects' :: AssociateQueueQuickConnects -> Text
$sel:instanceId:AssociateQueueQuickConnects' :: AssociateQueueQuickConnects -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"QuickConnectIds" Text -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty Text
quickConnectIds)
          ]
      )

instance Core.ToPath AssociateQueueQuickConnects where
  toPath :: AssociateQueueQuickConnects -> ByteString
toPath AssociateQueueQuickConnects' {NonEmpty Text
Text
quickConnectIds :: NonEmpty Text
queueId :: Text
instanceId :: Text
$sel:quickConnectIds:AssociateQueueQuickConnects' :: AssociateQueueQuickConnects -> NonEmpty Text
$sel:queueId:AssociateQueueQuickConnects' :: AssociateQueueQuickConnects -> Text
$sel:instanceId:AssociateQueueQuickConnects' :: AssociateQueueQuickConnects -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/queues/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
instanceId,
        ByteString
"/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
queueId,
        ByteString
"/associate-quick-connects"
      ]

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

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

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

instance
  Prelude.NFData
    AssociateQueueQuickConnectsResponse