{-# 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.CreateRoutingProfile
-- 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)
--
-- Creates a new routing profile.
module Amazonka.Connect.CreateRoutingProfile
  ( -- * Creating a Request
    CreateRoutingProfile (..),
    newCreateRoutingProfile,

    -- * Request Lenses
    createRoutingProfile_queueConfigs,
    createRoutingProfile_tags,
    createRoutingProfile_instanceId,
    createRoutingProfile_name,
    createRoutingProfile_description,
    createRoutingProfile_defaultOutboundQueueId,
    createRoutingProfile_mediaConcurrencies,

    -- * Destructuring the Response
    CreateRoutingProfileResponse (..),
    newCreateRoutingProfileResponse,

    -- * Response Lenses
    createRoutingProfileResponse_routingProfileArn,
    createRoutingProfileResponse_routingProfileId,
    createRoutingProfileResponse_httpStatus,
  )
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:/ 'newCreateRoutingProfile' smart constructor.
data CreateRoutingProfile = CreateRoutingProfile'
  { -- | The inbound queues associated with the routing profile. If no queue is
    -- added, the agent can make only outbound calls.
    CreateRoutingProfile -> Maybe (NonEmpty RoutingProfileQueueConfig)
queueConfigs :: Prelude.Maybe (Prelude.NonEmpty RoutingProfileQueueConfig),
    -- | One or more tags.
    CreateRoutingProfile -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The identifier of the Amazon Connect instance. You can find the
    -- instanceId in the ARN of the instance.
    CreateRoutingProfile -> Text
instanceId :: Prelude.Text,
    -- | The name of the routing profile. Must not be more than 127 characters.
    CreateRoutingProfile -> Text
name :: Prelude.Text,
    -- | Description of the routing profile. Must not be more than 250
    -- characters.
    CreateRoutingProfile -> Text
description :: Prelude.Text,
    -- | The default outbound queue for the routing profile.
    CreateRoutingProfile -> Text
defaultOutboundQueueId :: Prelude.Text,
    -- | The channels that agents can handle in the Contact Control Panel (CCP)
    -- for this routing profile.
    CreateRoutingProfile -> [MediaConcurrency]
mediaConcurrencies :: [MediaConcurrency]
  }
  deriving (CreateRoutingProfile -> CreateRoutingProfile -> Bool
(CreateRoutingProfile -> CreateRoutingProfile -> Bool)
-> (CreateRoutingProfile -> CreateRoutingProfile -> Bool)
-> Eq CreateRoutingProfile
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateRoutingProfile -> CreateRoutingProfile -> Bool
$c/= :: CreateRoutingProfile -> CreateRoutingProfile -> Bool
== :: CreateRoutingProfile -> CreateRoutingProfile -> Bool
$c== :: CreateRoutingProfile -> CreateRoutingProfile -> Bool
Prelude.Eq, ReadPrec [CreateRoutingProfile]
ReadPrec CreateRoutingProfile
Int -> ReadS CreateRoutingProfile
ReadS [CreateRoutingProfile]
(Int -> ReadS CreateRoutingProfile)
-> ReadS [CreateRoutingProfile]
-> ReadPrec CreateRoutingProfile
-> ReadPrec [CreateRoutingProfile]
-> Read CreateRoutingProfile
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateRoutingProfile]
$creadListPrec :: ReadPrec [CreateRoutingProfile]
readPrec :: ReadPrec CreateRoutingProfile
$creadPrec :: ReadPrec CreateRoutingProfile
readList :: ReadS [CreateRoutingProfile]
$creadList :: ReadS [CreateRoutingProfile]
readsPrec :: Int -> ReadS CreateRoutingProfile
$creadsPrec :: Int -> ReadS CreateRoutingProfile
Prelude.Read, Int -> CreateRoutingProfile -> ShowS
[CreateRoutingProfile] -> ShowS
CreateRoutingProfile -> String
(Int -> CreateRoutingProfile -> ShowS)
-> (CreateRoutingProfile -> String)
-> ([CreateRoutingProfile] -> ShowS)
-> Show CreateRoutingProfile
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateRoutingProfile] -> ShowS
$cshowList :: [CreateRoutingProfile] -> ShowS
show :: CreateRoutingProfile -> String
$cshow :: CreateRoutingProfile -> String
showsPrec :: Int -> CreateRoutingProfile -> ShowS
$cshowsPrec :: Int -> CreateRoutingProfile -> ShowS
Prelude.Show, (forall x. CreateRoutingProfile -> Rep CreateRoutingProfile x)
-> (forall x. Rep CreateRoutingProfile x -> CreateRoutingProfile)
-> Generic CreateRoutingProfile
forall x. Rep CreateRoutingProfile x -> CreateRoutingProfile
forall x. CreateRoutingProfile -> Rep CreateRoutingProfile x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateRoutingProfile x -> CreateRoutingProfile
$cfrom :: forall x. CreateRoutingProfile -> Rep CreateRoutingProfile x
Prelude.Generic)

