{-# 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-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)
--
-- 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_givenName,
    updateUser_grantPoweruserPrivileges,
    updateUser_locale,
    updateUser_authenticationToken,
    updateUser_storageRule,
    updateUser_type,
    updateUser_surname,
    updateUser_timeZoneId,
    updateUser_userId,

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

    -- * Response Lenses
    updateUserResponse_user,
    updateUserResponse_httpStatus,
  )
where

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

-- | /See:/ 'newUpdateUser' smart constructor.
data UpdateUser = UpdateUser'
  { -- | 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,
    -- | Amazon WorkDocs authentication token. Not required when using AWS
    -- administrator credentials to access the API.
    UpdateUser -> Maybe (Sensitive Text)
authenticationToken :: Prelude.Maybe (Core.Sensitive Prelude.Text),
    -- | The amount of storage for the user.
    UpdateUser -> Maybe StorageRuleType
storageRule :: Prelude.Maybe StorageRuleType,
    -- | The type of the user.
    UpdateUser -> Maybe UserType
type' :: Prelude.Maybe UserType,
    -- | 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 ID of the user.
    UpdateUser -> Text
userId :: Prelude.Text
  }
  deriving (UpdateUser -> UpdateUser -> Bool
(UpdateUser -> UpdateUser -> Bool)
-> (UpdateUser -> UpdateUser -> Bool) -> Eq UpdateUser
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
(Int -> UpdateUser -> ShowS)
-> (UpdateUser -> String)
-> ([UpdateUser] -> ShowS)
-> Show UpdateUser
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. UpdateUser -> Rep UpdateUser x)
-> (forall x. Rep UpdateUser x -> UpdateUser) -> Generic UpdateUser
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:
--
-- '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.
--
-- 'authenticationToken', 'updateUser_authenticationToken' - Amazon WorkDocs authentication token. Not required when using AWS
-- administrator credentials to access the API.
--
-- 'storageRule', 'updateUser_storageRule' - The amount of storage for the user.
--
-- 'type'', 'updateUser_type' - The type of the user.
--
-- 'surname', 'updateUser_surname' - The surname of the user.
--
-- 'timeZoneId', 'updateUser_timeZoneId' - The time zone ID of the user.
--
-- 'userId', 'updateUser_userId' - The ID of the user.
newUpdateUser ::
  -- | 'userId'
  Prelude.Text ->
  UpdateUser
newUpdateUser :: Text -> UpdateUser
newUpdateUser Text
pUserId_ =
  UpdateUser' :: Maybe Text
-> Maybe BooleanEnumType
-> Maybe LocaleType
-> Maybe (Sensitive Text)
-> Maybe StorageRuleType
-> Maybe UserType
-> Maybe Text
-> Maybe Text
-> Text
-> UpdateUser
UpdateUser'
    { $sel:givenName:UpdateUser' :: Maybe Text
givenName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:grantPoweruserPrivileges:UpdateUser' :: Maybe BooleanEnumType
grantPoweruserPrivileges = Maybe BooleanEnumType
forall a. Maybe a
Prelude.Nothing,
      $sel:locale:UpdateUser' :: Maybe LocaleType
locale = Maybe LocaleType
forall a. Maybe a
Prelude.Nothing,
      $sel:authenticationToken:UpdateUser' :: Maybe (Sensitive Text)
authenticationToken = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:storageRule:UpdateUser' :: Maybe StorageRuleType
storageRule = Maybe StorageRuleType
forall a. Maybe a
Prelude.Nothing,
      $sel:type':UpdateUser' :: Maybe UserType
type' = Maybe UserType
forall a. Maybe a
Prelude.Nothing,
      $sel:surname:UpdateUser' :: Maybe Text
surname = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:timeZoneId:UpdateUser' :: Maybe Text
timeZoneId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:userId:UpdateUser' :: Text
userId = Text
pUserId_
    }

-- | The given name of the user.
updateUser_givenName :: Lens.Lens' UpdateUser (Prelude.Maybe Prelude.Text)
updateUser_givenName :: (Maybe Text -> f (Maybe Text)) -> UpdateUser -> f UpdateUser
updateUser_givenName = (UpdateUser -> Maybe Text)
-> (UpdateUser -> Maybe Text -> UpdateUser)
-> Lens UpdateUser UpdateUser (Maybe Text) (Maybe Text)
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 :: (Maybe BooleanEnumType -> f (Maybe BooleanEnumType))
-> UpdateUser -> f UpdateUser
updateUser_grantPoweruserPrivileges = (UpdateUser -> Maybe BooleanEnumType)
-> (UpdateUser -> Maybe BooleanEnumType -> UpdateUser)
-> Lens
     UpdateUser
     UpdateUser
     (Maybe BooleanEnumType)
     (Maybe BooleanEnumType)
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 :: (Maybe LocaleType -> f (Maybe LocaleType))
-> UpdateUser -> f UpdateUser
updateUser_locale = (UpdateUser -> Maybe LocaleType)
-> (UpdateUser -> Maybe LocaleType -> UpdateUser)
-> Lens UpdateUser UpdateUser (Maybe LocaleType) (Maybe LocaleType)
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)

