{-# 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.WorkDocs.UpdateUser
-- 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 specified attributes of the specified user, and grants or
-- revokes administrative privileges to the Amazon WorkDocs site.
module Amazonka.WorkDocs.UpdateUser
  ( -- * Creating a Request
    UpdateUser (..),
    newUpdateUser,

    -- * Request Lenses
    updateUser_authenticationToken,
    updateUser_givenName,
    updateUser_grantPoweruserPrivileges,
    updateUser_locale,
    updateUser_storageRule,
    updateUser_surname,
    updateUser_timeZoneId,
    updateUser_type,
    updateUser_userId,

    -- * Destructuring the Response
    UpdateUserResponse (..),
    newUpdateUserResponse,

    -- * Response Lenses
    updateUserResponse_user,
    updateUserResponse_httpStatus,
  )
where

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
import Amazonka.WorkDocs.Types

-- | /See:/ 'newUpdateUser' smart constructor.
data UpdateUser = UpdateUser'
  { -- | Amazon WorkDocs authentication token. Not required when using AWS
    -- administrator credentials to access the API.
    UpdateUser -> Maybe (Sensitive Text)
authenticationToken :: Prelude.Maybe (Data.Sensitive Prelude.Text),
    -- | The given name of the user.
    UpdateUser -> Maybe Text
givenName :: Prelude.Maybe Prelude.Text,
    -- | Boolean value to determine whether the user is granted Poweruser
    -- privileges.
    UpdateUser -> Maybe BooleanEnumType
grantPoweruserPrivileges :: Prelude.Maybe BooleanEnumType,
    -- | The locale of the user.
    UpdateUser -> Maybe LocaleType
locale :: Prelude.Maybe LocaleType,
    -- | The amount of storage for the user.
    UpdateUser -> Maybe StorageRuleType
storageRule :: Prelude.Maybe StorageRuleType,
    -- | The surname of the user.
    UpdateUser -> Maybe Text
surname :: Prelude.Maybe Prelude.Text,
    -- | The time zone ID of the user.
    UpdateUser -> Maybe Text
timeZoneId :: Prelude.Maybe Prelude.Text,
    -- | The type of the user.
    UpdateUser -> Maybe UserType
type' :: Prelude.Maybe UserType,
    -- | The ID of the user.
    UpdateUser -> Text
userId :: Prelude.Text
  }
  deriving (UpdateUser -> UpdateUser -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateUser -> UpdateUser -> Bool
$c/= :: UpdateUser -> UpdateUser -> Bool
== :: UpdateUser -> UpdateUser -> Bool
$c== :: UpdateUser -> UpdateUser -> Bool
Prelude.Eq, Int -> UpdateUser -> ShowS
[UpdateUser] -> ShowS
UpdateUser -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateUser] -> ShowS
$cshowList :: [UpdateUser] -> ShowS
show :: UpdateUser -> String
$cshow :: UpdateUser -> String
showsPrec :: Int -> UpdateUser -> ShowS
$cshowsPrec :: Int -> UpdateUser -> ShowS
Prelude.Show, forall x. Rep UpdateUser x -> UpdateUser
forall x. UpdateUser -> Rep UpdateUser x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateUser x -> UpdateUser
$cfrom :: forall x. UpdateUser -> Rep UpdateUser x
Prelude.Generic)

-- |
-- Create a value of 'UpdateUser' 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:
--
-- 'authenticationToken', 'updateUser_authenticationToken' - Amazon WorkDocs authentication token. Not required when using AWS
-- administrator credentials to access the API.
--
-- 'givenName', 'updateUser_givenName' - The given name of the user.
--
-- 'grantPoweruserPrivileges', 'updateUser_grantPoweruserPrivileges' - Boolean value to determine whether the user is granted Poweruser
-- privileges.
--
-- 'locale', 'updateUser_locale' - The locale of the user.
--
-- 'storageRule', 'updateUser_storageRule' - The amount of storage for the user.
--
-- 'surname', 'updateUser_surname' - The surname of the user.
--
-- 'timeZoneId', 'updateUser_timeZoneId' - The time zone ID of the user.
--
-- 'type'', 'updateUser_type' - The type of the user.
--
-- 'userId', 'updateUser_userId' - The ID of the user.
newUpdateUser ::
  -- | 'userId'
  Prelude.Text ->
  UpdateUser