-- |
-- Create a value of 'CreateRoutingProfile' 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:
--
-- 'queueConfigs', 'createRoutingProfile_queueConfigs' - The inbound queues associated with the routing profile. If no queue is
-- added, the agent can make only outbound calls.
--
-- 'tags', 'createRoutingProfile_tags' - One or more tags.
--
-- 'instanceId', 'createRoutingProfile_instanceId' - The identifier of the Amazon Connect instance. You can find the
-- instanceId in the ARN of the instance.
--
-- 'name', 'createRoutingProfile_name' - The name of the routing profile. Must not be more than 127 characters.
--
-- 'description', 'createRoutingProfile_description' - Description of the routing profile. Must not be more than 250
-- characters.
--
-- 'defaultOutboundQueueId', 'createRoutingProfile_defaultOutboundQueueId' - The default outbound queue for the routing profile.
--
-- 'mediaConcurrencies', 'createRoutingProfile_mediaConcurrencies' - The channels that agents can handle in the Contact Control Panel (CCP)
-- for this routing profile.
newCreateRoutingProfile ::
  -- | 'instanceId'
  Prelude.Text ->
  -- | 'name'
  Prelude.Text ->
  -- | 'description'
  Prelude.Text ->
  -- | 'defaultOutboundQueueId'
  Prelude.Text ->
  CreateRoutingProfile
newCreateRoutingProfile :: Text -> Text -> Text -> Text -> CreateRoutingProfile
newCreateRoutingProfile
  Text
pInstanceId_
  Text
pName_
  Text
pDescription_
  Text
pDefaultOutboundQueueId_ =
    CreateRoutingProfile' :: Maybe (NonEmpty RoutingProfileQueueConfig)
-> Maybe (HashMap Text Text)
-> Text
-> Text
-> Text
-> Text
-> [MediaConcurrency]
-> CreateRoutingProfile
CreateRoutingProfile'
      { $sel:queueConfigs:CreateRoutingProfile' :: Maybe (NonEmpty RoutingProfileQueueConfig)
queueConfigs =
          Maybe (NonEmpty RoutingProfileQueueConfig)
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreateRoutingProfile' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:instanceId:CreateRoutingProfile' :: Text
instanceId = Text
pInstanceId_,
        $sel:name:CreateRoutingProfile' :: Text
name = Text
pName_,
        $sel:description:CreateRoutingProfile' :: Text
description = Text
pDescription_,
        $sel:defaultOutboundQueueId:CreateRoutingProfile' :: Text
defaultOutboundQueueId = Text
pDefaultOutboundQueueId_,
        $sel:mediaConcurrencies:CreateRoutingProfile' :: [MediaConcurrency]
mediaConcurrencies = [MediaConcurrency]
forall a. Monoid a => a
Prelude.mempty
      }

-- | The inbound queues associated with the routing profile. If no queue is
-- added, the agent can make only outbound calls.
createRoutingProfile_queueConfigs :: Lens.Lens' CreateRoutingProfile (Prelude.Maybe (Prelude.NonEmpty RoutingProfileQueueConfig))
createRoutingProfile_queueConfigs :: (Maybe (NonEmpty RoutingProfileQueueConfig)
 -> f (Maybe (NonEmpty RoutingProfileQueueConfig)))