-- | 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 :: (Maybe Text -> f (Maybe Text)) -> UpdateUser -> f UpdateUser
updateUser_authenticationToken = (UpdateUser -> Maybe (Sensitive Text))
-> (UpdateUser -> Maybe (Sensitive Text) -> UpdateUser)
-> Lens
     UpdateUser
     UpdateUser
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
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) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> UpdateUser -> f UpdateUser)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> UpdateUser
-> f UpdateUser
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
     (Maybe Text)
     (Maybe 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 (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive

-- | The amount of storage for the user.
updateUser_storageRule :: Lens.Lens' UpdateUser (Prelude.Maybe StorageRuleType)
updateUser_storageRule :: (Maybe StorageRuleType -> f (Maybe StorageRuleType))
-> UpdateUser -> f UpdateUser
updateUser_storageRule = (UpdateUser -> Maybe StorageRuleType)
-> (UpdateUser -> Maybe StorageRuleType -> UpdateUser)
-> Lens
     UpdateUser
     UpdateUser
     (Maybe StorageRuleType)
     (Maybe StorageRuleType)
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 type of the user.
updateUser_type :: Lens.Lens' UpdateUser (Prelude.Maybe UserType)
updateUser_type :: (Maybe UserType -> f (Maybe UserType))
-> UpdateUser -> f UpdateUser
updateUser_type = (UpdateUser -> Maybe UserType)
-> (UpdateUser -> Maybe UserType -> UpdateUser)
-> Lens UpdateUser UpdateUser (Maybe UserType) (Maybe UserType)
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 surname of the user.
updateUser_surname :: Lens.Lens' UpdateUser (Prelude.Maybe Prelude.Text)
updateUser_surname :: (Maybe Text -> f (Maybe Text)) -> UpdateUser -> f UpdateUser
updateUser_surname = (UpdateUser -> Maybe Text)
-> (UpdateUser -> Maybe Text -> UpdateUser)
-> Lens UpdateUser UpdateUser (Maybe Text) (Maybe Text)
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 :: (Maybe Text -> f (Maybe Text)) -> UpdateUser -> f UpdateUser
updateUser_timeZoneId = (UpdateUser -> Maybe Text)
-> (UpdateUser -> Maybe Text -> UpdateUser)
-> Lens UpdateUser UpdateUser (Maybe Text) (Maybe Text)
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 ID of the user.
updateUser_userId :: Lens.Lens' UpdateUser Prelude.Text
updateUser_userId :: (Text -> f Text) -> UpdateUser -> f UpdateUser
updateUser_userId = (UpdateUser -> Text)
-> (UpdateUser -> Text -> UpdateUser)
-> Lens UpdateUser UpdateUser Text Text
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 :: UpdateUser -> Request UpdateUser
request = Service -> UpdateUser -> Request UpdateUser
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.patchJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy UpdateUser
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateUser)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse UpdateUser))
-> Logger
-> Service
-> Proxy UpdateUser
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateUser)))
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 User -> Int -> UpdateUserResponse
UpdateUserResponse'
            (Maybe User -> Int -> UpdateUserResponse)
-> Either String (Maybe User)
-> Either String (Int -> UpdateUserResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe User)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"User")
            Either String (Int -> UpdateUserResponse)
-> Either String Int -> Either String UpdateUserResponse
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 UpdateUser

instance Prelude.NFData UpdateUser

instance Core.ToHeaders UpdateUser where
  toHeaders :: UpdateUser -> ResponseHeaders
