{-# 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.ChimeSDKIdentity.UpdateAppInstanceUser
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Updates the details of an @AppInstanceUser@. You can update names and
-- metadata.
module Amazonka.ChimeSDKIdentity.UpdateAppInstanceUser
  ( -- * Creating a Request
    UpdateAppInstanceUser (..),
    newUpdateAppInstanceUser,

    -- * Request Lenses
    updateAppInstanceUser_appInstanceUserArn,
    updateAppInstanceUser_name,
    updateAppInstanceUser_metadata,

    -- * Destructuring the Response
    UpdateAppInstanceUserResponse (..),
    newUpdateAppInstanceUserResponse,

    -- * Response Lenses
    updateAppInstanceUserResponse_appInstanceUserArn,
    updateAppInstanceUserResponse_httpStatus,
  )
where

import Amazonka.ChimeSDKIdentity.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:/ 'newUpdateAppInstanceUser' smart constructor.
data UpdateAppInstanceUser = UpdateAppInstanceUser'
  { -- | The ARN of the @AppInstanceUser@.
    UpdateAppInstanceUser -> Text
appInstanceUserArn :: Prelude.Text,
    -- | The name of the @AppInstanceUser@.
    UpdateAppInstanceUser -> Sensitive Text
name :: Data.Sensitive Prelude.Text,
    -- | The metadata of the @AppInstanceUser@.
    UpdateAppInstanceUser -> Sensitive Text
metadata :: Data.Sensitive Prelude.Text
  }
  deriving (UpdateAppInstanceUser -> UpdateAppInstanceUser -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateAppInstanceUser -> UpdateAppInstanceUser -> Bool
$c/= :: UpdateAppInstanceUser -> UpdateAppInstanceUser -> Bool
== :: UpdateAppInstanceUser -> UpdateAppInstanceUser -> Bool
$c== :: UpdateAppInstanceUser -> UpdateAppInstanceUser -> Bool
Prelude.Eq, Int -> UpdateAppInstanceUser -> ShowS
[UpdateAppInstanceUser] -> ShowS
UpdateAppInstanceUser -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateAppInstanceUser] -> ShowS
$cshowList :: [UpdateAppInstanceUser] -> ShowS
show :: UpdateAppInstanceUser -> String
$cshow :: UpdateAppInstanceUser -> String
showsPrec :: Int -> UpdateAppInstanceUser -> ShowS
$cshowsPrec :: Int -> UpdateAppInstanceUser -> ShowS
Prelude.Show, forall x. Rep UpdateAppInstanceUser x -> UpdateAppInstanceUser
forall x. UpdateAppInstanceUser -> Rep UpdateAppInstanceUser x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateAppInstanceUser x -> UpdateAppInstanceUser
$cfrom :: forall x. UpdateAppInstanceUser -> Rep UpdateAppInstanceUser x
Prelude.Generic)

-- |
-- Create a value of 'UpdateAppInstanceUser' 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:
--
-- 'appInstanceUserArn', 'updateAppInstanceUser_appInstanceUserArn' - The ARN of the @AppInstanceUser@.
--
-- 'name', 'updateAppInstanceUser_name' - The name of the @AppInstanceUser@.
--
-- 'metadata', 'updateAppInstanceUser_metadata' - The metadata of the @AppInstanceUser@.
newUpdateAppInstanceUser ::
  -- | 'appInstanceUserArn'
  Prelude.Text ->
  -- | 'name'
  Prelude.Text ->
  -- | 'metadata'
  Prelude.Text ->
  UpdateAppInstanceUser
newUpdateAppInstanceUser :: Text -> Text -> Text -> UpdateAppInstanceUser
newUpdateAppInstanceUser
  Text
pAppInstanceUserArn_
  Text
pName_
  Text
pMetadata_ =
    UpdateAppInstanceUser'
      { $sel:appInstanceUserArn:UpdateAppInstanceUser' :: Text
appInstanceUserArn =
          Text
pAppInstanceUserArn_,
        $sel:name:UpdateAppInstanceUser' :: Sensitive Text
name = forall a. Iso' (Sensitive a) a
Data._Sensitive forall t b. AReview t b -> b -> t
Lens.# Text
pName_,
        $sel:metadata:UpdateAppInstanceUser' :: Sensitive Text
metadata = forall a. Iso' (Sensitive a) a
Data._Sensitive forall t b. AReview t b -> b -> t
Lens.# Text
pMetadata_
      }