-> CreateRoutingProfile -> f CreateRoutingProfile
createRoutingProfile_queueConfigs = (CreateRoutingProfile
 -> Maybe (NonEmpty RoutingProfileQueueConfig))
-> (CreateRoutingProfile
    -> Maybe (NonEmpty RoutingProfileQueueConfig)
    -> CreateRoutingProfile)
-> Lens
     CreateRoutingProfile
     CreateRoutingProfile
     (Maybe (NonEmpty RoutingProfileQueueConfig))
     (Maybe (NonEmpty RoutingProfileQueueConfig))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRoutingProfile' {Maybe (NonEmpty RoutingProfileQueueConfig)
queueConfigs :: Maybe (NonEmpty RoutingProfileQueueConfig)
$sel:queueConfigs:CreateRoutingProfile' :: CreateRoutingProfile -> Maybe (NonEmpty RoutingProfileQueueConfig)
queueConfigs} -> Maybe (NonEmpty RoutingProfileQueueConfig)
queueConfigs) (\s :: CreateRoutingProfile
s@CreateRoutingProfile' {} Maybe (NonEmpty RoutingProfileQueueConfig)
a -> CreateRoutingProfile
s {$sel:queueConfigs:CreateRoutingProfile' :: Maybe (NonEmpty RoutingProfileQueueConfig)
queueConfigs = Maybe (NonEmpty RoutingProfileQueueConfig)
a} :: CreateRoutingProfile) ((Maybe (NonEmpty RoutingProfileQueueConfig)
  -> f (Maybe (NonEmpty RoutingProfileQueueConfig)))
 -> CreateRoutingProfile -> f CreateRoutingProfile)
-> ((Maybe (NonEmpty RoutingProfileQueueConfig)
     -> f (Maybe (NonEmpty RoutingProfileQueueConfig)))
    -> Maybe (NonEmpty RoutingProfileQueueConfig)
    -> f (Maybe (NonEmpty RoutingProfileQueueConfig)))
-> (Maybe (NonEmpty RoutingProfileQueueConfig)
    -> f (Maybe (NonEmpty RoutingProfileQueueConfig)))
-> CreateRoutingProfile
-> f CreateRoutingProfile
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty RoutingProfileQueueConfig)
  (NonEmpty RoutingProfileQueueConfig)
  (NonEmpty RoutingProfileQueueConfig)
  (NonEmpty RoutingProfileQueueConfig)
-> Iso
     (Maybe (NonEmpty RoutingProfileQueueConfig))
     (Maybe (NonEmpty RoutingProfileQueueConfig))
     (Maybe (NonEmpty RoutingProfileQueueConfig))
     (Maybe (NonEmpty RoutingProfileQueueConfig))
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
  (NonEmpty RoutingProfileQueueConfig)
  (NonEmpty RoutingProfileQueueConfig)
  (NonEmpty RoutingProfileQueueConfig)
  (NonEmpty RoutingProfileQueueConfig)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | One or more tags.
createRoutingProfile_tags :: Lens.Lens' CreateRoutingProfile (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createRoutingProfile_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateRoutingProfile -> f CreateRoutingProfile
createRoutingProfile_tags = (CreateRoutingProfile -> Maybe (HashMap Text Text))
-> (CreateRoutingProfile
    -> Maybe (HashMap Text Text) -> CreateRoutingProfile)
-> Lens
     CreateRoutingProfile
     CreateRoutingProfile
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRoutingProfile' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:CreateRoutingProfile' :: CreateRoutingProfile -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: CreateRoutingProfile
s@CreateRoutingProfile' {} Maybe (HashMap Text Text)
a -> CreateRoutingProfile
s {$sel:tags:CreateRoutingProfile' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: CreateRoutingProfile) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> CreateRoutingProfile -> f CreateRoutingProfile)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateRoutingProfile
-> f CreateRoutingProfile
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text 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
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

-- | The name of the routing profile. Must not be more than 127 characters.
createRoutingProfile_name :: Lens.Lens' CreateRoutingProfile Prelude.Text
createRoutingProfile_name :: (Text -> f Text) -> CreateRoutingProfile -> f CreateRoutingProfile
createRoutingProfile_name = (CreateRoutingProfile -> Text)
-> (CreateRoutingProfile -> Text -> CreateRoutingProfile)
-> Lens CreateRoutingProfile CreateRoutingProfile Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRoutingProfile' {Text
name :: Text
$sel:name:CreateRoutingProfile' :: CreateRoutingProfile -> Text
name} -> Text
name) (\s :: CreateRoutingProfile
s@CreateRoutingProfile' {} Text
a -> CreateRoutingProfile
s {$sel:name:CreateRoutingProfile' :: Text
name = Text
a} :: CreateRoutingProfile)

