{-# 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.UpdateContactFlowName
-- 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)
--
-- The name of the contact flow.
--
-- You can also create and update contact flows using the
-- <https://docs.aws.amazon.com/connect/latest/adminguide/flow-language.html Amazon Connect Flow language>.
module Amazonka.Connect.UpdateContactFlowName
  ( -- * Creating a Request
    UpdateContactFlowName (..),
    newUpdateContactFlowName,

    -- * Request Lenses
    updateContactFlowName_name,
    updateContactFlowName_description,
    updateContactFlowName_instanceId,
    updateContactFlowName_contactFlowId,

    -- * Destructuring the Response
    UpdateContactFlowNameResponse (..),
    newUpdateContactFlowNameResponse,
  )
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:/ 'newUpdateContactFlowName' smart constructor.
data UpdateContactFlowName = UpdateContactFlowName'
  { -- | The name of the contact flow.
    UpdateContactFlowName -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The description of the contact flow.
    UpdateContactFlowName -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The identifier of the Amazon Connect instance.
    UpdateContactFlowName -> Text
instanceId :: Prelude.Text,
    -- | The identifier of the contact flow.
    UpdateContactFlowName -> Text
contactFlowId :: Prelude.Text
  }
  deriving (UpdateContactFlowName -> UpdateContactFlowName -> Bool
(UpdateContactFlowName -> UpdateContactFlowName -> Bool)
-> (UpdateContactFlowName -> UpdateContactFlowName -> Bool)
-> Eq UpdateContactFlowName
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateContactFlowName -> UpdateContactFlowName -> Bool
$c/= :: UpdateContactFlowName -> UpdateContactFlowName -> Bool
== :: UpdateContactFlowName -> UpdateContactFlowName -> Bool
$c== :: UpdateContactFlowName -> UpdateContactFlowName -> Bool
Prelude.Eq, ReadPrec [UpdateContactFlowName]
ReadPrec UpdateContactFlowName
Int -> ReadS UpdateContactFlowName
ReadS [UpdateContactFlowName]
(Int -> ReadS UpdateContactFlowName)
-> ReadS [UpdateContactFlowName]
-> ReadPrec UpdateContactFlowName
-> ReadPrec [UpdateContactFlowName]
-> Read UpdateContactFlowName
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateContactFlowName]
$creadListPrec :: ReadPrec [UpdateContactFlowName]
readPrec :: ReadPrec UpdateContactFlowName
$creadPrec :: ReadPrec UpdateContactFlowName
readList :: ReadS [UpdateContactFlowName]
$creadList :: ReadS [UpdateContactFlowName]
readsPrec :: Int -> ReadS UpdateContactFlowName
$creadsPrec :: Int -> ReadS UpdateContactFlowName
Prelude.Read, Int -> UpdateContactFlowName -> ShowS
[UpdateContactFlowName] -> ShowS
UpdateContactFlowName -> String
(Int -> UpdateContactFlowName -> ShowS)
-> (UpdateContactFlowName -> String)
-> ([UpdateContactFlowName] -> ShowS)
-> Show UpdateContactFlowName
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateContactFlowName] -> ShowS
$cshowList :: [UpdateContactFlowName] -> ShowS
show :: UpdateContactFlowName -> String
$cshow :: UpdateContactFlowName -> String
showsPrec :: Int -> UpdateContactFlowName -> ShowS
$cshowsPrec :: Int -> UpdateContactFlowName -> ShowS
Prelude.Show, (forall x. UpdateContactFlowName -> Rep UpdateContactFlowName x)
-> (forall x. Rep UpdateContactFlowName x -> UpdateContactFlowName)
-> Generic UpdateContactFlowName
forall x. Rep UpdateContactFlowName x -> UpdateContactFlowName
forall x. UpdateContactFlowName -> Rep UpdateContactFlowName x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateContactFlowName x -> UpdateContactFlowName
$cfrom :: forall x. UpdateContactFlowName -> Rep UpdateContactFlowName x
Prelude.Generic)

-- |
-- Create a value of 'UpdateContactFlowName' 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:
--
-- 'name', 'updateContactFlowName_name' - The name of the contact flow.
--
-- 'description', 'updateContactFlowName_description' - The description of the contact flow.
--
-- 'instanceId', 'updateContactFlowName_instanceId' - The identifier of the Amazon Connect instance.
--
-- 'contactFlowId', 'updateContactFlowName_contactFlowId' - The identifier of the contact flow.
newUpdateContactFlowName ::
  -- | 'instanceId'
  Prelude.Text ->
  -- | 'contactFlowId'
  Prelude.Text ->
  UpdateContactFlowName
newUpdateContactFlowName :: Text -> Text -> UpdateContactFlowName
newUpdateContactFlowName Text
pInstanceId_ Text
pContactFlowId_ =
  UpdateContactFlowName' :: Maybe Text -> Maybe Text -> Text -> Text -> UpdateContactFlowName
UpdateContactFlowName'
    { $sel:name:UpdateContactFlowName' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:description:UpdateContactFlowName' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:instanceId:UpdateContactFlowName' :: Text
instanceId = Text
pInstanceId_,
      $sel:contactFlowId:UpdateContactFlowName' :: Text
contactFlowId = Text
pContactFlowId_
    }