newUpdateUser :: Text -> UpdateUser
newUpdateUser Text
pUserId_ =
  UpdateUser'
    { $sel:authenticationToken:UpdateUser' :: Maybe (Sensitive Text)
authenticationToken = forall a. Maybe a
Prelude.Nothing,
      $sel:givenName:UpdateUser' :: Maybe Text
givenName = forall a. Maybe a
Prelude.Nothing,
      $sel:grantPoweruserPrivileges:UpdateUser' :: Maybe BooleanEnumType
grantPoweruserPrivileges = forall a. Maybe a
Prelude.Nothing,
      $sel:locale:UpdateUser' :: Maybe LocaleType
locale = forall a. Maybe a
Prelude.Nothing,
      $sel:storageRule:UpdateUser' :: Maybe StorageRuleType
storageRule = forall a. Maybe a
Prelude.Nothing,
      $sel:surname:UpdateUser' :: Maybe Text
surname = forall a. Maybe a
Prelude.Nothing,
      $sel:timeZoneId:UpdateUser' :: Maybe Text
timeZoneId = forall a. Maybe a
Prelude.Nothing,
      $sel:type':UpdateUser' :: Maybe UserType
type' = forall a. Maybe a
Prelude.Nothing,
      $sel:userId:UpdateUser' :: Text
userId = Text
pUserId_
    }

-- | Amazon WorkDocs authentication token. Not required when using AWS
-- administrator credentials to access the API.
updateUser_authenticationToken :: Lens.Lens' UpdateUser (Prelude.Maybe Prelude.Text)
updateUser_authenticationToken :: Lens' UpdateUser (Maybe Text)
updateUser_authenticationToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateUser' {Maybe (Sensitive Text)
authenticationToken :: Maybe (Sensitive Text)
$sel:authenticationToken:UpdateUser' :: UpdateUser -> Maybe (Sensitive Text)
authenticationToken} -> Maybe (Sensitive Text)
authenticationToken) (\s :: UpdateUser
s@UpdateUser' {} Maybe (Sensitive Text)
a -> UpdateUser
s {$sel:authenticationToken:UpdateUser' :: Maybe (Sensitive Text)
authenticationToken = Maybe (Sensitive Text)
a} :: UpdateUser) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall a. Iso' (Sensitive a) a
Data._Sensitive

-- | The given name of the user.
updateUser_givenName :: Lens.Lens' UpdateUser (Prelude.Maybe Prelude.Text)
updateUser_givenName :: Lens' UpdateUser (Maybe Text)
updateUser_givenName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateUser' {Maybe Text
givenName :: Maybe Text
$sel:givenName:UpdateUser' :: UpdateUser -> Maybe Text
givenName} -> Maybe Text
givenName) (\s :: UpdateUser
s@UpdateUser' {} Maybe Text
a -> UpdateUser
s {$sel:givenName:UpdateUser' :: Maybe Text
givenName = Maybe Text
a} :: UpdateUser)

-- | Boolean value to determine whether the user is granted Poweruser
-- privileges.
updateUser_grantPoweruserPrivileges :: Lens.Lens' UpdateUser (Prelude.Maybe BooleanEnumType)
updateUser_grantPoweruserPrivileges :: Lens' UpdateUser (Maybe BooleanEnumType)
updateUser_grantPoweruserPrivileges = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateUser' {Maybe BooleanEnumType
grantPoweruserPrivileges :: Maybe BooleanEnumType
$sel:grantPoweruserPrivileges:UpdateUser' :: UpdateUser -> Maybe BooleanEnumType
grantPoweruserPrivileges} -> Maybe BooleanEnumType
grantPoweruserPrivileges) (\s :: UpdateUser
s@UpdateUser' {} Maybe BooleanEnumType
a -> UpdateUser
s {$sel:grantPoweruserPrivileges:UpdateUser' :: Maybe BooleanEnumType
grantPoweruserPrivileges = Maybe BooleanEnumType
a} :: UpdateUser)