-- | Description of the routing profile. Must not be more than 250
-- characters.
createRoutingProfile_description :: Lens.Lens' CreateRoutingProfile Prelude.Text
createRoutingProfile_description :: (Text -> f Text) -> CreateRoutingProfile -> f CreateRoutingProfile
createRoutingProfile_description = (CreateRoutingProfile -> Text)
-> (CreateRoutingProfile -> Text -> CreateRoutingProfile)
-> Lens CreateRoutingProfile CreateRoutingProfile Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRoutingProfile' {Text
description :: Text
$sel:description:CreateRoutingProfile' :: CreateRoutingProfile -> Text
description} -> Text
description) (\s :: CreateRoutingProfile
s@CreateRoutingProfile' {} Text
a -> CreateRoutingProfile
s {$sel:description:CreateRoutingProfile' :: Text
description = Text
a} :: CreateRoutingProfile)

-- | The default outbound queue for the routing profile.
createRoutingProfile_defaultOutboundQueueId :: Lens.Lens' CreateRoutingProfile Prelude.Text
createRoutingProfile_defaultOutboundQueueId :: (Text -> f Text) -> CreateRoutingProfile -> f CreateRoutingProfile
createRoutingProfile_defaultOutboundQueueId = (CreateRoutingProfile -> Text)
-> (CreateRoutingProfile -> Text -> CreateRoutingProfile)
-> Lens CreateRoutingProfile CreateRoutingProfile Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRoutingProfile' {Text
defaultOutboundQueueId :: Text
$sel:defaultOutboundQueueId:CreateRoutingProfile' :: CreateRoutingProfile -> Text
defaultOutboundQueueId} -> Text
defaultOutboundQueueId) (\s :: CreateRoutingProfile
s@CreateRoutingProfile' {} Text
a -> CreateRoutingProfile
s {$sel:defaultOutboundQueueId:CreateRoutingProfile' :: Text
defaultOutboundQueueId = Text
a} :: CreateRoutingProfile)

-- | The channels that agents can handle in the Contact Control Panel (CCP)
-- for this routing profile.
createRoutingProfile_mediaConcurrencies :: Lens.Lens' CreateRoutingProfile [MediaConcurrency]
createRoutingProfile_mediaConcurrencies :: ([MediaConcurrency] -> f [MediaConcurrency])
-> CreateRoutingProfile -> f CreateRoutingProfile
createRoutingProfile_mediaConcurrencies = (CreateRoutingProfile -> [MediaConcurrency])
-> (CreateRoutingProfile
    -> [MediaConcurrency] -> CreateRoutingProfile)
-> Lens
     CreateRoutingProfile
     CreateRoutingProfile
     [MediaConcurrency]
     [MediaConcurrency]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRoutingProfile' {[MediaConcurrency]
mediaConcurrencies :: [MediaConcurrency]
$sel:mediaConcurrencies:CreateRoutingProfile' :: CreateRoutingProfile -> [MediaConcurrency]
mediaConcurrencies} -> [MediaConcurrency]
mediaConcurrencies) (\s :: CreateRoutingProfile
s@CreateRoutingProfile' {} [MediaConcurrency]
a -> CreateRoutingProfile
s {$sel:mediaConcurrencies:CreateRoutingProfile' :: [MediaConcurrency]
mediaConcurrencies = [MediaConcurrency]
a} :: CreateRoutingProfile) (([MediaConcurrency] -> f [MediaConcurrency])
 -> CreateRoutingProfile -> f CreateRoutingProfile)