-- | The ARN of the @AppInstanceUser@.
updateAppInstanceUser_appInstanceUserArn :: Lens.Lens' UpdateAppInstanceUser Prelude.Text
updateAppInstanceUser_appInstanceUserArn :: Lens' UpdateAppInstanceUser Text
updateAppInstanceUser_appInstanceUserArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAppInstanceUser' {Text
appInstanceUserArn :: Text
$sel:appInstanceUserArn:UpdateAppInstanceUser' :: UpdateAppInstanceUser -> Text
appInstanceUserArn} -> Text
appInstanceUserArn) (\s :: UpdateAppInstanceUser
s@UpdateAppInstanceUser' {} Text
a -> UpdateAppInstanceUser
s {$sel:appInstanceUserArn:UpdateAppInstanceUser' :: Text
appInstanceUserArn = Text
a} :: UpdateAppInstanceUser)

-- | The name of the @AppInstanceUser@.
updateAppInstanceUser_name :: Lens.Lens' UpdateAppInstanceUser Prelude.Text
updateAppInstanceUser_name :: Lens' UpdateAppInstanceUser Text
updateAppInstanceUser_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAppInstanceUser' {Sensitive Text
name :: Sensitive Text
$sel:name:UpdateAppInstanceUser' :: UpdateAppInstanceUser -> Sensitive Text
name} -> Sensitive Text
name) (\s :: UpdateAppInstanceUser
s@UpdateAppInstanceUser' {} Sensitive Text
a -> UpdateAppInstanceUser
s {$sel:name:UpdateAppInstanceUser' :: Sensitive Text
name = Sensitive Text
a} :: UpdateAppInstanceUser) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a. Iso' (Sensitive a) a
Data._Sensitive

-- | The metadata of the @AppInstanceUser@.
updateAppInstanceUser_metadata :: Lens.Lens' UpdateAppInstanceUser Prelude.Text
updateAppInstanceUser_metadata :: Lens' UpdateAppInstanceUser Text
updateAppInstanceUser_metadata = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAppInstanceUser' {Sensitive Text
metadata :: Sensitive Text
$sel:metadata:UpdateAppInstanceUser' :: UpdateAppInstanceUser -> Sensitive Text
metadata} -> Sensitive Text
metadata) (\s :: UpdateAppInstanceUser
s@UpdateAppInstanceUser' {} Sensitive Text
a -> UpdateAppInstanceUser
s {$sel:metadata:UpdateAppInstanceUser' :: Sensitive Text
metadata = Sensitive Text
a} :: UpdateAppInstanceUser) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a. Iso' (Sensitive a) a
Data._Sensitive

instance Core.AWSRequest UpdateAppInstanceUser where
  type
    AWSResponse UpdateAppInstanceUser =
      UpdateAppInstanceUserResponse
  request :: (Service -> Service)
-> UpdateAppInstanceUser -> Request UpdateAppInstanceUser
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 UpdateAppInstanceUser
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateAppInstanceUser)))
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 -> UpdateAppInstanceUserResponse
UpdateAppInstanceUserResponse'
            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
"AppInstanceUserArn")
            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 UpdateAppInstanceUser where
  hashWithSalt :: Int -> UpdateAppInstanceUser -> Int
hashWithSalt Int
_salt UpdateAppInstanceUser' {Text
Sensitive Text
metadata :: Sensitive Text
name :: Sensitive Text
appInstanceUserArn :: Text
$sel:metadata:UpdateAppInstanceUser' :: UpdateAppInstanceUser -> Sensitive Text
$sel:name:UpdateAppInstanceUser' :: UpdateAppInstanceUser -> Sensitive Text
$sel:appInstanceUserArn:UpdateAppInstanceUser' :: UpdateAppInstanceUser -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
appInstanceUserArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Sensitive Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Sensitive Text
metadata