-- | The locale of the user.
updateUser_locale :: Lens.Lens' UpdateUser (Prelude.Maybe LocaleType)
updateUser_locale :: Lens' UpdateUser (Maybe LocaleType)
updateUser_locale = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateUser' {Maybe LocaleType
locale :: Maybe LocaleType
$sel:locale:UpdateUser' :: UpdateUser -> Maybe LocaleType
locale} -> Maybe LocaleType
locale) (\s :: UpdateUser
s@UpdateUser' {} Maybe LocaleType
a -> UpdateUser
s {$sel:locale:UpdateUser' :: Maybe LocaleType
locale = Maybe LocaleType
a} :: UpdateUser)

-- | The amount of storage for the user.
updateUser_storageRule :: Lens.Lens' UpdateUser (Prelude.Maybe StorageRuleType)
updateUser_storageRule :: Lens' UpdateUser (Maybe StorageRuleType)
updateUser_storageRule = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateUser' {Maybe StorageRuleType
storageRule :: Maybe StorageRuleType
$sel:storageRule:UpdateUser' :: UpdateUser -> Maybe StorageRuleType
storageRule} -> Maybe StorageRuleType
storageRule) (\s :: UpdateUser
s@UpdateUser' {} Maybe StorageRuleType
a -> UpdateUser
s {$sel:storageRule:UpdateUser' :: Maybe StorageRuleType
storageRule = Maybe StorageRuleType
a} :: UpdateUser)

-- | The surname of the user.
updateUser_surname :: Lens.Lens' UpdateUser (Prelude.Maybe Prelude.Text)
updateUser_surname :: Lens' UpdateUser (Maybe Text)
updateUser_surname = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateUser' {Maybe Text
surname :: Maybe Text
$sel:surname:UpdateUser' :: UpdateUser -> Maybe Text
surname} -> Maybe Text
surname) (\s :: UpdateUser
s@UpdateUser' {} Maybe Text
a -> UpdateUser
s {$sel:surname:UpdateUser' :: Maybe Text
surname = Maybe Text
a} :: UpdateUser)

-- | The time zone ID of the user.
updateUser_timeZoneId :: Lens.Lens' UpdateUser (Prelude.Maybe Prelude.Text)
updateUser_timeZoneId :: Lens' UpdateUser (Maybe Text)
updateUser_timeZoneId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateUser' {Maybe Text
timeZoneId :: Maybe Text
$sel:timeZoneId:UpdateUser' :: UpdateUser -> Maybe Text
timeZoneId} -> Maybe Text
timeZoneId) (\s :: UpdateUser
s@UpdateUser' {} Maybe Text
a -> UpdateUser
s {$sel:timeZoneId:UpdateUser' :: Maybe Text
timeZoneId = Maybe Text
a} :: UpdateUser)

-- | The type of the user.
updateUser_type :: Lens.Lens' UpdateUser (Prelude.Maybe UserType)
updateUser_type :: Lens' UpdateUser (Maybe UserType)
updateUser_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateUser' {Maybe UserType
type' :: Maybe UserType
$sel:type':UpdateUser' :: UpdateUser -> Maybe UserType
type'} -> Maybe UserType
type') (\s :: UpdateUser
s@UpdateUser' {} Maybe UserType
a -> UpdateUser
s {$sel:type':UpdateUser' :: Maybe UserType
type' = Maybe UserType
a} :: UpdateUser)

