{-# 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.UpdateInstanceAttribute
-- 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.
--
-- Updates the value for the specified attribute type.
module Amazonka.Connect.UpdateInstanceAttribute
  ( -- * Creating a Request
    UpdateInstanceAttribute (..),
    newUpdateInstanceAttribute,

    -- * Request Lenses
    updateInstanceAttribute_instanceId,
    updateInstanceAttribute_attributeType,
    updateInstanceAttribute_value,

    -- * Destructuring the Response
    UpdateInstanceAttributeResponse (..),
    newUpdateInstanceAttributeResponse,
  )
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:/ 'newUpdateInstanceAttribute' smart constructor.
data UpdateInstanceAttribute = UpdateInstanceAttribute'
  { -- | The identifier of the Amazon Connect instance. You can find the
    -- instanceId in the ARN of the instance.
    UpdateInstanceAttribute -> Text
instanceId :: Prelude.Text,
    -- | The type of attribute.
    --
    -- Only allowlisted customers can consume USE_CUSTOM_TTS_VOICES. To access
    -- this feature, contact AWS Support for allowlisting.
    UpdateInstanceAttribute -> InstanceAttributeType
attributeType :: InstanceAttributeType,
    -- | The value for the attribute. Maximum character limit is 100.
    UpdateInstanceAttribute -> Text
value :: Prelude.Text
  }
  deriving (UpdateInstanceAttribute -> UpdateInstanceAttribute -> Bool
(UpdateInstanceAttribute -> UpdateInstanceAttribute -> Bool)
-> (UpdateInstanceAttribute -> UpdateInstanceAttribute -> Bool)
-> Eq UpdateInstanceAttribute
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateInstanceAttribute -> UpdateInstanceAttribute -> Bool
$c/= :: UpdateInstanceAttribute -> UpdateInstanceAttribute -> Bool
== :: UpdateInstanceAttribute -> UpdateInstanceAttribute -> Bool
$c== :: UpdateInstanceAttribute -> UpdateInstanceAttribute -> Bool
Prelude.Eq, ReadPrec [UpdateInstanceAttribute]
ReadPrec UpdateInstanceAttribute
Int -> ReadS UpdateInstanceAttribute
ReadS [UpdateInstanceAttribute]
(Int -> ReadS UpdateInstanceAttribute)
-> ReadS [UpdateInstanceAttribute]
-> ReadPrec UpdateInstanceAttribute
-> ReadPrec [UpdateInstanceAttribute]
-> Read UpdateInstanceAttribute
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateInstanceAttribute]
$creadListPrec :: ReadPrec [UpdateInstanceAttribute]
readPrec :: ReadPrec UpdateInstanceAttribute
$creadPrec :: ReadPrec UpdateInstanceAttribute
readList :: ReadS [UpdateInstanceAttribute]
$creadList :: ReadS [UpdateInstanceAttribute]
readsPrec :: Int -> ReadS UpdateInstanceAttribute
$creadsPrec :: Int -> ReadS UpdateInstanceAttribute
Prelude.Read, Int -> UpdateInstanceAttribute -> ShowS
[UpdateInstanceAttribute] -> ShowS
UpdateInstanceAttribute -> String
(Int -> UpdateInstanceAttribute -> ShowS)
-> (UpdateInstanceAttribute -> String)
-> ([UpdateInstanceAttribute] -> ShowS)
-> Show UpdateInstanceAttribute
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateInstanceAttribute] -> ShowS
$cshowList :: [UpdateInstanceAttribute] -> ShowS
show :: UpdateInstanceAttribute -> String
$cshow :: UpdateInstanceAttribute -> String
showsPrec :: Int -> UpdateInstanceAttribute -> ShowS
$cshowsPrec :: Int -> UpdateInstanceAttribute -> ShowS
Prelude.Show, (forall x.
 UpdateInstanceAttribute -> Rep UpdateInstanceAttribute x)
-> (forall x.
    Rep UpdateInstanceAttribute x -> UpdateInstanceAttribute)
-> Generic UpdateInstanceAttribute
forall x. Rep UpdateInstanceAttribute x -> UpdateInstanceAttribute
forall x. UpdateInstanceAttribute -> Rep UpdateInstanceAttribute x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateInstanceAttribute x -> UpdateInstanceAttribute
$cfrom :: forall x. UpdateInstanceAttribute -> Rep UpdateInstanceAttribute x
Prelude.Generic)

-- |
-- Create a value of 'UpdateInstanceAttribute' 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', 'updateInstanceAttribute_instanceId' - The identifier of the Amazon Connect instance. You can find the
-- instanceId in the ARN of the instance.
--
-- 'attributeType', 'updateInstanceAttribute_attributeType' - The type of attribute.
--
-- Only allowlisted customers can consume USE_CUSTOM_TTS_VOICES. To access
-- this feature, contact AWS Support for allowlisting.
--
-- 'value', 'updateInstanceAttribute_value' - The value for the attribute. Maximum character limit is 100.
newUpdateInstanceAttribute ::
  -- | 'instanceId'
  Prelude.Text ->
  -- | 'attributeType'
  InstanceAttributeType ->
  -- | 'value'
  Prelude.Text ->
  UpdateInstanceAttribute