-> (([MediaConcurrency] -> f [MediaConcurrency])
    -> [MediaConcurrency] -> f [MediaConcurrency])
-> ([MediaConcurrency] -> f [MediaConcurrency])
-> CreateRoutingProfile
-> f CreateRoutingProfile
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([MediaConcurrency] -> f [MediaConcurrency])
-> [MediaConcurrency] -> f [MediaConcurrency]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.AWSRequest CreateRoutingProfile where
  type
    AWSResponse CreateRoutingProfile =
      CreateRoutingProfileResponse
  request :: CreateRoutingProfile -> Request CreateRoutingProfile
request = Service -> CreateRoutingProfile -> Request CreateRoutingProfile
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateRoutingProfile
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateRoutingProfile)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateRoutingProfile))
-> Logger
-> Service
-> Proxy CreateRoutingProfile
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateRoutingProfile)))
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 Text -> Maybe Text -> Int -> CreateRoutingProfileResponse
CreateRoutingProfileResponse'
            (Maybe Text -> Maybe Text -> Int -> CreateRoutingProfileResponse)
-> Either String (Maybe Text)
-> Either
     String (Maybe Text -> Int -> CreateRoutingProfileResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"RoutingProfileArn")
            Either String (Maybe Text -> Int -> CreateRoutingProfileResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CreateRoutingProfileResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"RoutingProfileId")
            Either String (Int -> CreateRoutingProfileResponse)
-> Either String Int -> Either String CreateRoutingProfileResponse
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 CreateRoutingProfile

instance Prelude.NFData CreateRoutingProfile

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

instance Core.ToJSON CreateRoutingProfile where
  toJSON :: CreateRoutingProfile -> Value
toJSON CreateRoutingProfile' {[MediaConcurrency]
Maybe (NonEmpty RoutingProfileQueueConfig)
Maybe (HashMap Text Text)
Text
mediaConcurrencies :: [MediaConcurrency]
defaultOutboundQueueId :: Text
description :: Text
name :: Text
instanceId :: Text
tags :: Maybe (HashMap Text Text)
queueConfigs :: Maybe (NonEmpty RoutingProfileQueueConfig)
$sel:mediaConcurrencies:CreateRoutingProfile' :: CreateRoutingProfile -> [MediaConcurrency]
$sel:defaultOutboundQueueId:CreateRoutingProfile' :: CreateRoutingProfile -> Text
$sel:description:CreateRoutingProfile' :: CreateRoutingProfile -> Text
$sel:name:CreateRoutingProfile' :: CreateRoutingProfile -> Text
$sel:instanceId:CreateRoutingProfile' :: CreateRoutingProfile -> Text
$sel:tags:CreateRoutingProfile' :: CreateRoutingProfile -> Maybe (HashMap Text Text)
$sel:queueConfigs:CreateRoutingProfile' :: CreateRoutingProfile -> Maybe (NonEmpty RoutingProfileQueueConfig)
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"QueueConfigs" Text -> NonEmpty RoutingProfileQueueConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (NonEmpty RoutingProfileQueueConfig -> Pair)
-> Maybe (NonEmpty RoutingProfileQueueConfig) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty RoutingProfileQueueConfig)
queueConfigs,
            (Text
"Tags" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
tags,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Description" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
description),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"DefaultOutboundQueueId"
                  Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
defaultOutboundQueueId
              ),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"MediaConcurrencies" Text -> [MediaConcurrency] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [MediaConcurrency]
mediaConcurrencies)
          ]
      )

instance Core.ToPath CreateRoutingProfile where
  toPath :: CreateRoutingProfile -> ByteString