toHeaders UpdateUser' {Maybe Text
Maybe (Sensitive Text)
Maybe BooleanEnumType
Maybe LocaleType
Maybe StorageRuleType
Maybe UserType
Text
userId :: Text
timeZoneId :: Maybe Text
surname :: Maybe Text
type' :: Maybe UserType
storageRule :: Maybe StorageRuleType
authenticationToken :: Maybe (Sensitive Text)
locale :: Maybe LocaleType
grantPoweruserPrivileges :: Maybe BooleanEnumType
givenName :: Maybe Text
$sel:userId:UpdateUser' :: UpdateUser -> Text
$sel:timeZoneId:UpdateUser' :: UpdateUser -> Maybe Text
$sel:surname:UpdateUser' :: UpdateUser -> Maybe Text
$sel:type':UpdateUser' :: UpdateUser -> Maybe UserType
$sel:storageRule:UpdateUser' :: UpdateUser -> Maybe StorageRuleType
$sel:authenticationToken:UpdateUser' :: UpdateUser -> Maybe (Sensitive Text)
$sel:locale:UpdateUser' :: UpdateUser -> Maybe LocaleType
$sel:grantPoweruserPrivileges:UpdateUser' :: UpdateUser -> Maybe BooleanEnumType
$sel:givenName:UpdateUser' :: UpdateUser -> Maybe Text
..} =
    [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ HeaderName
"Authentication" HeaderName -> Maybe (Sensitive Text) -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# Maybe (Sensitive Text)
authenticationToken,
        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 UpdateUser where
  toJSON :: UpdateUser -> Value
toJSON UpdateUser' {Maybe Text
Maybe (Sensitive Text)
Maybe BooleanEnumType
Maybe LocaleType
Maybe StorageRuleType
Maybe UserType
Text
userId :: Text
timeZoneId :: Maybe Text
surname :: Maybe Text
type' :: Maybe UserType
storageRule :: Maybe StorageRuleType
authenticationToken :: Maybe (Sensitive Text)
locale :: Maybe LocaleType
grantPoweruserPrivileges :: Maybe BooleanEnumType
givenName :: Maybe Text
$sel:userId:UpdateUser' :: UpdateUser -> Text
$sel:timeZoneId:UpdateUser' :: UpdateUser -> Maybe Text
$sel:surname:UpdateUser' :: UpdateUser -> Maybe Text
$sel:type':UpdateUser' :: UpdateUser -> Maybe UserType
$sel:storageRule:UpdateUser' :: UpdateUser -> Maybe StorageRuleType
$sel:authenticationToken:UpdateUser' :: UpdateUser -> Maybe (Sensitive Text)
$sel:locale:UpdateUser' :: UpdateUser -> Maybe LocaleType
$sel:grantPoweruserPrivileges:UpdateUser' :: UpdateUser -> Maybe BooleanEnumType
$sel:givenName:UpdateUser' :: UpdateUser -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"GivenName" 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
givenName,
            (Text
"GrantPoweruserPrivileges" Text -> BooleanEnumType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (BooleanEnumType -> Pair) -> Maybe BooleanEnumType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe BooleanEnumType
grantPoweruserPrivileges,
            (Text
"Locale" Text -> LocaleType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (LocaleType -> Pair) -> Maybe LocaleType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe LocaleType
locale,
            (Text
"StorageRule" Text -> StorageRuleType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (StorageRuleType -> Pair) -> Maybe StorageRuleType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe StorageRuleType
storageRule,
            (Text
"Type" Text -> UserType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (UserType -> Pair) -> Maybe UserType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe UserType
type',
            (Text
"Surname" 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
surname,
            (Text
"TimeZoneId" 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
timeZoneId
          ]
      )

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

instance Core.ToQuery UpdateUser where
  toQuery :: UpdateUser -> QueryString
toQuery = QueryString -> UpdateUser -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(UpdateUserResponse -> UpdateUserResponse -> Bool)
-> (UpdateUserResponse -> UpdateUserResponse -> Bool)
-> Eq UpdateUserResponse
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, ReadPrec [UpdateUserResponse]
ReadPrec UpdateUserResponse
Int -> ReadS UpdateUserResponse
ReadS [UpdateUserResponse]
(Int -> ReadS UpdateUserResponse)
-> ReadS [UpdateUserResponse]
-> ReadPrec UpdateUserResponse
-> ReadPrec [UpdateUserResponse]
-> Read UpdateUserResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateUserResponse]
$creadListPrec :: ReadPrec [UpdateUserResponse]
readPrec :: ReadPrec UpdateUserResponse
$creadPrec :: ReadPrec UpdateUserResponse
readList :: ReadS [UpdateUserResponse]
$creadList :: ReadS [UpdateUserResponse]
readsPrec :: Int -> ReadS UpdateUserResponse
$creadsPrec :: Int -> ReadS UpdateUserResponse
Prelude.Read, Int -> UpdateUserResponse -> ShowS
[UpdateUserResponse] -> ShowS
UpdateUserResponse -> String
(Int -> UpdateUserResponse -> ShowS)
-> (UpdateUserResponse -> String)
-> ([UpdateUserResponse] -> ShowS)
-> Show UpdateUserResponse
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. UpdateUserResponse -> Rep UpdateUserResponse x)
-> (forall x. Rep UpdateUserResponse x -> UpdateUserResponse)
-> Generic UpdateUserResponse
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' :: Maybe User -> Int -> UpdateUserResponse
UpdateUserResponse'
    { $sel:user:UpdateUserResponse' :: Maybe User
user = Maybe 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 :: (Maybe User -> f (Maybe User))
-> UpdateUserResponse -> f UpdateUserResponse
updateUserResponse_user = (UpdateUserResponse -> Maybe User)
-> (UpdateUserResponse -> Maybe User -> UpdateUserResponse)
-> Lens
     UpdateUserResponse UpdateUserResponse (Maybe User) (Maybe 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 :: (Int -> f Int) -> UpdateUserResponse -> f UpdateUserResponse
updateUserResponse_httpStatus = (UpdateUserResponse -> Int)
-> (UpdateUserResponse -> Int -> UpdateUserResponse)
-> Lens UpdateUserResponse UpdateUserResponse Int Int
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