instance Prelude.NFData UpdateAppInstanceUser where
  rnf :: UpdateAppInstanceUser -> ()
rnf UpdateAppInstanceUser' {Text
Sensitive Text
metadata :: Sensitive Text
name :: Sensitive Text
appInstanceUserArn :: Text
$sel:metadata:UpdateAppInstanceUser' :: UpdateAppInstanceUser -> Sensitive Text
$sel:name:UpdateAppInstanceUser' :: UpdateAppInstanceUser -> Sensitive Text
$sel:appInstanceUserArn:UpdateAppInstanceUser' :: UpdateAppInstanceUser -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
appInstanceUserArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Sensitive Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Sensitive Text
metadata

instance Data.ToHeaders UpdateAppInstanceUser where
  toHeaders :: UpdateAppInstanceUser -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

instance Data.ToJSON UpdateAppInstanceUser where
  toJSON :: UpdateAppInstanceUser -> Value
toJSON UpdateAppInstanceUser' {Text
Sensitive Text
metadata :: Sensitive Text
name :: Sensitive Text
appInstanceUserArn :: Text
$sel:metadata:UpdateAppInstanceUser' :: UpdateAppInstanceUser -> Sensitive Text
$sel:name:UpdateAppInstanceUser' :: UpdateAppInstanceUser -> Sensitive Text
$sel:appInstanceUserArn:UpdateAppInstanceUser' :: UpdateAppInstanceUser -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just (Key
"Name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Sensitive Text
name),
            forall a. a -> Maybe a
Prelude.Just (Key
"Metadata" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Sensitive Text
metadata)
          ]
      )

instance Data.ToPath UpdateAppInstanceUser where
  toPath :: UpdateAppInstanceUser -> ByteString
toPath UpdateAppInstanceUser' {Text
Sensitive Text
metadata :: Sensitive Text
name :: Sensitive Text
appInstanceUserArn :: Text
$sel:metadata:UpdateAppInstanceUser' :: UpdateAppInstanceUser -> Sensitive Text
$sel:name:UpdateAppInstanceUser' :: UpdateAppInstanceUser -> Sensitive Text
$sel:appInstanceUserArn:UpdateAppInstanceUser' :: UpdateAppInstanceUser -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/app-instance-users/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
appInstanceUserArn
      ]

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

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

-- |
-- Create a value of 'UpdateAppInstanceUserResponse' 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:
--
-- 'appInstanceUserArn', 'updateAppInstanceUserResponse_appInstanceUserArn' - The ARN of the @AppInstanceUser@.
--
-- 'httpStatus', 'updateAppInstanceUserResponse_httpStatus' - The response's http status code.
newUpdateAppInstanceUserResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  UpdateAppInstanceUserResponse
newUpdateAppInstanceUserResponse :: Int -> UpdateAppInstanceUserResponse
newUpdateAppInstanceUserResponse Int
pHttpStatus_ =
  UpdateAppInstanceUserResponse'
    { $sel:appInstanceUserArn:UpdateAppInstanceUserResponse' :: Maybe Text
appInstanceUserArn =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:UpdateAppInstanceUserResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The ARN of the @AppInstanceUser@.
updateAppInstanceUserResponse_appInstanceUserArn :: Lens.Lens' UpdateAppInstanceUserResponse (Prelude.Maybe Prelude.Text)
updateAppInstanceUserResponse_appInstanceUserArn :: Lens' UpdateAppInstanceUserResponse (Maybe Text)
updateAppInstanceUserResponse_appInstanceUserArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAppInstanceUserResponse' {Maybe Text
appInstanceUserArn :: Maybe Text
$sel:appInstanceUserArn:UpdateAppInstanceUserResponse' :: UpdateAppInstanceUserResponse -> Maybe Text
appInstanceUserArn} -> Maybe Text
appInstanceUserArn) (\s :: UpdateAppInstanceUserResponse
s@UpdateAppInstanceUserResponse' {} Maybe Text
a -> UpdateAppInstanceUserResponse
s {$sel:appInstanceUserArn:UpdateAppInstanceUserResponse' :: Maybe Text
appInstanceUserArn = Maybe Text
a} :: UpdateAppInstanceUserResponse)

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

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