newUpdateInstanceAttribute :: Text -> InstanceAttributeType -> Text -> UpdateInstanceAttribute
newUpdateInstanceAttribute
  Text
pInstanceId_
  InstanceAttributeType
pAttributeType_
  Text
pValue_ =
    UpdateInstanceAttribute' :: Text -> InstanceAttributeType -> Text -> UpdateInstanceAttribute
UpdateInstanceAttribute'
      { $sel:instanceId:UpdateInstanceAttribute' :: Text
instanceId = Text
pInstanceId_,
        $sel:attributeType:UpdateInstanceAttribute' :: InstanceAttributeType
attributeType = InstanceAttributeType
pAttributeType_,
        $sel:value:UpdateInstanceAttribute' :: Text
value = Text
pValue_
      }

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

-- | The type of attribute.
--
-- Only allowlisted customers can consume USE_CUSTOM_TTS_VOICES. To access
-- this feature, contact AWS Support for allowlisting.
updateInstanceAttribute_attributeType :: Lens.Lens' UpdateInstanceAttribute InstanceAttributeType
updateInstanceAttribute_attributeType :: (InstanceAttributeType -> f InstanceAttributeType)
-> UpdateInstanceAttribute -> f UpdateInstanceAttribute
updateInstanceAttribute_attributeType = (UpdateInstanceAttribute -> InstanceAttributeType)
-> (UpdateInstanceAttribute
    -> InstanceAttributeType -> UpdateInstanceAttribute)
-> Lens
     UpdateInstanceAttribute
     UpdateInstanceAttribute
     InstanceAttributeType
     InstanceAttributeType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateInstanceAttribute' {InstanceAttributeType
attributeType :: InstanceAttributeType
$sel:attributeType:UpdateInstanceAttribute' :: UpdateInstanceAttribute -> InstanceAttributeType
attributeType} -> InstanceAttributeType
attributeType) (\s :: UpdateInstanceAttribute
s@UpdateInstanceAttribute' {} InstanceAttributeType
a -> UpdateInstanceAttribute
s {$sel:attributeType:UpdateInstanceAttribute' :: InstanceAttributeType
attributeType = InstanceAttributeType
a} :: UpdateInstanceAttribute)

-- | The value for the attribute. Maximum character limit is 100.
updateInstanceAttribute_value :: Lens.Lens' UpdateInstanceAttribute Prelude.Text
updateInstanceAttribute_value :: (Text -> f Text)
-> UpdateInstanceAttribute -> f UpdateInstanceAttribute
updateInstanceAttribute_value = (UpdateInstanceAttribute -> Text)
-> (UpdateInstanceAttribute -> Text -> UpdateInstanceAttribute)
-> Lens UpdateInstanceAttribute UpdateInstanceAttribute Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateInstanceAttribute' {Text
value :: Text
$sel:value:UpdateInstanceAttribute' :: UpdateInstanceAttribute -> Text
value} -> Text
value) (\s :: UpdateInstanceAttribute
s@UpdateInstanceAttribute' {} Text
a -> UpdateInstanceAttribute
s {$sel:value:UpdateInstanceAttribute' :: Text
value = Text
a} :: UpdateInstanceAttribute)

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

instance Prelude.Hashable UpdateInstanceAttribute

instance Prelude.NFData UpdateInstanceAttribute

instance Core.ToHeaders UpdateInstanceAttribute where
  toHeaders :: UpdateInstanceAttribute -> [Header]
toHeaders =
    [Header] -> UpdateInstanceAttribute -> [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 UpdateInstanceAttribute where
  toJSON :: UpdateInstanceAttribute -> Value
toJSON UpdateInstanceAttribute' {Text
InstanceAttributeType
value :: Text
attributeType :: InstanceAttributeType
instanceId :: Text
$sel:value:UpdateInstanceAttribute' :: UpdateInstanceAttribute -> Text
$sel:attributeType:UpdateInstanceAttribute' :: UpdateInstanceAttribute -> InstanceAttributeType
$sel:instanceId:UpdateInstanceAttribute' :: UpdateInstanceAttribute -> 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
"Value" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
value)]
      )

instance Core.ToPath UpdateInstanceAttribute where
  toPath :: UpdateInstanceAttribute -> ByteString
toPath UpdateInstanceAttribute' {Text
InstanceAttributeType
value :: Text
attributeType :: InstanceAttributeType
instanceId :: Text
$sel:value:UpdateInstanceAttribute' :: UpdateInstanceAttribute -> Text
$sel:attributeType:UpdateInstanceAttribute' :: UpdateInstanceAttribute -> InstanceAttributeType
$sel:instanceId:UpdateInstanceAttribute' :: UpdateInstanceAttribute -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/instance/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
instanceId,
        ByteString
"/attribute/",
        InstanceAttributeType -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS InstanceAttributeType
attributeType
      ]

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

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

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

instance
  Prelude.NFData
    UpdateInstanceAttributeResponse