-- | The name of the contact flow.
updateContactFlowName_name :: Lens.Lens' UpdateContactFlowName (Prelude.Maybe Prelude.Text)
updateContactFlowName_name :: (Maybe Text -> f (Maybe Text))
-> UpdateContactFlowName -> f UpdateContactFlowName
updateContactFlowName_name = (UpdateContactFlowName -> Maybe Text)
-> (UpdateContactFlowName -> Maybe Text -> UpdateContactFlowName)
-> Lens
     UpdateContactFlowName
     UpdateContactFlowName
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateContactFlowName' {Maybe Text
name :: Maybe Text
$sel:name:UpdateContactFlowName' :: UpdateContactFlowName -> Maybe Text
name} -> Maybe Text
name) (\s :: UpdateContactFlowName
s@UpdateContactFlowName' {} Maybe Text
a -> UpdateContactFlowName
s {$sel:name:UpdateContactFlowName' :: Maybe Text
name = Maybe Text
a} :: UpdateContactFlowName)

-- | The description of the contact flow.
updateContactFlowName_description :: Lens.Lens' UpdateContactFlowName (Prelude.Maybe Prelude.Text)
updateContactFlowName_description :: (Maybe Text -> f (Maybe Text))
-> UpdateContactFlowName -> f UpdateContactFlowName
updateContactFlowName_description = (UpdateContactFlowName -> Maybe Text)
-> (UpdateContactFlowName -> Maybe Text -> UpdateContactFlowName)
-> Lens
     UpdateContactFlowName
     UpdateContactFlowName
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateContactFlowName' {Maybe Text
description :: Maybe Text
$sel:description:UpdateContactFlowName' :: UpdateContactFlowName -> Maybe Text
description} -> Maybe Text
description) (\s :: UpdateContactFlowName
s@UpdateContactFlowName' {} Maybe Text
a -> UpdateContactFlowName
s {$sel:description:UpdateContactFlowName' :: Maybe Text
description = Maybe Text
a} :: UpdateContactFlowName)

-- | The identifier of the Amazon Connect instance.
updateContactFlowName_instanceId :: Lens.Lens' UpdateContactFlowName Prelude.Text
updateContactFlowName_instanceId :: (Text -> f Text)
-> UpdateContactFlowName -> f UpdateContactFlowName
updateContactFlowName_instanceId = (UpdateContactFlowName -> Text)
-> (UpdateContactFlowName -> Text -> UpdateContactFlowName)
-> Lens UpdateContactFlowName UpdateContactFlowName Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateContactFlowName' {Text
instanceId :: Text
$sel:instanceId:UpdateContactFlowName' :: UpdateContactFlowName -> Text
instanceId} -> Text
instanceId) (\s :: UpdateContactFlowName
s@UpdateContactFlowName' {} Text
a -> UpdateContactFlowName
s {$sel:instanceId:UpdateContactFlowName' :: Text
instanceId = Text
a} :: UpdateContactFlowName)

-- | The identifier of the contact flow.
updateContactFlowName_contactFlowId :: Lens.Lens' UpdateContactFlowName Prelude.Text
updateContactFlowName_contactFlowId :: (Text -> f Text)
-> UpdateContactFlowName -> f UpdateContactFlowName
updateContactFlowName_contactFlowId = (UpdateContactFlowName -> Text)
-> (UpdateContactFlowName -> Text -> UpdateContactFlowName)
-> Lens UpdateContactFlowName UpdateContactFlowName Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateContactFlowName' {Text
contactFlowId :: Text
$sel:contactFlowId:UpdateContactFlowName' :: UpdateContactFlowName -> Text
contactFlowId} -> Text
contactFlowId) (\s :: UpdateContactFlowName
s@UpdateContactFlowName' {} Text
a -> UpdateContactFlowName
s {$sel:contactFlowId:UpdateContactFlowName' :: Text
contactFlowId = Text
a} :: UpdateContactFlowName)

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

instance Prelude.Hashable UpdateContactFlowName

instance Prelude.NFData UpdateContactFlowName

instance Core.ToHeaders UpdateContactFlowName where
  toHeaders :: UpdateContactFlowName -> [Header]
toHeaders =
    [Header] -> UpdateContactFlowName -> [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 UpdateContactFlowName where
  toJSON :: UpdateContactFlowName -> Value
toJSON UpdateContactFlowName' {Maybe Text
Text
contactFlowId :: Text
instanceId :: Text
description :: Maybe Text
name :: Maybe Text
$sel:contactFlowId:UpdateContactFlowName' :: UpdateContactFlowName -> Text
$sel:instanceId:UpdateContactFlowName' :: UpdateContactFlowName -> Text
$sel:description:UpdateContactFlowName' :: UpdateContactFlowName -> Maybe Text
$sel:name:UpdateContactFlowName' :: UpdateContactFlowName -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
name,
            (Text
"Description" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
description
          ]
      )

instance Core.ToPath UpdateContactFlowName where
  toPath :: UpdateContactFlowName -> ByteString
toPath UpdateContactFlowName' {Maybe Text
Text
contactFlowId :: Text
instanceId :: Text
description :: Maybe Text
name :: Maybe Text
$sel:contactFlowId:UpdateContactFlowName' :: UpdateContactFlowName -> Text
$sel:instanceId:UpdateContactFlowName' :: UpdateContactFlowName -> Text
$sel:description:UpdateContactFlowName' :: UpdateContactFlowName -> Maybe Text
$sel:name:UpdateContactFlowName' :: UpdateContactFlowName -> Maybe Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/contact-flows/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
instanceId,
        ByteString
"/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
contactFlowId,
        ByteString
"/name"
      ]

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

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

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

instance Prelude.NFData UpdateContactFlowNameResponse