-- | The ID of the user.
updateUser_userId :: Lens.Lens' UpdateUser Prelude.Text
updateUser_userId :: Lens' UpdateUser Text
updateUser_userId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateUser' {Text
userId :: Text
$sel:userId:UpdateUser' :: UpdateUser -> Text
userId} -> Text
userId) (\s :: UpdateUser
s@UpdateUser' {} Text
a -> UpdateUser
s {$sel:userId:UpdateUser' :: Text
userId = Text
a} :: UpdateUser)

instance Core.AWSRequest UpdateUser where
  type AWSResponse UpdateUser = UpdateUserResponse
  request :: (Service -> Service) -> UpdateUser -> Request UpdateUser
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.patchJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy UpdateUser
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateUser)))
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 User -> Int -> UpdateUserResponse
UpdateUserResponse'
            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
"User")
            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 UpdateUser where
  hashWithSalt :: Int -> UpdateUser -> Int
hashWithSalt Int
_salt UpdateUser' {Maybe Text
Maybe (Sensitive Text)
Maybe BooleanEnumType
Maybe LocaleType
Maybe StorageRuleType
Maybe UserType
Text
userId :: Text
type' :: Maybe UserType
timeZoneId :: Maybe Text
surname :: Maybe Text
storageRule :: Maybe StorageRuleType
locale :: Maybe LocaleType
grantPoweruserPrivileges :: Maybe BooleanEnumType
givenName :: Maybe Text
authenticationToken :: Maybe (Sensitive Text)
$sel:userId:UpdateUser' :: UpdateUser -> Text
$sel:type':UpdateUser' :: UpdateUser -> Maybe UserType
$sel:timeZoneId:UpdateUser' :: UpdateUser -> Maybe Text
$sel:surname:UpdateUser' :: UpdateUser -> Maybe Text
$sel:storageRule:UpdateUser' :: UpdateUser -> Maybe StorageRuleType
$sel:locale:UpdateUser' :: UpdateUser -> Maybe LocaleType
$sel:grantPoweruserPrivileges:UpdateUser' :: UpdateUser -> Maybe BooleanEnumType
$sel:givenName:UpdateUser' :: UpdateUser -> Maybe Text
$sel:authenticationToken:UpdateUser' :: UpdateUser -> Maybe (Sensitive Text)
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (Sensitive Text)
authenticationToken
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
givenName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe BooleanEnumType
grantPoweruserPrivileges
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe LocaleType
locale
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe StorageRuleType
storageRule
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
surname
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
timeZoneId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe UserType
type'
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
userId

instance Prelude.NFData UpdateUser where
  rnf :: UpdateUser -> ()
rnf UpdateUser' {Maybe Text
Maybe (Sensitive Text)
Maybe BooleanEnumType
Maybe LocaleType
Maybe StorageRuleType
Maybe UserType
Text
userId :: Text
type' :: Maybe UserType
timeZoneId :: Maybe Text
surname :: Maybe Text
storageRule :: Maybe StorageRuleType
locale :: Maybe LocaleType
grantPoweruserPrivileges :: Maybe BooleanEnumType
givenName :: Maybe Text
authenticationToken :: Maybe (Sensitive Text)
$sel:userId:UpdateUser' :: UpdateUser -> Text
$sel:type':UpdateUser' :: UpdateUser -> Maybe UserType
$sel:timeZoneId:UpdateUser' :: UpdateUser -> Maybe Text
$sel:surname:UpdateUser' :: UpdateUser -> Maybe Text
$sel:storageRule:UpdateUser' :: UpdateUser -> Maybe StorageRuleType
$sel:locale:UpdateUser' :: UpdateUser -> Maybe LocaleType
$sel:grantPoweruserPrivileges:UpdateUser' :: UpdateUser -> Maybe BooleanEnumType
$sel:givenName:UpdateUser' :: UpdateUser -> Maybe Text
$sel:authenticationToken:UpdateUser' :: UpdateUser -> Maybe (Sensitive Text)
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe (Sensitive Text)
authenticationToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
givenName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe BooleanEnumType
grantPoweruserPrivileges
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe LocaleType
locale
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe StorageRuleType
storageRule
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
surname
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
timeZoneId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe UserType
type'
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
userId