toPath CreateRoutingProfile' {[MediaConcurrency]
Maybe (NonEmpty RoutingProfileQueueConfig)
Maybe (HashMap Text Text)
Text
mediaConcurrencies :: [MediaConcurrency]
defaultOutboundQueueId :: Text
description :: Text
name :: Text
instanceId :: Text
tags :: Maybe (HashMap Text Text)
queueConfigs :: Maybe (NonEmpty RoutingProfileQueueConfig)
$sel:mediaConcurrencies:CreateRoutingProfile' :: CreateRoutingProfile -> [MediaConcurrency]
$sel:defaultOutboundQueueId:CreateRoutingProfile' :: CreateRoutingProfile -> Text
$sel:description:CreateRoutingProfile' :: CreateRoutingProfile -> Text
$sel:name:CreateRoutingProfile' :: CreateRoutingProfile -> Text
$sel:instanceId:CreateRoutingProfile' :: CreateRoutingProfile -> Text
$sel:tags:CreateRoutingProfile' :: CreateRoutingProfile -> Maybe (HashMap Text Text)
$sel:queueConfigs:CreateRoutingProfile' :: CreateRoutingProfile -> Maybe (NonEmpty RoutingProfileQueueConfig)
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/routing-profiles/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
instanceId]

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

-- | /See:/ 'newCreateRoutingProfileResponse' smart constructor.
data CreateRoutingProfileResponse = CreateRoutingProfileResponse'
  { -- | The Amazon Resource Name (ARN) of the routing profile.
    CreateRoutingProfileResponse -> Maybe Text
routingProfileArn :: Prelude.Maybe Prelude.Text,
    -- | The identifier of the routing profile.
    CreateRoutingProfileResponse -> Maybe Text
routingProfileId :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    CreateRoutingProfileResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateRoutingProfileResponse
-> CreateRoutingProfileResponse -> Bool
(CreateRoutingProfileResponse
 -> CreateRoutingProfileResponse -> Bool)
-> (CreateRoutingProfileResponse
    -> CreateRoutingProfileResponse -> Bool)
-> Eq CreateRoutingProfileResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateRoutingProfileResponse
-> CreateRoutingProfileResponse -> Bool
$c/= :: CreateRoutingProfileResponse
-> CreateRoutingProfileResponse -> Bool
== :: CreateRoutingProfileResponse
-> CreateRoutingProfileResponse -> Bool
$c== :: CreateRoutingProfileResponse
-> CreateRoutingProfileResponse -> Bool
Prelude.Eq, ReadPrec [CreateRoutingProfileResponse]
ReadPrec CreateRoutingProfileResponse
Int -> ReadS CreateRoutingProfileResponse
ReadS [CreateRoutingProfileResponse]
(Int -> ReadS CreateRoutingProfileResponse)
-> ReadS [CreateRoutingProfileResponse]
-> ReadPrec CreateRoutingProfileResponse
-> ReadPrec [CreateRoutingProfileResponse]
-> Read CreateRoutingProfileResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateRoutingProfileResponse]
$creadListPrec :: ReadPrec [CreateRoutingProfileResponse]
readPrec :: ReadPrec CreateRoutingProfileResponse
$creadPrec :: ReadPrec CreateRoutingProfileResponse
readList :: ReadS [CreateRoutingProfileResponse]
$creadList :: ReadS [CreateRoutingProfileResponse]
readsPrec :: Int -> ReadS CreateRoutingProfileResponse
$creadsPrec :: Int -> ReadS CreateRoutingProfileResponse
Prelude.Read, Int -> CreateRoutingProfileResponse -> ShowS
[CreateRoutingProfileResponse] -> ShowS
CreateRoutingProfileResponse -> String
(Int -> CreateRoutingProfileResponse -> ShowS)
-> (CreateRoutingProfileResponse -> String)
-> ([CreateRoutingProfileResponse] -> ShowS)
-> Show CreateRoutingProfileResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateRoutingProfileResponse] -> ShowS
$cshowList :: [CreateRoutingProfileResponse] -> ShowS
show :: CreateRoutingProfileResponse -> String
$cshow :: CreateRoutingProfileResponse -> String
showsPrec :: Int -> CreateRoutingProfileResponse -> ShowS
$cshowsPrec :: Int -> CreateRoutingProfileResponse -> ShowS
Prelude.Show, (forall x.
 CreateRoutingProfileResponse -> Rep CreateRoutingProfileResponse x)
-> (forall x.
    Rep CreateRoutingProfileResponse x -> CreateRoutingProfileResponse)