instance Data.ToHeaders UpdateUser where
  toHeaders :: UpdateUser -> ResponseHeaders
toHeaders UpdateUser' {Maybe Text
Maybe (Sensitive Text)
Maybe BooleanEnumType
Maybe LocaleType
Maybe StorageRuleType
Maybe UserType
Text
userId :: Text
type' :: Maybe UserType
timeZoneId :: Maybe Text
surname :: Maybe Text
storageRule :: Maybe StorageRuleType
locale :: Maybe LocaleType
grantPoweruserPrivileges :: Maybe BooleanEnumType
givenName :: Maybe Text
authenticationToken :: Maybe (Sensitive Text)
$sel:userId:UpdateUser' :: UpdateUser -> Text
$sel:type':UpdateUser' :: UpdateUser -> Maybe UserType
$sel:timeZoneId:UpdateUser' :: UpdateUser -> Maybe Text
$sel:surname:UpdateUser' :: UpdateUser -> Maybe Text
$sel:storageRule:UpdateUser' :: UpdateUser -> Maybe StorageRuleType
$sel:locale:UpdateUser' :: UpdateUser -> Maybe LocaleType
$sel:grantPoweruserPrivileges:UpdateUser' :: UpdateUser -> Maybe BooleanEnumType
$sel:givenName:UpdateUser' :: UpdateUser -> Maybe Text
$sel:authenticationToken:UpdateUser' :: UpdateUser -> Maybe (Sensitive Text)
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ HeaderName
"Authentication" forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# Maybe (Sensitive Text)
authenticationToken,
        HeaderName
"Content-Type"
          forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# (ByteString
"application/x-amz-json-1.1" :: Prelude.ByteString)
      ]

instance Data.ToJSON UpdateUser where
  toJSON :: UpdateUser -> Value
toJSON UpdateUser' {Maybe Text
Maybe (Sensitive Text)
Maybe BooleanEnumType
Maybe LocaleType
Maybe StorageRuleType
Maybe UserType
Text
userId :: Text
type' :: Maybe UserType
timeZoneId :: Maybe Text
surname :: Maybe Text
storageRule :: Maybe StorageRuleType
locale :: Maybe LocaleType
grantPoweruserPrivileges :: Maybe BooleanEnumType
givenName :: Maybe Text
authenticationToken :: Maybe (Sensitive Text)
$sel:userId:UpdateUser' :: UpdateUser -> Text
$sel:type':UpdateUser' :: UpdateUser -> Maybe UserType
$sel:timeZoneId:UpdateUser' :: UpdateUser -> Maybe Text
$sel:surname:UpdateUser' :: UpdateUser -> Maybe Text
$sel:storageRule:UpdateUser' :: UpdateUser -> Maybe StorageRuleType
$sel:locale:UpdateUser' :: UpdateUser -> Maybe LocaleType
$sel:grantPoweruserPrivileges:UpdateUser' :: UpdateUser -> Maybe BooleanEnumType
$sel:givenName:UpdateUser' :: UpdateUser -> Maybe Text
$sel:authenticationToken:UpdateUser' :: UpdateUser -> Maybe (Sensitive Text)
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"GivenName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
givenName,
            (Key
"GrantPoweruserPrivileges" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe BooleanEnumType
grantPoweruserPrivileges,
            (Key
"Locale" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe LocaleType
locale,
            (Key
"StorageRule" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe StorageRuleType
storageRule,
            (Key
"Surname" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
surname,
            (Key
"TimeZoneId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
timeZoneId,
            (Key
"Type" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe UserType
type'
          ]
      )

instance Data.ToPath UpdateUser where
  toPath :: UpdateUser -> ByteString
toPath UpdateUser' {Maybe Text
Maybe (Sensitive Text)
Maybe BooleanEnumType
Maybe LocaleType
Maybe StorageRuleType
Maybe UserType
Text
userId :: Text
type' :: Maybe UserType
timeZoneId :: Maybe Text
surname :: Maybe Text
storageRule :: Maybe StorageRuleType
locale :: Maybe LocaleType
grantPoweruserPrivileges :: Maybe BooleanEnumType
givenName :: Maybe Text
authenticationToken :: Maybe (Sensitive Text)
$sel:userId:UpdateUser' :: UpdateUser -> Text
$sel:type':UpdateUser' :: UpdateUser -> Maybe UserType
$sel:timeZoneId:UpdateUser' :: UpdateUser -> Maybe Text
$sel:surname:UpdateUser' :: UpdateUser -> Maybe Text
$sel:storageRule:UpdateUser' :: UpdateUser -> Maybe StorageRuleType
$sel:locale:UpdateUser' :: UpdateUser -> Maybe LocaleType
$sel:grantPoweruserPrivileges:UpdateUser' :: UpdateUser -> Maybe BooleanEnumType
$sel:givenName:UpdateUser' :: UpdateUser -> Maybe Text
$sel:authenticationToken:UpdateUser' :: UpdateUser -> Maybe (Sensitive Text)
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/api/v1/users/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
userId]

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

-- | /See:/ 'newUpdateUserResponse' smart constructor.
data UpdateUserResponse = UpdateUserResponse'
  { -- | The user information.
    UpdateUserResponse -> Maybe User
user :: Prelude.Maybe User,
    -- | The response's http status code.
    UpdateUserResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (UpdateUserResponse -> UpdateUserResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateUserResponse -> UpdateUserResponse -> Bool
$c/= :: UpdateUserResponse -> UpdateUserResponse -> Bool
== :: UpdateUserResponse -> UpdateUserResponse -> Bool
$c== :: UpdateUserResponse -> UpdateUserResponse -> Bool
Prelude.Eq, Int -> UpdateUserResponse -> ShowS
[UpdateUserResponse] -> ShowS
UpdateUserResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateUserResponse] -> ShowS
$cshowList :: [UpdateUserResponse] -> ShowS
show :: UpdateUserResponse -> String
$cshow :: UpdateUserResponse -> String
showsPrec :: Int -> UpdateUserResponse -> ShowS
$cshowsPrec :: Int -> UpdateUserResponse -> ShowS
Prelude.Show, forall x. Rep UpdateUserResponse x -> UpdateUserResponse
forall x. UpdateUserResponse -> Rep UpdateUserResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateUserResponse x -> UpdateUserResponse
$cfrom :: forall x. UpdateUserResponse -> Rep UpdateUserResponse x
Prelude.Generic)

-- |
-- Create a value of 'UpdateUserResponse' 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:
--
-- 'user', 'updateUserResponse_user' - The user information.
--
-- 'httpStatus', 'updateUserResponse_httpStatus' - The response's http status code.
newUpdateUserResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  UpdateUserResponse
newUpdateUserResponse :: Int -> UpdateUserResponse
newUpdateUserResponse Int
pHttpStatus_ =
  UpdateUserResponse'
    { $sel:user:UpdateUserResponse' :: Maybe User
user = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:UpdateUserResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The user information.
updateUserResponse_user :: Lens.Lens' UpdateUserResponse (Prelude.Maybe User)
updateUserResponse_user :: Lens' UpdateUserResponse (Maybe User)
updateUserResponse_user = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateUserResponse' {Maybe User
user :: Maybe User
$sel:user:UpdateUserResponse' :: UpdateUserResponse -> Maybe User
user} -> Maybe User
user) (\s :: UpdateUserResponse
s@UpdateUserResponse' {} Maybe User
a -> UpdateUserResponse
s {$sel:user:UpdateUserResponse' :: Maybe User
user = Maybe User
a} :: UpdateUserResponse)

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

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