-> Generic CreateRoutingProfileResponse
forall x.
Rep CreateRoutingProfileResponse x -> CreateRoutingProfileResponse
forall x.
CreateRoutingProfileResponse -> Rep CreateRoutingProfileResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateRoutingProfileResponse x -> CreateRoutingProfileResponse
$cfrom :: forall x.
CreateRoutingProfileResponse -> Rep CreateRoutingProfileResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateRoutingProfileResponse' 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:
--
-- 'routingProfileArn', 'createRoutingProfileResponse_routingProfileArn' - The Amazon Resource Name (ARN) of the routing profile.
--
-- 'routingProfileId', 'createRoutingProfileResponse_routingProfileId' - The identifier of the routing profile.
--
-- 'httpStatus', 'createRoutingProfileResponse_httpStatus' - The response's http status code.
newCreateRoutingProfileResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateRoutingProfileResponse
newCreateRoutingProfileResponse :: Int -> CreateRoutingProfileResponse
newCreateRoutingProfileResponse Int
pHttpStatus_ =
  CreateRoutingProfileResponse' :: Maybe Text -> Maybe Text -> Int -> CreateRoutingProfileResponse
CreateRoutingProfileResponse'
    { $sel:routingProfileArn:CreateRoutingProfileResponse' :: Maybe Text
routingProfileArn =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:routingProfileId:CreateRoutingProfileResponse' :: Maybe Text
routingProfileId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateRoutingProfileResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The Amazon Resource Name (ARN) of the routing profile.
createRoutingProfileResponse_routingProfileArn :: Lens.Lens' CreateRoutingProfileResponse (Prelude.Maybe Prelude.Text)
createRoutingProfileResponse_routingProfileArn :: (Maybe Text -> f (Maybe Text))
-> CreateRoutingProfileResponse -> f CreateRoutingProfileResponse
createRoutingProfileResponse_routingProfileArn = (CreateRoutingProfileResponse -> Maybe Text)
-> (CreateRoutingProfileResponse
    -> Maybe Text -> CreateRoutingProfileResponse)
-> Lens
     CreateRoutingProfileResponse
     CreateRoutingProfileResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRoutingProfileResponse' {Maybe Text
routingProfileArn :: Maybe Text
$sel:routingProfileArn:CreateRoutingProfileResponse' :: CreateRoutingProfileResponse -> Maybe Text
routingProfileArn} -> Maybe Text
routingProfileArn) (\s :: CreateRoutingProfileResponse
s@CreateRoutingProfileResponse' {} Maybe Text
a -> CreateRoutingProfileResponse
s {$sel:routingProfileArn:CreateRoutingProfileResponse' :: Maybe Text
routingProfileArn = Maybe Text
a} :: CreateRoutingProfileResponse)

-- | The identifier of the routing profile.
createRoutingProfileResponse_routingProfileId :: Lens.Lens' CreateRoutingProfileResponse (Prelude.Maybe Prelude.Text)
createRoutingProfileResponse_routingProfileId :: (Maybe Text -> f (Maybe Text))
-> CreateRoutingProfileResponse -> f CreateRoutingProfileResponse
createRoutingProfileResponse_routingProfileId = (CreateRoutingProfileResponse -> Maybe Text)
-> (CreateRoutingProfileResponse
    -> Maybe Text -> CreateRoutingProfileResponse)
-> Lens
     CreateRoutingProfileResponse
     CreateRoutingProfileResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRoutingProfileResponse' {Maybe Text
routingProfileId :: Maybe Text
$sel:routingProfileId:CreateRoutingProfileResponse' :: CreateRoutingProfileResponse -> Maybe Text
routingProfileId} -> Maybe Text
routingProfileId) (\s :: CreateRoutingProfileResponse
s@CreateRoutingProfileResponse' {} Maybe Text
a -> CreateRoutingProfileResponse
s {$sel:routingProfileId:CreateRoutingProfileResponse' :: Maybe Text
routingProfileId = Maybe Text
a} :: CreateRoutingProfileResponse)

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

instance Prelude.NFData CreateRoutingProfileResponse